Operators::isReference(): various improvements #45
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.
Operators::isReference(): implement use of the Parentheses and FunctionDeclarations classes
...and remove redundant code from the "is this a function parameter passed by reference" check.
Operators::isReference(): improve defensive coding
Includes unit test.
Operators::isReference(): add tests for select tokenizer issues
Refs:
Operators::isReference(): fix compatibility with PHPCS 2.8.0 - 3.2.3
PHPCS 2.8.0 - 3.2.3 contained a bug where a square open bracket
[
as the first code content after the PHP open tag in a file would be tokenized asT_OPEN_SQUARE_BRACKET
notT_OPEN_SHORT_ARRAY
.This is an edge-case bug as it can only occur when following the very first PHP open tag in a file and only if there is nothing before that open tag.
Either way, this commit adds work-arounds to the utility method to handle the situation correctly.