sirbrillig / phpcs-variable-analysis

Find undefined and unused variables with the PHP Codesniffer static analysis tool.
Other
136 stars 14 forks source link

Make test suite compatible with PHPCS 3.8.0 #304

Closed jrfnl closed 1 year ago

jrfnl commented 1 year ago

As per the deprecation notice being thrown:

setSniffProperty: the format of the $settings parameter has changed from (mixed) $value to array('scope' => 'sniff|standard', 'value' => $value). Please update your integration code. See PR #3629 for more information.

... the format of the $settings parameter for the Ruleset::setSniffProperty() method has changed to allow PHPCS to prevent notices about dynamic properties.

This commit updates the test suite to allow for both the PHPCS < 3.8.0 as well as the PHPCS 3.8.0+ way of setting properties directly on the Ruleset by adding a helper method to the BaseTestCase to set the properties in the correct way depending on the PHPCS version used.

Ref: squizlabs/php_codesniffer#3629