-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Hotfix: correct array indices #2746
Hotfix: correct array indices #2746
Conversation
I've changed the approach completely. In my opinion it much clearer. Added tests to cover the issue described in squizlabs#2745. Fixes squizlabs#2745 It solves also the problem when we had `["value_start" => false]` for an empty array.
This is quite a large refactor that has removed a fair bit of code. Can you provide a bit of an explanation about what changes have been made and why? |
@gsherwood I just wrote it from scratch instead of "fixing" the old code. There are two functions now: one which is finding all indices in the array and the other ( If you read just new code you will see it is all pretty clear, and we don't need all these old code, imo. |
@michalbundyra I just wrote a Sniff checking for comma and I added the comma in the indices here #2759. How can we add the commas with your refactor ? |
@VincentLanglet It would be easy to add it here. I am not doing it as it is out of the scope right now and PR #2759 is going to be changes (as I understand from comments there). |
Refactoring a sniff is fine, but I can't determine what the actual fix is here. I can't accept this PR as a bug fix, so I'll remove it from the 3.5.4 milestone. |
Quick update: I'm working on writing tests for the AbstractArraySniff indices processing to expose the original bug. If I get a comprehensive enough suite of tests for it, I'll come back and review this refactor for inclusion. |
After adding some core tests for this sniff, I've been able to verify that this refactor is working correctly. Thanks a lot for this PR. This sniff is much cleaner now, and also fixes #2745. |
I've changed the approach completely. In my opinion it much clearer.
Added tests to cover the issue described in #2745.
Fixes #2745
It solves also the problem when we had
["value_start" => false]
for an empty array.