Skip to content

Commit

Permalink
Composer: switch to phpcsstandards/php_codesniffer - keep squizlabs c…
Browse files Browse the repository at this point in the history
…ompatibility
  • Loading branch information
forrest79 committed Dec 9, 2023
1 parent 2c07e01 commit eeeffb3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 18 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
15 changes: 0 additions & 15 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down

2 comments on commit eeeffb3

@jrfnl
Copy link

@jrfnl jrfnl commented on eeeffb3 Dec 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your support and your enthousiasm embracing the take-over of the PHP_CodeSniffer package.

In contrast to earlier information, arrangements have been made to allow the package to continue under its original name on Packagist. The commit (in the new repo) to rename the package has been reverted.

I'd recommend reverting the Composer reference changes and keeping the changes which refer to the repo URL on GitHub.

Sorry for the confusion and thank you for understanding. I hope you'll enjoy the 3.8.0 release, which was released this Friday.

@forrest79
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for a notice, I will revert it back :-)

Please sign in to comment.