Closed krokodok closed 5 months ago
Do you have an example code snippet/project where this was an issue?
I encountered these problems at https://github.com/wearerequired/autofit-garages/, but I don't remember exactly how to reproduce it. Maybe this can somehow work otherwise. I did in fact not encounter the same problem at other PHP 8.2 websites, but maybe the project setups are too different.
I was able to revert the related commit and PHPCS is still running.
Keeping this open for further reference.
I just encountered the problem in https://github.com/wearerequired/trailworks-theme as well. The problem occurs only in VS Code and that was the reason for my update.
wearerequired/coding-standards
to ^3.0
phpcs
on save by extension
wearerequired/coding-standards
to ^5.0
phpcs
on save by extension
wearerequired/coding-standards
to dev-master
AND phpcompatibility/php-compatibility
to "dev-develop as 9.9.99"
An error occurred during processing; checking has been aborted. The error message was: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /Users/jeffchi/Projects/trailworks/wordpress/content/themes/trailworks-theme/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniff.php on line 131\nThe error originated in the .PHPCompatibility. sniff on line 131.
If this is just an individual error for my IDE setup, that is okay. It still works from CLI.
Interesting! I'll give the extension a try. I'm using shevaua.phpcs and persoderlind.vscode-phpcbf.
@krokodok I was able to reproduce this (also with my extensions) and it's actually a PHPCS config error. The upgrade guide for 5.0.0 includes the note that you have to set minimum_supported_wp_version
and testVersion
in phpcs.xml.dist
. Once you add the necessary config the error is gone and you get the sniff to use the correct version for any compatibility checks.
Line 131 of Sniff.php is about the testVersion
. In the develop branch a string cast operator is used.
@ocean90 Super, thanks for taking the time to check!
To make the package PHPCompatibility/PHPCompatibility, which is a dependency of PHPCompatibility/PHPCompatibilityWP, work with PHP 8.2, the developers suggest using the
develop
-Branch as version9.9.99
until there is a new release: