Skip to content

ForbiddenNamesAsInvokedFunctions: don't throw error on method invocations / PHP 7.0+#516

Merged
wimg merged 1 commit intomasterfrom
feature/issue-515-forbidden-names-invokes-php-7
Oct 17, 2017
Merged

ForbiddenNamesAsInvokedFunctions: don't throw error on method invocations / PHP 7.0+#516
wimg merged 1 commit intomasterfrom
feature/issue-515-forbidden-names-invokes-php-7

Conversation

@jrfnl
Copy link
Copy Markdown
Member

@jrfnl jrfnl commented Oct 16, 2017

How the PHP and PHPCS tokenizers tokenize the function name in a method call varies wildly across versions, sometimes its tokenized as its own token, often times its tokenized as T_STRING.
In practice this meant that method invocations pre-PHP 7.0 were not always caught by this sniff, while they should be.
At the same time, for PHP 7.0+, those should be exempt for the purposes of this sniff as the keyword reservation has been relaxed to allow these keywords to be used as method names.

Both these issues are fixed by this PR.

Fixes #515

…ions / PHP 7.0+

How the PHP and PHPCS tokenizers tokenize the function name in a method call varies wildly across versions, sometimes its tokenized as its own token, often times its tokenized as `T_STRING`.
In practice this meant that method invocations pre-PHP 7.0 were not always caught by this sniff, while they should be.
At the same time, for PHP 7.0+, those should be exempt for the purposes of this sniff as the keyword reservation has been relaxed to allow these keywords to be used as method names.

Both these issues are fixed by this PR.

Fixes 515
@wimg wimg merged commit 9a9d15a into master Oct 17, 2017
@wimg wimg deleted the feature/issue-515-forbidden-names-invokes-php-7 branch October 17, 2017 17:13
@jrfnl
Copy link
Copy Markdown
Member Author

jrfnl commented Oct 25, 2017

@wimg What should the milestone for this one be ? 8.0.2 or 8.1.0 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Forbidden keywords not forbidden as function names in PHP 7 and higher

2 participants