diff --git a/.github/workflows/basics.yml b/.github/workflows/basics.yml index 7d9b1288..4505996f 100644 --- a/.github/workflows/basics.yml +++ b/.github/workflows/basics.yml @@ -51,6 +51,7 @@ jobs: phpcsstandards/phpcsextra:"dev-develop" wp-coding-standards/wpcs:"dev-develop" slevomat/coding-standard:"dev-master" + sirbrillig/phpcs-variable-analysis:"2.x" # Install dependencies and handle caching in one go. # @link https://github.com/marketplace/actions/install-php-dependencies-with-composer diff --git a/README.md b/README.md index 9460fb3e..33fa7134 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,7 @@ Severity levels: The `Yoast` standard for PHP_CodeSniffer is comprised of the following: * The `WordPress` ruleset from the [WordPress Coding Standards](https://github.com/WordPress/WordPress-Coding-Standards) implementing the official [WordPress PHP Coding Standards](https://make.wordpress.org/core/handbook/coding-standards/php/), with some [select exclusions](https://github.com/Yoast/yoastcs/blob/develop/Yoast/ruleset.xml#L29-L75). * The [`PHPCompatibilityWP`](https://github.com/PHPCompatibility/PHPCompatibilityWP) ruleset which checks code for PHP cross-version compatibility while preventing false positives for functionality polyfilled within WordPress. +* The [`VariableAnalysis`](https://github.com/sirbrillig/phpcs-variable-analysis/) ruleset. * Select additional sniffs taken from [`PHP_CodeSniffer`](https://github.com/PHPCSStandards/PHP_CodeSniffer). * Select additional sniffs taken from [`PHPCSExtra`](https://github.com/PHPCSStandards/PHPCSExtra). * Select additional sniffs taken from [`SlevomatCodingStandard`](https://github.com/slevomat/coding-standard). diff --git a/Yoast/Reports/Threshold.php b/Yoast/Reports/Threshold.php index e4bb243f..1334af75 100644 --- a/Yoast/Reports/Threshold.php +++ b/Yoast/Reports/Threshold.php @@ -19,6 +19,8 @@ * available which can be used in calling scripts. * * @since 2.2.0 + * + * @phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Flags unused params which are required via the interface. Invalid. */ final class Threshold implements Report { diff --git a/Yoast/ruleset.xml b/Yoast/ruleset.xml index 88daada1..138b675a 100644 --- a/Yoast/ruleset.xml +++ b/Yoast/ruleset.xml @@ -159,6 +159,25 @@ + + + + + + + + + + + + + + +