From e2eeb952cabef747a761064f2105b23cd473864a Mon Sep 17 00:00:00 2001 From: jrfnl Date: Wed, 14 May 2025 01:35:29 +0200 Subject: [PATCH 1/2] Composer: update to PHPCSDevCS 1.2.0 PHPCSDevCS allows for PHPCS 4.0 and includes PHPCompatibility 10.0.0-alpha1 and a range of sniffs from PHPCSExtra. This also means that we can now scan files without a file extension (if explicitly requested), so the `bin` script can now be scanned. Includes minor documentation update in the ruleset and some small CS fixes. Refs: * https://github.com/PHPCSStandards/PHPCSDevCS/releases/tag/1.2.0 * squizlabs/PHP_CodeSniffer 2916 * PHPCSStandards/PHP_CodeSniffer 1022 --- Tests/IOTestCase.php | 6 +++--- bin/phpcs-check-feature-completeness | 4 ++-- composer.json | 2 +- phpcs.xml.dist | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Tests/IOTestCase.php b/Tests/IOTestCase.php index 6cd2301..6801c2f 100644 --- a/Tests/IOTestCase.php +++ b/Tests/IOTestCase.php @@ -47,9 +47,9 @@ protected function executeCliCommand($command, $workingDir = null) } $descriptorspec = [ - 0 => ['pipe', 'r'], // stdin - 1 => ['pipe', 'w'], // stdout - 2 => ['pipe', 'w'], // stderr + 0 => ['pipe', 'r'], // stdin + 1 => ['pipe', 'w'], // stdout + 2 => ['pipe', 'w'], // stderr ]; $options = null; diff --git a/bin/phpcs-check-feature-completeness b/bin/phpcs-check-feature-completeness index fc0cb22..e4b5c95 100644 --- a/bin/phpcs-check-feature-completeness +++ b/bin/phpcs-check-feature-completeness @@ -31,9 +31,9 @@ * @link https://github.com/PHPCSStandards/PHPCSDevTools */ -if (is_file(__DIR__.'/../autoload.php') === true) { +if (is_file(__DIR__ . '/../autoload.php') === true) { // Installed via Composer. - require_once __DIR__.'/../autoload.php'; + require_once __DIR__ . '/../autoload.php'; } else { // Presume git clone. require_once __DIR__ . '/../Scripts/FileList.php'; diff --git a/composer.json b/composer.json index e204ad3..615da93 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ "phpunit/phpunit" : "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.5.32 || ^11.3.3", "php-parallel-lint/php-parallel-lint": "^1.4.0", "php-parallel-lint/php-console-highlighter": "^1.0.0", - "phpcsstandards/phpcsdevcs": "^1.1.6", + "phpcsstandards/phpcsdevcs": "^1.2.0", "phpcsstandards/phpcsutils" : "^1.0", "yoast/phpunit-polyfills": "^1.1 || ^2.0 || ^3.0" }, diff --git a/phpcs.xml.dist b/phpcs.xml.dist index fefc8d9..dd52719 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -10,6 +10,7 @@ --> . + ./bin/phpcs-check-feature-completeness */vendor/* @@ -33,12 +34,11 @@ --> - + + + + From f23f2876aec4b4ad0cb4b50fa55a87a5bf006d39 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Fri, 31 Oct 2025 23:29:31 +0100 Subject: [PATCH 2/2] GH Actions: run CS check against PHPCS 4.x dev --- .github/workflows/cs.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cs.yml b/.github/workflows/cs.yml index 8749475..4906491 100644 --- a/.github/workflows/cs.yml +++ b/.github/workflows/cs.yml @@ -39,9 +39,8 @@ jobs: run: | # The sniff stage doesn't run the unit tests, so no need for PHPUnit. composer remove --no-update --dev phpunit/phpunit --no-scripts --no-interaction - # Using PHPCS `3.x` as an early detection system for bugs upstream. - # This should be changed to 4.x, but we'll need to wait for PHPCSDevCS to be compatible with 4.x. - composer require --no-update squizlabs/php_codesniffer:"3.x-dev" --no-interaction + # Using PHPCS `4.x` as an early detection system for bugs upstream. + composer require --no-update squizlabs/php_codesniffer:"4.x-dev" --no-interaction # Install dependencies and handle caching in one go. # @link https://github.com/marketplace/actions/install-php-dependencies-with-composer