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

PHPCS 3.x prep: work round a function which will no longer exist #1045

Merged

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Jul 22, 2017

This PR is part of the preparation for PHPCS 3.x compatibility.

The removeTokenListener() method was used to prevent the sniffs using these abstracts from being called for further files, however, this method will no longer exist in PHPCS 3.x with no alternative.

The AbstractFunctionRestrictionSniff also uses a getGroups() method, but calls it earlier and prevents the child sniffs from being run without groups by just not registering any token listeners if no groups are found.

This same methodology has now been implemented in the two abstracts which used the removeTokenListener() method, effectively making these sniffs more efficient and preventing the removal of the method from becoming a problem.

The `removeTokenListener()` method was used to prevent the sniffs using these abstracts from being called for further files, however, this method will no longer exist in PHPCS 3.x with no alternative.

The `AbstractFunctionRestrictionSniff` also uses a `getGroups()` method, but calls it earlier and prevents the child sniffs from being run without groups by just not registering any token listeners if no groups are found.

This same methodology has now been implemented in the two abstracts which used the `removeTokenListener()` method, effectively making these sniffs more efficient and preventing the removal of the method from becoming a problem.
@jrfnl jrfnl added this to the 0.13.0 milestone Jul 22, 2017
@jrfnl jrfnl mentioned this pull request Jul 22, 2017
@GaryJones GaryJones merged commit 99146fd into develop Jul 22, 2017
@GaryJones GaryJones deleted the WPCS-0.13.0/feature/phpcs-3.x-prep-getgroups-in-abstracts branch July 22, 2017 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants