From 495ee37a7cde57207372c96de3fb6697ee4dc225 Mon Sep 17 00:00:00 2001 From: Reedy Date: Mon, 22 Aug 2022 19:48:02 +0100 Subject: [PATCH 1/9] Drop support for PHP 7.2 and 7.3 https://github.com/wikimedia/composer-merge-plugin/issues/241 --- .github/workflows/CI.yaml | 12 +++--------- composer.json | 6 +++--- tests/phpunit/LoggerTest.php | 2 ++ tests/phpunit/MergePluginTest.php | 2 ++ tests/phpunit/PluginStateTest.php | 2 ++ tests/phpunit/StabilityFlagsTest.php | 2 ++ 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 5632288..dd65b9f 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -10,12 +10,6 @@ jobs: fail-fast: false matrix: include: - # Includes php7.1-8.0, composer 2, php-xdebug, and more - # https://github.com/actions/virtual-environments/blob/ubuntu18/20210318.0/images/linux/Ubuntu1804-README.md#php - - os: ubuntu-18.04 - php: "7.2" - - os: ubuntu-18.04 - php: "7.3" # Includes php7.4-8.x, composer 2, php-xdebug, and more # https://github.com/actions/virtual-environments/blob/ubuntu20/20210318.0/images/linux/Ubuntu2004-README.md#php - os: ubuntu-20.04 @@ -64,7 +58,7 @@ jobs: - run: composer phan ocular-push: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 if: ${{ success() }} && github.repository == 'wikimedia/composer-merge-plugin' needs: [run] @@ -72,8 +66,8 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Use PHP 7.2 - run: sudo update-alternatives --set php /usr/bin/php7.2 + - name: Use PHP 7.4 + run: sudo update-alternatives --set php /usr/bin/php7.4 - name: Install dependencies run: composer install --prefer-dist --no-progress diff --git a/composer.json b/composer.json index 4c93135..17416a0 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "minimum-stability": "dev", "prefer-stable": true, "require": { - "php": ">=7.2.0", + "php": ">=7.4.0", "composer-plugin-api": "^1.1||^2.0" }, "require-dev": { @@ -20,8 +20,8 @@ "composer/composer": "^1.1||^2.0", "mediawiki/mediawiki-phan-config": "0.11.1", "php-parallel-lint/php-parallel-lint": "~1.3.1", - "phpspec/prophecy": "~1.15.0", - "phpunit/phpunit": "^8.5||^9.0", + "phpspec/prophecy-phpunit": "~2.0.1", + "phpunit/phpunit": "^9.5", "squizlabs/php_codesniffer": "~3.7.1" }, "autoload": { diff --git a/tests/phpunit/LoggerTest.php b/tests/phpunit/LoggerTest.php index 4808319..85fc374 100644 --- a/tests/phpunit/LoggerTest.php +++ b/tests/phpunit/LoggerTest.php @@ -13,12 +13,14 @@ use Composer\IO\IOInterface; use Prophecy\Argument; use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; /** * @covers \Wikimedia\Composer\Merge\V2\Logger */ class LoggerTest extends TestCase { + use ProphecyTrait; public function testVeryVerboseDebug() { diff --git a/tests/phpunit/MergePluginTest.php b/tests/phpunit/MergePluginTest.php index 8fff0ea..ff1375a 100644 --- a/tests/phpunit/MergePluginTest.php +++ b/tests/phpunit/MergePluginTest.php @@ -34,6 +34,7 @@ use Composer\Util\HttpDownloader; use Prophecy\Argument; use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; use ReflectionClass; use ReflectionProperty; @@ -48,6 +49,7 @@ */ class MergePluginTest extends TestCase { + use ProphecyTrait; /** * @var Composer diff --git a/tests/phpunit/PluginStateTest.php b/tests/phpunit/PluginStateTest.php index 131672c..956de33 100644 --- a/tests/phpunit/PluginStateTest.php +++ b/tests/phpunit/PluginStateTest.php @@ -12,12 +12,14 @@ use Composer\Composer; use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; /** * @covers \Wikimedia\Composer\Merge\V2\PluginState */ class PluginStateTest extends TestCase { + use ProphecyTrait; public function testLocked() { diff --git a/tests/phpunit/StabilityFlagsTest.php b/tests/phpunit/StabilityFlagsTest.php index 89c0c91..64a9dc0 100644 --- a/tests/phpunit/StabilityFlagsTest.php +++ b/tests/phpunit/StabilityFlagsTest.php @@ -13,12 +13,14 @@ use Composer\Package\BasePackage; use Composer\Package\Link; use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; /** * @covers \Wikimedia\Composer\Merge\V2\StabilityFlags */ class StabilityFlagsTest extends TestCase { + use ProphecyTrait; /** * @dataProvider provideExplicitStability From 0a1e2bfbd282b26f4367f0efd7387bfabc2cabb4 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Fri, 23 Dec 2022 12:25:38 +0000 Subject: [PATCH 2/9] CI.yaml: Test on PHP 8.2 --- .github/workflows/CI.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index dd65b9f..5279146 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -18,6 +18,8 @@ jobs: php: "8.0" - os: ubuntu-20.04 php: "8.1" + - os: ubuntu-20.04 + php: "8.2" name: Test PHP ${{ matrix.php }} runs-on: ${{ matrix.os }} From a4c4c62faebb112564be086ff6213f6033435fe6 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Fri, 23 Dec 2022 12:57:25 +0000 Subject: [PATCH 3/9] .phan/config.php: Tabs to spaces --- .phan/config.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.phan/config.php b/.phan/config.php index d3034ee..c80a682 100644 --- a/.phan/config.php +++ b/.phan/config.php @@ -3,20 +3,20 @@ $cfg = require __DIR__ . '/../vendor/mediawiki/mediawiki-phan-config/src/config.php'; $cfg['directory_list'] = array_merge( - $cfg['directory_list'], - [ - 'vendor/composer/composer/src/Composer/', - 'vendor/composer/semver/src/', + $cfg['directory_list'], + [ + 'vendor/composer/composer/src/Composer/', + 'vendor/composer/semver/src/', - ] + ] ); $cfg['exclude_analysis_directory_list'] = array_merge( - $cfg['exclude_analysis_directory_list'], - [ - 'vendor/composer/composer/src/Composer/', - 'vendor/composer/semver/src/', - ] + $cfg['exclude_analysis_directory_list'], + [ + 'vendor/composer/composer/src/Composer/', + 'vendor/composer/semver/src/', + ] ); return $cfg; From d6ad685896af3cc13425c7d60aec7b77a8bee310 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sat, 15 Apr 2023 19:20:25 +0100 Subject: [PATCH 4/9] MergePluginTest.php: Skip known broken test Ping https://github.com/wikimedia/composer-merge-plugin/issues/240 --- tests/phpunit/MergePluginTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/phpunit/MergePluginTest.php b/tests/phpunit/MergePluginTest.php index ff1375a..1eb4d5f 100644 --- a/tests/phpunit/MergePluginTest.php +++ b/tests/phpunit/MergePluginTest.php @@ -1248,6 +1248,7 @@ public function provideOnPostPackageInstall() */ public function testHasBranchAlias($fireInit) { + $this->markTestSkipped('https://github.com/wikimedia/composer-merge-plugin/issues/240'); $io = $this->io; $dir = $this->fixtureDir(__FUNCTION__); From 8bde29b71a8cfba4e4596c5f9a570c3a5ffe9e78 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sat, 15 Apr 2023 19:24:58 +0100 Subject: [PATCH 5/9] composer.json: allow-polyfill-parser in phan --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 17416a0..8f09aa5 100644 --- a/composer.json +++ b/composer.json @@ -44,7 +44,7 @@ "phpunit --log-junit=reports/unitreport.xml --coverage-text --coverage-html=reports/coverage --coverage-clover=reports/coverage.xml", "phpcs --encoding=utf-8 --standard=PSR2 --report-checkstyle=reports/checkstyle-phpcs.xml --report-full --extensions=php src/* tests/phpunit/*" ], - "phan": "phan -d . --long-progress-bar", + "phan": "phan -d . --long-progress-bar --allow-polyfill-parser", "phpcs": "phpcs --encoding=utf-8 --standard=PSR2 --extensions=php src/* tests/phpunit/*", "phpunit": "phpunit", "test": [ From c7765fb09b9650bf5336d5a853bafaa03fc16b8f Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sat, 15 Apr 2023 19:26:32 +0100 Subject: [PATCH 6/9] composer.json: Update mediawki/mediawiki-phan-config --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8f09aa5..eded2d2 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "require-dev": { "ext-json": "*", "composer/composer": "^1.1||^2.0", - "mediawiki/mediawiki-phan-config": "0.11.1", + "mediawiki/mediawiki-phan-config": "0.12.0", "php-parallel-lint/php-parallel-lint": "~1.3.1", "phpspec/prophecy-phpunit": "~2.0.1", "phpunit/phpunit": "^9.5", From f8d908a5be7258fa7b1b543ace663b660c6e1c84 Mon Sep 17 00:00:00 2001 From: Reedy Date: Sat, 15 Apr 2023 19:29:47 +0100 Subject: [PATCH 7/9] Revert "composer.json: Update mediawki/mediawiki-phan-config" This reverts commit c7765fb09b9650bf5336d5a853bafaa03fc16b8f. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index eded2d2..8f09aa5 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "require-dev": { "ext-json": "*", "composer/composer": "^1.1||^2.0", - "mediawiki/mediawiki-phan-config": "0.12.0", + "mediawiki/mediawiki-phan-config": "0.11.1", "php-parallel-lint/php-parallel-lint": "~1.3.1", "phpspec/prophecy-phpunit": "~2.0.1", "phpunit/phpunit": "^9.5", From c039cbd20c16925eec86a8eb942da27960194196 Mon Sep 17 00:00:00 2001 From: Reedy Date: Sat, 15 Apr 2023 19:31:06 +0100 Subject: [PATCH 8/9] CI.yaml: Don't run phan on PHP 8.2 --- .github/workflows/CI.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 5279146..47da365 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -57,7 +57,11 @@ jobs: run: composer update --no-interaction --no-progress --ansi - run: composer test - - run: composer phan + + - name: composer phan + # Phan fails on PHP 8.2 due to warnings; waiting on upstream releases to fix + if: ${{ matrix.php < 8.2 }} + run: composer phan ocular-push: runs-on: ubuntu-20.04 From ab7cf5e140e23ce603872780ab8b570cfaf9c1f9 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sat, 15 Apr 2023 19:48:11 +0100 Subject: [PATCH 9/9] README.md: Fix name of PHP_CodeSniffer --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 771b3dc..d3274a7 100644 --- a/README.md +++ b/README.md @@ -219,7 +219,7 @@ project]. We accept code and documentation contributions via Pull Requests on GitHub as well. - [PSR-2 Coding Standard][] is used by the project. The included test - configuration uses [PHP Code Sniffer][] to validate the conventions. + configuration uses [PHP_CodeSniffer][] to validate the conventions. - Tests are encouraged. Our test coverage isn't perfect but we'd like it to get better rather than worse, so please try to include tests with your changes. @@ -243,7 +243,7 @@ Composer Merge plugin is licensed under the MIT license. See the [MediaWiki]: https://www.mediawiki.org/wiki/MediaWiki [GitHub project]: https://github.com/wikimedia/composer-merge-plugin [PSR-2 Coding Standard]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md -[PHP Code Sniffer]: http://pear.php.net/package/PHP_CodeSniffer +[PHP_CodeSniffer]: http://pear.php.net/package/PHP_CodeSniffer [Latest Stable Version]: https://img.shields.io/packagist/v/wikimedia/composer-merge-plugin.svg?style=flat [License]: https://img.shields.io/packagist/l/wikimedia/composer-merge-plugin.svg?style=flat [Build Status]: https://github.com/wikimedia/composer-merge-plugin/actions/workflows/CI.yaml/badge.svg