slevomat / coding-standard

Slevomat Coding Standard for PHP_CodeSniffer provides many useful sniffs
MIT License
1.39k stars 176 forks source link

What i do wrong? #1696

Open hackimov opened 1 month ago

hackimov commented 1 month ago

vendor/bin/phpcbf --standard=phpcs.dist.xml

FFFFFFFFFFFFFFPHP Fatal error:  Uncaught PHP_CodeSniffer\Exceptions\RuntimeException: Undefined array key "scope_closer" in /var/www/vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/UseStatementHelper.php on line 238 in /var/www/vendor/squizlabs/php_codesniffer/src/Runner.php:623
Stack trace:
#0 /var/www/vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/UseStatementHelper.php(238): PHP_CodeSniffer\Runner->handleErrors(2, 'Undefined array...', '/var/www/vendor...', 238)
#1 /var/www/vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/SniffLocalCache.php(42): SlevomatCodingStandard\Helpers\UseStatementHelper::SlevomatCodingStandard\Helpers\{closure}()
#2 /var/www/vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/SniffLocalCache.php(31): SlevomatCodingStandard\Helpers\SniffLocalCache::setIfNotCached(2, '/var/www/app/Ca...', Object(Closure))
#3 /var/www/vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/UseStatementHelper.php(259): SlevomatCodingStandard\Helpers\SniffLocalCache::getAndSetIfNotCached(Object(PHP_CodeSniffer\Files\LocalFile), 'useStatementPoi...', Object(Closure))
#4 /var/www/vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/UseStatementHelper.php(168): SlevomatCodingStandard\Helpers\UseStatementHelper::getUseStatementPointers(Object(PHP_CodeSniffer\Files\LocalFile), 0)
#5 /var/www/vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/SniffLocalCache.php(42): SlevomatCodingStandard\Helpers\UseStatementHelper::SlevomatCodingStandard\Helpers\{closure}()
#6 /var/www/vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/SniffLocalCache.php(31): SlevomatCodingStandard\Helpers\SniffLocalCache::setIfNotCached(2, '/var/www/app/Ca...', Object(Closure))
#7 /var/www/vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/UseStatementHelper.php(202): SlevomatCodingStandard\Helpers\SniffLocalCache::getAndSetIfNotCached(Object(PHP_CodeSniffer\Files\LocalFile), 'useStatements', Object(Closure))
#8 /var/www/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Namespaces/AlphabeticallySortedUsesSniff.php(70): SlevomatCodingStandard\Helpers\UseStatementHelper::getFileUseStatements(Object(PHP_CodeSniffer\Files\LocalFile))
#9 /var/www/vendor/squizlabs/php_codesniffer/src/Files/File.php(519): SlevomatCodingStandard\Sniffs\Namespaces\AlphabeticallySortedUsesSniff->process(Object(PHP_CodeSniffer\Files\LocalFile), 0)
#10 /var/www/vendor/squizlabs/php_codesniffer/src/Files/LocalFile.php(92): PHP_CodeSniffer\Files\File->process()
#11 /var/www/vendor/squizlabs/php_codesniffer/src/Fixer.php(175): PHP_CodeSniffer\Files\LocalFile->process()
#12 /var/www/vendor/squizlabs/php_codesniffer/src/Reports/Cbf.php(53): PHP_CodeSniffer\Fixer->fixFile()
#13 /var/www/vendor/squizlabs/php_codesniffer/src/Reporter.php(285): PHP_CodeSniffer\Reports\Cbf->generateFileReport(Array, Object(PHP_CodeSniffer\Files\LocalFile), false, 136)
#14 /var/www/vendor/squizlabs/php_codesniffer/src/Runner.php(706): PHP_CodeSniffer\Reporter->cacheFileReport(Object(PHP_CodeSniffer\Files\LocalFile))
#15 /var/www/vendor/squizlabs/php_codesniffer/src/Runner.php(453): PHP_CodeSniffer\Runner->processFile(Object(PHP_CodeSniffer\Files\LocalFile))
#16 /var/www/vendor/squizlabs/php_codesniffer/src/Runner.php(215): PHP_CodeSniffer\Runner->run()
#17 /var/www/vendor/squizlabs/php_codesniffer/bin/phpcbf(14): PHP_CodeSniffer\Runner->runPHPCBF()
#18 /var/www/vendor/bin/phpcbf(119): include('/var/www/vendor...')
#19 {main}
  thrown in /var/www/vendor/squizlabs/php_codesniffer/src/Runner.php on line 623
hackimov commented 1 month ago

PS PHP 8.3

hackimov commented 1 month ago

error throws if code like this

<?php
namespace App\Models;

i was changed to

<?php

namespace App\Models;

and it works fine