You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using WPCS with PHP 8.3, the I18n and PrefixAllGlobals sniffs are causing deprecation notices due to trim() being called with null values.
Error Message
trim(): Passing null to parameter #1 ($string) of type string is deprecated
The error occurs in:
/WordPress/Sniffs/WP/I18nSniff.php on line 194
/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php on line 280
Environment
PHP Version: 8.3.11
WPCS Version: 2.3.0
Project: Working with _s (Underscores) WordPress starter theme
Impact
This affects all PHP files being checked by these sniffs, making it difficult to use WPCS with PHP 8.3. The error prevents proper code analysis as the checking is aborted when the deprecation notice is encountered.
Temporary Workaround
Currently using a local PHPCS configuration that excludes these sniffs to allow development to continue, but this means losing important WordPress-specific checks.
Suggested Solution
Update the relevant sniffs to ensure trim() is only called on string values, possibly by adding type checking before the trim() calls.
The text was updated successfully, but these errors were encountered:
Description
When using WPCS with PHP 8.3, the I18n and PrefixAllGlobals sniffs are causing deprecation notices due to
trim()
being called with null values.Error Message
trim(): Passing null to parameter #1 ($string) of type string is deprecated
The error occurs in:
/WordPress/Sniffs/WP/I18nSniff.php
on line 194/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php
on line 280Environment
Impact
This affects all PHP files being checked by these sniffs, making it difficult to use WPCS with PHP 8.3. The error prevents proper code analysis as the checking is aborted when the deprecation notice is encountered.
Temporary Workaround
Currently using a local PHPCS configuration that excludes these sniffs to allow development to continue, but this means losing important WordPress-specific checks.
Suggested Solution
Update the relevant sniffs to ensure
trim()
is only called on string values, possibly by adding type checking before thetrim()
calls.The text was updated successfully, but these errors were encountered: