From dec70b88df67e75e6db15ad978224aee4e53ae5f Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 6 Nov 2023 22:12:52 +0100 Subject: [PATCH 1/4] Switch to PHPCSStandards/PHP_CodeSniffer The Squizlabs repo has been abandoned. The project continues in a fork in the PHPCSStandards organisation. Ref: * squizlabs/PHP_CodeSniffer 3932 --- CHANGELOG.md | 2 +- Modernize/ruleset.xml | 2 +- NormalizedArrays/ruleset.xml | 2 +- README.md | 4 ++-- Universal/ruleset.xml | 2 +- phpcs.xml.dist | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a619724..0341ff49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -550,7 +550,7 @@ This initial alpha release contains the following sniffs: Individual sub-types can be allowed by excluding specific error codes. [Composer PHPCS plugin]: https://github.com/PHPCSStandards/composer-installer -[php_version-config]: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Configuration-Options#setting-the-php-version +[php_version-config]: https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Configuration-Options#setting-the-php-version [Unreleased]: https://github.com/PHPCSStandards/PHPCSExtra/compare/stable...HEAD [1.2.0]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.1.2...1.2.0 diff --git a/Modernize/ruleset.xml b/Modernize/ruleset.xml index 57e341ba..c30d745d 100644 --- a/Modernize/ruleset.xml +++ b/Modernize/ruleset.xml @@ -1,5 +1,5 @@ - + A collection of sniffs to detect code modernization opportunities. diff --git a/NormalizedArrays/ruleset.xml b/NormalizedArrays/ruleset.xml index ce35adb5..69c54a8e 100644 --- a/NormalizedArrays/ruleset.xml +++ b/NormalizedArrays/ruleset.xml @@ -1,5 +1,5 @@ - + A ruleset for PHP_CodeSniffer to check arrays for normalized format. diff --git a/README.md b/README.md index 9e70026a..726d354e 100644 --- a/README.md +++ b/README.md @@ -566,8 +566,8 @@ This code is released under the [GNU Lesser General Public License (LGPLv3)](LIC [gha-qa-results]: https://github.com/PHPCSStandards/PHPCSExtra/actions/workflows/basics.yml [gha-test-results]: https://github.com/PHPCSStandards/PHPCSExtra/actions/workflows/test.yml -[phpcs-gh]: https://github.com/squizlabs/PHP_CodeSniffer +[phpcs-gh]: https://github.com/PHPCSStandards/PHP_CodeSniffer [phpcsutils-gh]: https://github.com/PHPCSStandards/PHPCSUtils [composer-installer-gh]: https://github.com/PHPCSStandards/composer-installer -[php_version-config]: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Configuration-Options#setting-the-php-version +[php_version-config]: https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Configuration-Options#setting-the-php-version diff --git a/Universal/ruleset.xml b/Universal/ruleset.xml index 33067f2b..6c591eb7 100644 --- a/Universal/ruleset.xml +++ b/Universal/ruleset.xml @@ -1,5 +1,5 @@ - + A collection of universal sniffs. This standard is not designed to be used to check code. Include individual sniffs from this standard in a custom ruleset instead. diff --git a/phpcs.xml.dist b/phpcs.xml.dist index fd117cfe..86ffb0cb 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -5,7 +5,7 @@ From 4ef758126e5afb7d43781a5996977fd2280a6b2f Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 13 Nov 2023 23:47:44 +0100 Subject: [PATCH 2/4] Composer: raise the minimum supported PHPCS + PHPCSUtils versions PHPCSUtils 1.0.9 has been released and raises the minimum supported PHPCS version to 3.8.0 for improved PHP 8.2 support. Ref: * https://github.com/PHPCSStandards/PHPCSUtils/releases/tag/1.0.9 * https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/tag/3.8.0 --- README.md | 4 ++-- composer.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 726d354e..a82fa893 100644 --- a/README.md +++ b/README.md @@ -46,8 +46,8 @@ Minimum Requirements ------------------------------------------- * PHP 5.4 or higher. -* [PHP_CodeSniffer][phpcs-gh] version **3.7.1** or higher. -* [PHPCSUtils][phpcsutils-gh] version **1.0.8** or higher. +* [PHP_CodeSniffer][phpcs-gh] version **3.8.0** or higher. +* [PHPCSUtils][phpcsutils-gh] version **1.0.9** or higher. Installation diff --git a/composer.json b/composer.json index b59f2d8e..909fb189 100644 --- a/composer.json +++ b/composer.json @@ -22,8 +22,8 @@ }, "require" : { "php" : ">=5.4", - "squizlabs/php_codesniffer" : "^3.7.1", - "phpcsstandards/phpcsutils" : "^1.0.8" + "squizlabs/php_codesniffer" : "^3.8.0", + "phpcsstandards/phpcsutils" : "^1.0.9" }, "require-dev" : { "php-parallel-lint/php-parallel-lint": "^1.3.2", From deaad9affe60446252ab34084b3586872365bab4 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Fri, 8 Dec 2023 17:16:09 +0100 Subject: [PATCH 3/4] Tests: allow for PHPUnit 8/9 PHP_CodeSniffer 3.8.0 now allows for running the tests, which are based on the PHPCS native test suite, with PHPUnit 8 and 9. This commit updates the package to take advantage of that. Includes: * Widening the PHPUnit version requirements. * Simplifications to the `quicktest` and `test` workflows. Also, the code coverage "high" run can now be run against PHP 8.3. * Running PHPStan against PHP `latest` (couldn't previously be done due to the old PHPUnit version). Not included as this was already handled in this repo: * Adding the PHPUnit cache file to `.gitignore`. * Adding various PHPUnit config attributes to ensure deprecation notices and such still show on PHPUnit 9. Ref: * PHPCSStandards/PHP_CodeSniffer 59 --- .github/workflows/basics.yml | 4 +--- .github/workflows/quicktest.yml | 18 ++---------------- .github/workflows/test.yml | 23 ++++------------------- composer.json | 2 +- 4 files changed, 8 insertions(+), 39 deletions(-) diff --git a/.github/workflows/basics.yml b/.github/workflows/basics.yml index 86acc3a9..265d7720 100644 --- a/.github/workflows/basics.yml +++ b/.github/workflows/basics.yml @@ -42,8 +42,6 @@ jobs: - name: 'Composer: adjust dependencies' 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 `master` as an early detection system for bugs upstream. composer require --no-update squizlabs/php_codesniffer:"dev-master" --no-interaction @@ -107,7 +105,7 @@ jobs: - name: Install PHP uses: shivammathur/setup-php@v2 with: - php-version: '7.4' + php-version: 'latest' coverage: none tools: phpstan diff --git a/.github/workflows/quicktest.yml b/.github/workflows/quicktest.yml index 1711cd4e..e914cd17 100644 --- a/.github/workflows/quicktest.yml +++ b/.github/workflows/quicktest.yml @@ -61,21 +61,12 @@ jobs: # Install dependencies and handle caching in one go. # @link https://github.com/marketplace/actions/install-php-dependencies-with-composer - - name: Install Composer dependencies - normal - if: matrix.php != 'latest' + - name: Install Composer dependencies uses: "ramsey/composer-install@v2" with: # Bust the cache at least once a month - output format: YYYY-MM. custom-cache-suffix: $(date -u "+%Y-%m") - # For PHP "latest", we need to install with ignore platform reqs as not all PHPUnit 7.x dependencies allow it. - - name: Install Composer dependencies - with ignore platform - if: matrix.php == 'latest' - uses: "ramsey/composer-install@v2" - with: - composer-options: --ignore-platform-req=php+ - custom-cache-suffix: $(date -u "+%Y-%m") - - name: "Composer: set PHPCS/PHPCSUtils version for tests (lowest)" if: ${{ matrix.phpcs_version == 'lowest' }} run: > @@ -86,10 +77,5 @@ jobs: if: matrix.phpcs_version == 'dev-master' run: composer lint - - name: Run the unit tests - PHP 5.4 - 8.0 - if: matrix.php != 'latest' + - name: Run the unit tests run: composer test - - - name: Run the unit tests - PHP > 8.1 - if: matrix.php == 'latest' - run: composer test -- --no-configuration --bootstrap=phpunit-bootstrap.php --dont-report-useless-tests diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2ed8aaf2..3075e039 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,7 +32,7 @@ jobs: # @link https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix # # The matrix is set up so as not to duplicate the builds which are run for code coverage. - php: ['5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '8.0', '8.1', '8.2', '8.3', '8.4'] + php: ['5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.4'] phpcs_version: ['lowest', 'dev-master'] name: "Test${{ matrix.phpcs_version == 'dev-master' && ' + Lint' || '' }}: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}" @@ -67,21 +67,12 @@ jobs: # Install dependencies and handle caching in one go. # @link https://github.com/marketplace/actions/install-php-dependencies-with-composer - - name: Install Composer dependencies - normal - if: ${{ startsWith( matrix.php, '8' ) == false }} + - name: Install Composer dependencies uses: "ramsey/composer-install@v2" with: # Bust the cache at least once a month - output format: YYYY-MM. custom-cache-suffix: $(date -u "+%Y-%m") - # For the PHP 8/"nightly", we need to install with ignore platform reqs as we're still using PHPUnit 7. - - name: Install Composer dependencies - with ignore platform - if: ${{ startsWith( matrix.php, '8' ) }} - uses: "ramsey/composer-install@v2" - with: - composer-options: --ignore-platform-req=php+ - custom-cache-suffix: $(date -u "+%Y-%m") - - name: "Composer: set PHPCS/PHPCSUtils version for tests (lowest)" if: ${{ matrix.phpcs_version == 'lowest' }} run: > @@ -92,14 +83,9 @@ jobs: if: matrix.phpcs_version == 'dev-master' run: composer lint - - name: Run the unit tests - PHP 5.4 - 8.0 - if: ${{ matrix.php < '8.1' }} + - name: Run the unit tests run: composer test - - name: Run the unit tests - PHP > 8.1 - if: ${{ matrix.php >= '8.1' }} - run: composer test -- --no-configuration --bootstrap=phpunit-bootstrap.php --dont-report-useless-tests - #### CODE COVERAGE STAGE #### # N.B.: Coverage is only checked on the lowest and highest stable PHP versions # and a low/high of each major for PHPCS. @@ -114,8 +100,7 @@ jobs: strategy: matrix: - # 7.4 should be updated to 8.2 when higher PHPUnit versions can be supported. - php: ['5.4', '7.4'] + php: ['5.4', '8.3'] phpcs_version: ['lowest', 'dev-master'] name: "Coverage${{ matrix.phpcs_version == 'dev-master' && ' + Lint' || '' }}: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}" diff --git a/composer.json b/composer.json index 909fb189..92122571 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,7 @@ "php-parallel-lint/php-console-highlighter": "^1.0", "phpcsstandards/phpcsdevcs": "^1.1.6", "phpcsstandards/phpcsdevtools": "^1.2.1", - "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" }, "extra": { "branch-alias": { From 455d6dadeac1e45f9624c253276f0edda28cd3c0 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 13 Nov 2023 23:51:30 +0100 Subject: [PATCH 4/4] Changelog for the release of version 1.2.1 --- CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0341ff49..3ee3258b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,20 @@ This projects adheres to [Keep a CHANGELOG](http://keepachangelog.com/) and uses _Nothing yet._ +## [1.2.1] - 2023-12-08 + +### Changed + +#### Other + +* Composer: The minimum `PHP_CodeSniffer` requirement has been updated to `^3.8.0` (was `^3.7.2`). [#298] +* Composer: The minimum `PHPCSUtils` requirement has been updated to `^1.0.9` (was `^1.0.8`). [#298] + +Please ensure you run `composer update phpcsstandards/phpcsextra --with-dependencies` to benefit from this. + +[#298]: https://github.com/PHPCSStandards/PHPCSExtra/pull/298 + + ## [1.2.0] - 2023-12-02 ### Added @@ -553,6 +567,7 @@ This initial alpha release contains the following sniffs: [php_version-config]: https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Configuration-Options#setting-the-php-version [Unreleased]: https://github.com/PHPCSStandards/PHPCSExtra/compare/stable...HEAD +[1.2.1]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.2.0...1.2.1 [1.2.0]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.1.2...1.2.0 [1.1.2]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.1.1...1.1.2 [1.1.1]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.1.0...1.1.1