Skip to content

PHPCS: bug fix - prevent error for property which is not always available (incl changelog 3.4.1)#428

Open
jrfnl wants to merge 2 commits intodevelopfrom
feature/bug-fix-remove-property
Open

PHPCS: bug fix - prevent error for property which is not always available (incl changelog 3.4.1)#428
jrfnl wants to merge 2 commits intodevelopfrom
feature/bug-fix-remove-property

Conversation

@jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Feb 28, 2026

Turns out the checkIfConditions property for the SlevomatCodingStandard.ControlStructures.RequireNullCoalesceEqualOperator sniff is only available as of Slevomat 8.17.0.

As Slevomat raised their minimum PHP version to PHP 7.4 in v 8.16.0 and this package still supports a minimum of PHP 7.2, the version constraint for the Slevomat dependency cannot be changed for the time being.

If we set the property directly on the sniff (like originally done), PHPCS will error out with the following error message when run with Slevomat < 8.17.0:

ERROR: Property "checkIfConditions" does not exist on sniff SlevomatCodingStandard.ControlStructures.RequireNullCoalesceEqualOperator.

So, even though the property is useful for those Yoast packages which can run with a higher Slevomat version (i.e. all packages which have a PHP 7.4 minimum and no conflicting dependencies), we unfortunately cannot (yet) set it by default.

Ref:

…able

Turns out the `checkIfConditions` property for the `SlevomatCodingStandard.ControlStructures.RequireNullCoalesceEqualOperator` sniff is only available as of Slevomat 8.17.0.

As Slevomat raised their minimum PHP version to PHP 7.4 in v 8.16.0 and this package still supports a minimum of PHP 7.2, the version constraint for the Slevomat dependency cannot be changed for the time being.

If we set the property directly on the sniff (like originally done), PHPCS will error out with the following error message when run with Slevomat < 8.17.0:
```
ERROR: Property "checkIfConditions" does not exist on sniff SlevomatCodingStandard.ControlStructures.RequireNullCoalesceEqualOperator.
```

So, even though the property is useful for those Yoast packages which can run with a higher Slevomat version (i.e. all packages which have a PHP 7.4 minimum and no conflicting dependencies), we unfortunately cannot (yet) set it by default.

Ref:
* slevomat/coding-standard@2031373
* https://github.com/slevomat/coding-standard/releases/tag/8.17.0
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.

1 participant