Skip to content

Commit 8419585

Browse files
committed
Add IsFirst/IsLast methods to match SS5 conventions (closes #1274)
1 parent 5f8f754 commit 8419585

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/Models/BaseElement.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,22 +1231,28 @@ public function getPageTitle()
12311231
return null;
12321232
}
12331233

1234-
/**
1235-
* @return boolean
1236-
*/
1237-
public function First()
1234+
public function IsFirst(): bool
12381235
{
12391236
return ($this->Parent()->Elements()->first()->ID === $this->ID);
12401237
}
12411238

1242-
/**
1243-
* @return boolean
1244-
*/
1245-
public function Last()
1239+
public function First()
1240+
{
1241+
Deprecation::notice('5.4.0', 'Use IsFirst instead');
1242+
return $this->IsFirst();
1243+
}
1244+
1245+
public function IsLast(): bool
12461246
{
12471247
return ($this->Parent()->Elements()->last()->ID === $this->ID);
12481248
}
12491249

1250+
public function Last()
1251+
{
1252+
Deprecation::notice('5.4.0', 'Use IsLast instead');
1253+
return $this->IsLast();
1254+
}
1255+
12501256
/**
12511257
* @return int
12521258
*/

0 commit comments

Comments
 (0)