Closed jackjpdiscos closed 1 year ago
Hi!
You'll need to provide a bit more details. Which version of PHPCS and WPCS are you using? Did you install it via composer or globally? What PHP version are you running it on?
On what kind of code do you get such an error? A minimum code example would also help in trying to reproduce the error.
There is a whole bug issue template that you just removed. It would help us if you filled it out correctly.
``I have the same issue, using PHPCS/PHPCBF version 3.6.2
Code is just basic stuff, like spaces instead of tabs for indentation.
I installed it globally
Running PHP 8
Fatal error: Uncaught PHP_CodeSniffer\Exceptions\RuntimeException: Trying to access array offset on value of type null in /Users/sk/wpcs/WordPress/Sniff.php on line 1480 in phar:///usr/local/Cellar/php-code-sniffer/3.6.2_1/bin/phpcbf/src/Runner.php:607
Stack trace:
#0 /Users/sk/wpcs/WordPress/Sniff.php(1480): PHP_CodeSniffer\Runner->handleErrors(2, 'Trying to acces...', '/Users/sk/wpcs/...', 1480)
#1 /Users/sk/wpcs/WordPress/Sniffs/Security/NonceVerificationSniff.php(124): WordPressCS\WordPress\Sniff->has_nonce_check(28)
#2 /Users/sk/wpcs/WordPress/Sniff.php(900): WordPressCS\WordPress\Sniffs\Security\NonceVerificationSniff->process_token(28)
#3 phar:///usr/local/Cellar/php-code-sniffer/3.6.2_1/bin/phpcbf/src/Files/File.php(498): WordPressCS\WordPress\Sniff->process(Object(PHP_CodeSniffer\Files\LocalFile), 28)
#4 phar:///usr/local/Cellar/php-code-sniffer/3.6.2_1/bin/phpcbf/src/Files/LocalFile.php(92): PHP_CodeSniffer\Files\File->process()
#5 phar:///usr/local/Cellar/php-code-sniffer/3.6.2_1/bin/phpcbf/src/Fixer.php(174): PHP_CodeSniffer\Files\LocalFile->process()
#6 phar:///usr/local/Cellar/php-code-sniffer/3.6.2_1/bin/phpcbf/src/Reports/Cbf.php(52): PHP_CodeSniffer\Fixer->fixFile()
#7 phar:///usr/local/Cellar/php-code-sniffer/3.6.2_1/bin/phpcbf/src/Reporter.php(285): PHP_CodeSniffer\Reports\Cbf->generateFileReport(Array, Object(PHP_CodeSniffer\Files\LocalFile), false, 190)
#8 phar:///usr/local/Cellar/php-code-sniffer/3.6.2_1/bin/phpcbf/src/Runner.php(657): PHP_CodeSniffer\Reporter->cacheFileReport(Object(PHP_CodeSniffer\Files\LocalFile), Object(PHP_CodeSniffer\Config))
#9 phar:///usr/local/Cellar/php-code-sniffer/3.6.2_1/bin/phpcbf/src/Runner.php(434): PHP_CodeSniffer\Runner->processFile(Object(PHP_CodeSniffer\Files\LocalFile))
#10 phar:///usr/local/Cellar/php-code-sniffer/3.6.2_1/bin/phpcbf/src/Runner.php(200): PHP_CodeSniffer\Runner->run()
#11 /usr/local/Cellar/php-code-sniffer/3.6.2_1/bin/phpcbf(6): PHP_CodeSniffer\Runner->runPHPCBF()
#12 {main}
thrown in phar:///usr/local/Cellar/php-code-sniffer/3.6.2_1/bin/phpcbf/src/Runner.php on line 607`
Please provide a code sample with which the error can be reproduced. Without that, I'm going to close this issue in two weeks time.
Literally any php code produces this error for me... for example:
`<?php
print_r( $_POST );
`
Notice the print_r has leading spaces, wich should be removed.
just noticed that another "wpcs" error shows in the tooltip when i hover over the first formatting error:
@djstini That's a different error and unrelated to this issue.
yes, i know, but the original error still exists, just added the info about the additional error, because it might help troubleshooting
@djstini Thanks, but it doesn't.
Closing for lack of actionable information with which to reproduce the issue.
Hi,
I get the following error when running the following command:
phpcbf --standard=WordPress _foldername_