-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Scope objectKey in nested partialLoop call #7093
Conversation
@larsnystrom can you please provide a test-case that verifies what is explained in #3758? |
* | ||
* @param string $key | ||
*/ | ||
public function setObjectKey($key) |
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.
Does this need to be public
?
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.
That method overrides setObjectKey()
in Partial, which we inherit. Maybe I should've added that to the docblock, but I'm unsure of the syntax.
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.
use {@inheritDoc}
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.
I don't think I can use that tag for other things than classes.
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.
You can use that for anything that is API overriding/implementing ;-)
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.
Guess my documentation skills needs to be improved then :) Pushed a fix for it now.
I added a test for issue #3758. My commit should make it pass. |
@@ -0,0 +1,10 @@ | |||
<?php | |||
$vars = $this->vars(); | |||
if (empty($vars)) : |
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.
use curly braces ( { } ) instead https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md#51-if-elseif-else
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.
nvm, it ignored in .php_cs
config ;)
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.
Oh well, I've already pushed a fix :)
* | ||
* @return self | ||
*/ | ||
protected function nestObjectKey() |
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.
I will make these new methods private
upon merge, since they really are a deep implementation detail
… given to the PartialLop helper
@larsnystrom merged, thanks! |
…ename properties for better clarity
…aking scope emulation variables `private`
…$key` may be `null`
…$key` may be `null`
…ixed return type (`self`)
…ixed return type (`self`), leveraging parent class API
…emoving minor code duplication
…/++/+= 1 - s/--/-= 1
…aking nesting/unNesting API `private`
…efactoring `PartialLoop` `$values` extraction logic into its own private method
…dding `@group` annotation for newly introduced tests
…dding test for non-iterable data exception message
…etter exception message in case of non-iterable values given to the PartialLop helper
…dding test for non-iterable object data exception message
…endframework#3758-scope-object-key-in-nested-partialloop-calls' Close zendframework/zendframework#7093 Close zendframework/zendframework#3758
…endframework#3758-scope-object-key-in-nested-partialloop-calls' into develop Close zendframework/zendframework#7093 Close zendframework/zendframework#3758 Forward port zendframework/zendframework#7093 Forward port zendframework/zendframework#3758
This is a fix for #3758 and introduces an
objectKeyStack
which scopes theobjectKey
to anestingLevel
. This allows nested calls with thePartialLoop
View Helper where each level of nesting uses it's own or a parent'sobjectKey
.It is not clear whether this is a bug fix or a feature request which introduces a BC break, but at least no tests are failing. I'd be happy to write a test case for this fix if necessary.
This is my first pull request ever, so please be gentle when providing feedback :)