Skip to content
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

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

Merged
merged 1 commit into from
Oct 17, 2017

Conversation

jrfnl
Copy link
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
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