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

NewClosure: report usage of self/parent/static for PHP < 5.4 + prevent double notices #669

Merged
merged 2 commits into from Jun 17, 2018

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Jun 15, 2018

NewClosure: prevent double reporting for nested closures

As pointed out by @moorscode, closures can be nested within closures. As the sniff was, that would result in the notices for the inner closure being thrown twice.

The first commit fixes this.

Includes unit test, though this can not be automatically tested with the unit test framework as is.
The unit test is there so manual testing will pick up on it.

PHP 5.4: NewClosure: report on self/parent/static:: being used in PHP < 5.4

Not mentioned in the manual, but both the test sample provided by @asadkn as well as further tests I ran confirmed that this was changed in PHP 5.4

Includes unit tests.

Fixes #668

@jrfnl jrfnl added enhancement PR: quick merge PR only contains relatively simple changes labels Jun 15, 2018
@jrfnl jrfnl added this to the 8.2.0 milestone Jun 15, 2018
@jrfnl jrfnl requested a review from wimg June 15, 2018 23:15
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.

None yet

2 participants