-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add IsFirst/IsLast methods to match SS5 conventions (closes #1274) #1275
base: 5
Are you sure you want to change the base?
Conversation
01173bf
to
8419585
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, thanks for submitting this. I've filled in the missing information from the PR template for you this time around.
Please also add a PHPDoc comment describing what the isFirst()
and isLast()
methods do.
Please also make a PR to developer-docs adding notes about these new deprecations to the 5.4.0 changelog.
Please also add either the |
There are tests for the original methods. Please add tests for the new methods as well. |
8419585
to
b670501
Compare
b670501
to
ac1f803
Compare
Have made the requested amends, docs PR: silverstripe/developer-docs#631 |
ac1f803
to
fb1eba2
Compare
$this->assertFalse($element->Last()); | ||
$this->assertTrue($element2->Last()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->assertFalse($element->Last()); | |
$this->assertTrue($element2->Last()); | |
$this->assertFalse($element->IsLast()); | |
$this->assertTrue($element2->IsLast()); |
|
||
/** | ||
* Returns true if this is the last element rendered in the ElementalArea | ||
* @return bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @return bool |
Sorry, should have caught this last time. We don't need the PHPDoc if it doesn't give any additional context over the actual type hint.
@@ -1232,21 +1232,41 @@ public function getPageTitle() | |||
} | |||
|
|||
/** | |||
* @return boolean | |||
* Returns true if this is the first element rendered in the ElementalArea | |||
* @return bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @return bool |
Description
Deprecates
First()
andLast()
in favour ofIsFirst()
andIsLast()
, as these methods are intended to override the built-in iteration methods of those names.Manual testing steps
Check the value of
$IsFirst
and$IsLast
in elemental block templatesIssues
Pull request checklist