From eeeffb39e6bd5f5369b37bf6bf7cb0880d1d0591 Mon Sep 17 00:00:00 2001 From: Jakub Trmota Date: Sun, 10 Dec 2023 00:16:16 +0100 Subject: [PATCH] Composer: switch to phpcsstandards/php_codesniffer - keep squizlabs compatibility --- composer.json | 2 +- phpstan.neon | 15 --------------- src/File.php | 4 ++-- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/composer.json b/composer.json index 39b531b..3e7fb96 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "require": { "nette/neon": "^3.3", "php": "^8.0", - "squizlabs/php_codesniffer": "^3.7" + "phpcsstandards/php_codesniffer": "^3.8" }, "require-dev": { "forrest79/phpcs": "^1.1", diff --git a/phpstan.neon b/phpstan.neon index b3a0088..35e3d67 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -27,16 +27,6 @@ parameters: count: 1 path: src/File.php - - - message: '#^Parameter \$phpcsFile of method Forrest79\\PhpCsIgnores\\BaselineReport\:\:generateFileReport\(\) has invalid type PHP_CodeSniffer\\File\.$#' - count: 1 - path: src/BaselineReport.php - - - # Bad PHPCS annotation - message: "#^Strict comparison using === between bool and 1 will always evaluate to false\\.$#" - count: 1 - path: src/OutdatedFiles.php - - message: "#^Cannot access offset 0 on mixed\\.$#" count: 1 @@ -177,11 +167,6 @@ parameters: count: 1 path: src/PhpCsInjections.php - - # Bad PHPCS annotation - message: "#^Property PHP_CodeSniffer\\\\Config::\\$parallel \\(bool\\) does not accept int\\.$#" - count: 1 - path: src/bootstrap-outdated.php - - message: '#^Cannot access offset .+\.$#' count: 54 diff --git a/src/File.php b/src/File.php index 3ad0d75..b31107b 100644 --- a/src/File.php +++ b/src/File.php @@ -66,7 +66,7 @@ protected function addMessage($error, $message, $line, $column, $code, $data, $s // This condition is for PHPCBF - when error is ignored and fixable, we want to ignore it immediately. // For PHPCS we want to process all errors in a classic way - because than we have complete cache a that we want. if ($this->fixer->enabled) { - // Work out which sniff generated the message. (Copied and simplified from vendor/squizlabs/php_codesniffer/src/Files/File.php:844) + // Work out which sniff generated the message. (Copied and simplified from vendor/phpcsstandards/php_codesniffer/src/Files/File.php:844) $parts = explode('.', $code); if ($parts[0] === 'Internal') { $sniffCode = $code; @@ -78,7 +78,7 @@ protected function addMessage($error, $message, $line, $column, $code, $data, $s } } - // (Copied and simplified from vendor/squizlabs/php_codesniffer/src/Files/File.php:1056) + // (Copied and simplified from vendor/phpcsstandards/php_codesniffer/src/Files/File.php:1056) if ($data !== []) { $message = vsprintf($message, $data); }