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
Describe the bug
A clear and concise description of what the bug is.
The following error occurs:
CodeSniffer exited with code 255
stdout:
stderr: PHP Fatal error: Uncaught TypeError: vsprintf(): Argument #2 ($values) must be of type array, string given in /opt/docker/app/.composer/vendor/squizlabs/php_codesniffer/src/Files/File.php:1056
Stack trace:
#0 /opt/docker/app/.composer/vendor/squizlabs/php_codesniffer/src/Files/File.php(1056): vsprintf() #1 /opt/docker/app/.composer/vendor/squizlabs/php_codesniffer/src/Files/File.php(672): PHP_CodeSniffer\Files\File->addMessage() #2 /opt/docker/app/.composer/vendor/squizlabs/php_codesniffer/src/Files/File.php(780): PHP_CodeSniffer\Files\File->addError() #3 /opt/docker/app/.composer/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WhiteSpace/ControlStructureSpacingSniff.php(205): PHP_CodeSniffer\Files\File->addFixableError() #4 /opt/docker/app/.composer/vendor/wp-coding-standards/wpcs/WordPress/Sniff.php(910): WordPressCS\WordPress\Sniffs\WhiteSpace\ControlStructureSpacingSniff->process_token() #5 /opt/docker/app/.composer/vendor/squizlabs/php_codesniffer/src/Files/File.php(498): WordPressCS\WordPress\Sniff->process() #6 /opt/docker/app/.composer/vendor/squizlabs/php_codesniffer/src/Files/LocalFile.php(92): PHP_CodeSniffer\Files\File->process() #7 /opt/docker/app/.composer/vendor/squizlabs/php_codesniffer/src/Runner.php(631): PHP_CodeSniffer\Files\LocalFile->process() #8 /opt/docker/app/.composer/vendor/squizlabs/php_codesniffer/src/Runner.php(434): PHP_CodeSniffer\Runner->processFile() #9 /opt/docker/app/.composer/vendor/squizlabs/php_codesniffer/src/Runner.php(114): PHP_CodeSniffer\Runner->run() #10 /opt/docker/app/.composer/vendor/squizlabs/php_codesniffer/bin/phpcs(18): PHP_CodeSniffer\Runner->runPHPCS() #11 /opt/docker/app/.composer/vendor/bin/phpcs(117): include('...') #12 {main}
thrown in /opt/docker/app/.composer/vendor/squizlabs/php_codesniffer/src/Files/File.php on line 1056
Code sample
// see my comments at 'to reproduce'
Custom ruleset
<?xml version="1.0"?>
<rulesetname="WordPress Coding Standards for Plugins">
<description>Generally-applicable sniffs for WordPress plugins</description>
<ruleref="WordPress-Core" >
<excludename="Generic.Arrays.DisallowShortArraySyntax"/>
<excludename="WordPress.PHP.DisallowShortTernary"/>
<excludename="WordPress.DateTime.RestrictedFunctions.date_date"/>
</rule>
<ruleref="WordPress-Docs" />
<ruleref="WordPress-Extra">
<excludename="WordPress.WP.AlternativeFunctions.file_system_read_fopen"/>
<excludename="WordPress.WP.AlternativeFunctions.file_system_read_fclose"/>
<excludename="WordPress.WP.AlternativeFunctions.file_system_read_fwrite"/>
</rule>
<!-- Check all PHP files in directory tree by default. -->
<argname="extensions"value="php"/>
<file>.</file>
<!-- Show sniff codes in all reports -->
<argvalue="s"/>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/tmp/*</exclude-pattern>
</ruleset>
To reproduce
I believe it the error dump is caused when a space character is detected in a function definition. According the Wordpress styling rules the function name should immediately be followed with an opening bracket.
So if a file contains something like ' private static function myfunc (' the error occurs, while if the space character is removed ( '... myfyunc( ' ) it does not.
Expected behavior
A clear and concise description of what you expected to happen.
Versions (please complete the following information):
OS: not relevant (Windows 10 and Linux)
PHP: 8.1
PHPCS: 3.6.2
Standard: Wordpress
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
This is not an issue with PHPCS itself, but with the WordPress standard which hasn't released a new version containing the fix for the above issue yet. (a fix has been committed though, so no need to report it there)
Describe the bug
A clear and concise description of what the bug is.
The following error occurs:
CodeSniffer exited with code 255
stdout:
stderr: PHP Fatal error: Uncaught TypeError: vsprintf(): Argument #2 ($values) must be of type array, string given in /opt/docker/app/.composer/vendor/squizlabs/php_codesniffer/src/Files/File.php:1056
Stack trace:
#0 /opt/docker/app/.composer/vendor/squizlabs/php_codesniffer/src/Files/File.php(1056): vsprintf()
#1 /opt/docker/app/.composer/vendor/squizlabs/php_codesniffer/src/Files/File.php(672): PHP_CodeSniffer\Files\File->addMessage()
#2 /opt/docker/app/.composer/vendor/squizlabs/php_codesniffer/src/Files/File.php(780): PHP_CodeSniffer\Files\File->addError()
#3 /opt/docker/app/.composer/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WhiteSpace/ControlStructureSpacingSniff.php(205): PHP_CodeSniffer\Files\File->addFixableError()
#4 /opt/docker/app/.composer/vendor/wp-coding-standards/wpcs/WordPress/Sniff.php(910): WordPressCS\WordPress\Sniffs\WhiteSpace\ControlStructureSpacingSniff->process_token()
#5 /opt/docker/app/.composer/vendor/squizlabs/php_codesniffer/src/Files/File.php(498): WordPressCS\WordPress\Sniff->process()
#6 /opt/docker/app/.composer/vendor/squizlabs/php_codesniffer/src/Files/LocalFile.php(92): PHP_CodeSniffer\Files\File->process()
#7 /opt/docker/app/.composer/vendor/squizlabs/php_codesniffer/src/Runner.php(631): PHP_CodeSniffer\Files\LocalFile->process()
#8 /opt/docker/app/.composer/vendor/squizlabs/php_codesniffer/src/Runner.php(434): PHP_CodeSniffer\Runner->processFile()
#9 /opt/docker/app/.composer/vendor/squizlabs/php_codesniffer/src/Runner.php(114): PHP_CodeSniffer\Runner->run()
#10 /opt/docker/app/.composer/vendor/squizlabs/php_codesniffer/bin/phpcs(18): PHP_CodeSniffer\Runner->runPHPCS()
#11 /opt/docker/app/.composer/vendor/bin/phpcs(117): include('...')
#12 {main}
thrown in /opt/docker/app/.composer/vendor/squizlabs/php_codesniffer/src/Files/File.php on line 1056
Code sample
// see my comments at 'to reproduce'
Custom ruleset
To reproduce
I believe it the error dump is caused when a space character is detected in a function definition. According the Wordpress styling rules the function name should immediately be followed with an opening bracket.
So if a file contains something like ' private static function myfunc (' the error occurs, while if the space character is removed ( '... myfyunc( ' ) it does not.
Expected behavior
A clear and concise description of what you expected to happen.
Versions (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: