Skip to content

Conversation

@jrfnl
Copy link
Member

@jrfnl jrfnl commented Dec 20, 2018

PHPCS 3.2.0 includes the same DiscourageGoto sniff as was previously pulled to WPCS.

As the minimum PHPCS requirement has gone up to beyond 3.2.0 now, we can switch over to use the upstream version instead.

Note:
Deprecating the WPCS version of the sniff and letting it extend the upstream version and throwing a deprecation message would be useless in this case, as:

  • When doing so, the error codes for the normal messages would not change, so people would not be able to update their custom rulesets and/or inline annotations.
  • If both sniffs - the WPCS one and the PHPCS version - would be included in the ruleset, we'd need to silence the error codes from one or the other to prevent duplicate messages from being thrown.
    • If we'd silence the PHPCS messages, the net effect would be the same as just keeping the WPCS sniff and people would still not be able to adjust their rulesets/annotations.
    • If we'd silence the WPCS messages, the net effect would be the same as this PR minus the deprecation message.
      So, as this will be going into a major release anyway, we may as well get the change over with.

Note: this is a BC-break for anyone using a custom ruleset or PHPCS annotations referencing the previously included sniff.

Refs:

PHPCS 3.2.0 includes the same `DiscourageGoto` sniff as was previously pulled to WPCS.

As the minimum PHPCS requirement has gone up to beyond 3.2.0 now, we can switch over to use the upstream version instead.

Note:
Deprecating the WPCS version of the sniff and letting it extend the upstream version and throwing a deprecation message would be useless in this case, as:
* When doing so, the error codes for the normal messages would not change, so people would not be able to update their custom rulesets and/or inline annotations.
* If both sniffs - the WPCS one and the PHPCS version - would be included in the ruleset, we'd need to silence the error codes from one or the other to prevent duplicate messages from being thrown.
    - If we'd silence the PHPCS messages, the net effect would be the same as just keeping the WPCS sniff and people would still not be able to adjust their rulesets/annotations.
    - If we'd silence the WPCS messages, the net effect would be the same as this PR minus the deprecation message.
        So, as this will be going into a major release anyway, we may as well get the change over with.

Note: this is a BC-break for anyone using a custom ruleset or PHPCS annotations referencing the previously included sniff.

Refs:
* squizlabs/PHP_CodeSniffer 1662
* squizlabs/PHP_CodeSniffer 1664
@GaryJones GaryJones merged commit f56e738 into develop Dec 21, 2018
@GaryJones GaryJones deleted the feature/remove-discouragegoto-sniff branch December 21, 2018 08:25
@jrfnl jrfnl mentioned this pull request Dec 23, 2018
11 tasks
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.

3 participants