Skip to content

fix: update PHPCS to 4.0 and add line length ignore for DefaultConfig#53

Merged
ricardofiorani merged 1 commit intomainfrom
fix/phpcs4-compatibility
Apr 7, 2026
Merged

fix: update PHPCS to 4.0 and add line length ignore for DefaultConfig#53
ricardofiorani merged 1 commit intomainfrom
fix/phpcs4-compatibility

Conversation

@ricardofiorani
Copy link
Copy Markdown
Owner

Summary

  • Update squizlabs/php_codesniffer from ^3.11 to ^4.0
  • Replace @codingStandardsIgnoreFile docblock with inline phpcs:disable comment for Generic.Files.LineLength.TooLong to fix PHPCS 4.0 compatibility

Test plan

  • Run vendor/bin/phpcs --standard=psr2 src/ and verify no errors/warnings

@ricardofiorani ricardofiorani merged commit 7fd23ad into main Apr 7, 2026
9 checks passed
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

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.

Comment thread composer.json
"phpstan/phpstan": "^2.1",
"phpunit/phpunit": "^11.5",
"squizlabs/php_codesniffer": "^3.11"
"squizlabs/php_codesniffer": "^4.0"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

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.

Comment on lines +2 to 3
// phpcs:disable Generic.Files.LineLength.TooLong
declare(strict_types=1);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

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.TooLong
References
  1. 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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant