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

Make test suite compatible with PHPCS 3.8.0 #304

Merged
merged 1 commit into from
Jul 19, 2023

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Jul 16, 2023

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

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
Copy link
Owner

@sirbrillig sirbrillig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing. Thank you! TIL about version_compare().

@sirbrillig sirbrillig merged commit 71d9f67 into 2.x Jul 19, 2023
@sirbrillig sirbrillig deleted the feature/make-tests-compatible-with-phpcs-3.8.0 branch July 19, 2023 00:07
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.

2 participants