Generic/MultipleStatementAlignment: fix bug/list syntax before assignment operator #1924
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This simplifies the fixes which were previously committed to fix #1870 and #1848, which were released in
3.2.3
.Both those fixes try to prevent the sniff getting confused over (potentially) multi-line value assignments, such as closures and arrays.
The simplification removes the previously added code in favour of skipping to the end of a statement as soon as an assignment operator has been found.
This might also make the sniff marginally faster as the tokens between the assignment operator and the end of the statement will no longer be examined.
N.B.: The reason for going one back from the end of the assignment (line 241), is that otherwise the code addressing the issue covered by the unit test on line 220 / added in commit 579d39c would not be triggered, leading to incorrect results.
Fixes #1922
Side-note: I think it would be a good idea to add unit tests for the
File::findEndOfStatement()
method.