fix: update PHPCS to 4.0 and add line length ignore for DefaultConfig#53
fix: update PHPCS to 4.0 and add line length ignore for DefaultConfig#53ricardofiorani merged 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the squizlabs/php_codesniffer dependency and replaces a file-level coding standards ignore tag with a specific line-length disable comment in DefaultConfig.php. Feedback indicates that the specified version of php_codesniffer is not available on Packagist, which will cause installation failures, and the placement of the new comment violates PSR-12 by preceding the declare statement.
| "phpstan/phpstan": "^2.1", | ||
| "phpunit/phpunit": "^11.5", | ||
| "squizlabs/php_codesniffer": "^3.11" | ||
| "squizlabs/php_codesniffer": "^4.0" |
There was a problem hiding this comment.
The package squizlabs/php_codesniffer does not currently have a version 4.0 available on Packagist. The latest stable version is 3.11.x. Attempting to require ^4.0 will result in a composer error during installation or update as no matching version will be found. If you intended to use the community-maintained version, please note that it still follows the 3.x series or check if you meant a different package.
| // phpcs:disable Generic.Files.LineLength.TooLong | ||
| declare(strict_types=1); |
There was a problem hiding this comment.
Placing a comment before the declare(strict_types=1); statement violates PSR-12, which expects the declare statement to be the first statement in the file header (after the opening tag and optional file-level docblock). Moving the phpcs:disable comment after the declare statement ensures compliance with the style guide while still achieving the goal of ignoring line length violations for the large JSON string below.
declare(strict_types=1);
// phpcs:disable Generic.Files.LineLength.TooLongReferences
- PSR-12 Section 3: The header of a PHP file MUST consist of: The opening <?php tag. The file-level docblock (optional). One or more declare statements. (link)
Summary
Test plan
vendor/bin/phpcs --standard=psr2 src/and verify no errors/warnings