Skip to content

Commit

Permalink
Enable the Generic.CodeAnalysis.UnusedFunctionParameter sniff.
Browse files Browse the repository at this point in the history
The reason why the sniff was disabled up to now was that WP uses callbacks a lot and the hooked in functions may not use all parameters passed to them.

This concern was previously raised in #382 (comment)

To this end, I've send in a PR upstream to address these concerns, which has subsequently been merged.
The adjusted version of the sniff will be released in PHPCS 2.7.2.
  • Loading branch information
jrfnl committed Feb 25, 2017
1 parent aa75d75 commit 234708e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ php:

env:
- PHPCS_BRANCH=master
- PHPCS_BRANCH=2.7.1
- PHPCS_BRANCH=2.7.2

matrix:
fast_finish: true
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ This project is a collection of [PHP_CodeSniffer](https://github.com/squizlabs/P

### Requirements

The WordPress Coding Standards require the [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) version **2.7.0** or higher.
The WordPress Coding Standards require the [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) version **2.7.2** or higher.
The WordPress Coding Standards are currently [not compatible with the upcoming PHPCS 3 release](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/718).

### Composer
Expand Down
11 changes: 8 additions & 3 deletions WordPress-Extra/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@
<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/382#discussion_r29970107 -->
<!--<rule ref="Generic.Formatting.MultipleStatementAlignment"/>-->

<!-- Hook callbacks may not use all params -->
<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/382#discussion_r29981655 -->
<!--<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>-->
<!-- Check that functions use all parameters passed.
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/xxx -->
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter">
<properties>
<property name="ignore_extended_classes" value="true" />
<property name="allow_for_callbacks" value="true" />
</properties>
</rule>

<rule ref="WordPress-Core"/>

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}
],
"require" : {
"squizlabs/php_codesniffer": "^2.7"
"squizlabs/php_codesniffer": "^2.7.2"
},
"minimum-stability" : "RC",
"support" : {
Expand Down

0 comments on commit 234708e

Please sign in to comment.