-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
fix: Squiz.Arrays.ArrayDeclaration for static closures #369
Conversation
Fixes PHPCSStandards#368
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.
@michalbundyra Thanks for working on this.
When looking at the patch, I have three questions:
- Why did you add a separate unit test case file instead of adding the code sample to the 1 (long arrays) + 2 (short arrays) test case files ?
- In the comment, you mention that the value pointer in
$indices
is not set correctly for this type of code. The current fix is basically a work-around for that. Is there a reason to use a work-around instead of fixing it when$indices
is set originally ? - When I run the following command on the test case file, I get a different result from what is in the committed
.fixed
file, even though the tests pass. Any idea why this is happening ?phpcbf -ps ./squiz/Tests/Arrays/ArrayDeclarationUnitTest.3.inc --standard=Squiz --sniffs=Squiz.Arrays.ArrayDeclaration --suffix=.fixed
@jrfnl thanks for reviewing.
|
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.
Hi @michalbundyra, thanks for making those updates. Looks good to me. Merging!
Re: 3 - this is still happening, but not just for your code sample in the 1/2 test case files. Considering the status of the sniff (on the shortlist for removal), I'm going to let this go as it's not worth the time to investigate this further.
Fixes #368
@michalbundyra I think I've found a bug in this patch - consider an array entry doing Would you like to submit a patch for this ? Or would you like me to follow up on this ? And as a follow-up is now needed, we should probably make sure the tests contain all possible uses of |
@jrfnl I had a bad feeling that it might end up like that, but I haven't found yet the failing example in my head. You are right about these... so maybe my first approach "workaround" was better here, then? If so, I can create a new PR with this change and adding other test cases. |
@michalbundyra I think the change is in the right place in the flow of the logic, but I think the check for So something along the lines of:
|
Thanks @michalbundyra, I'll have a look tomorrow. |
Follow-up #369 - Squiz.Arrays.ArrayDeclaration for static
Description
@jrfnl it turns out to be a quick fix
Suggested changelog entry
Related issues/external references
Fixes #368
Types of changes
PR checklist