From 0850175999e7d1b6a11502f8a88225b04ed3743f Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 11 Jul 2024 11:46:33 +0200 Subject: [PATCH] Get rid of phpunit bridge --- .gitattributes | 1 - .github/workflows/continuous-integration.yml | 44 +------------------- .github/workflows/phpstan.yml | 3 -- composer.json | 4 +- phpstan.neon.dist | 2 +- phpunit-phpstan.xml.dist | 20 --------- phpunit.xml.dist | 3 +- tests/phpstan-locate-phpunit-autoloader.php | 22 ---------- 8 files changed, 5 insertions(+), 94 deletions(-) delete mode 100644 phpunit-phpstan.xml.dist delete mode 100644 tests/phpstan-locate-phpunit-autoloader.php diff --git a/.gitattributes b/.gitattributes index b525bdb..49067b5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -14,6 +14,5 @@ /phpstan.neon.dist export-ignore /phpstan-baseline.neon export-ignore /phpunit.xml.dist export-ignore -/phpunit-phpstan.xml.dist export-ignore /tests export-ignore /CONTRIBUTING.md export-ignore diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 6ba1fca..b2c8900 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -51,46 +51,4 @@ jobs: composer update ${{ env.COMPOSER_FLAGS }} - name: "Run tests" - run: "vendor/bin/simple-phpunit --verbose" - - phpstan_tests: - name: "CI PHPStan Ext" - - runs-on: ubuntu-latest - - strategy: - matrix: - php-version: - - "7.3" - - "8.3" - - steps: - - name: "Checkout" - uses: "actions/checkout@v2" - - - name: "Install PHP" - uses: "shivammathur/setup-php@v2" - with: - coverage: "none" - php-version: "${{ matrix.php-version }}" - - - name: Get composer cache directory - id: composercache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Cache dependencies - uses: actions/cache@v2 - with: - path: ${{ steps.composercache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-composer- - - - name: "Install latest dependencies" - run: | - # Require PHPUnit directly bypassing the symfony bridge - composer remove symfony/phpunit-bridge --dev --no-update - composer require phpunit/phpunit:^9 --dev --no-update - composer update ${{ env.COMPOSER_FLAGS }} - - - name: "Run tests" - run: vendor/bin/phpunit -c phpunit-phpstan.xml.dist + run: "vendor/bin/phpunit" diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 93bea17..f135b11 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -44,8 +44,5 @@ jobs: - name: "Install latest dependencies" run: "composer update ${{ env.COMPOSER_FLAGS }}" - - name: "Initialize PHPUnit sources" - run: "vendor/bin/simple-phpunit --filter NO_TEST_JUST_AUTOLOAD_THANKS" - - name: "Run PHPStan" run: "composer phpstan" diff --git a/composer.json b/composer.json index 9531696..ec707cc 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "php": "^7.2 || ^8.0" }, "require-dev": { - "symfony/phpunit-bridge": "^7", + "phpunit/phpunit": "^8 || ^9", "phpstan/phpstan": "^1.11.6", "phpstan/phpstan-strict-rules": "^1.1" }, @@ -43,7 +43,7 @@ } }, "scripts": { - "test": "SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1 vendor/bin/simple-phpunit", + "test": "vendor/bin/phpunit", "phpstan": "phpstan analyse" } } diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 900cf2d..890f3bc 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -8,7 +8,7 @@ parameters: treatPhpDocTypesAsCertain: false bootstrapFiles: - - tests/phpstan-locate-phpunit-autoloader.php + - vendor/autoload.php excludePaths: - tests/PHPStanTests/nsrt/* diff --git a/phpunit-phpstan.xml.dist b/phpunit-phpstan.xml.dist deleted file mode 100644 index 1ab1ead..0000000 --- a/phpunit-phpstan.xml.dist +++ /dev/null @@ -1,20 +0,0 @@ - - - - - tests/PHPStanTests - - - - - - src - - - diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 4b57ef9..4a7697f 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -8,8 +8,7 @@ > - tests/PregTests - tests/RegexTests + tests diff --git a/tests/phpstan-locate-phpunit-autoloader.php b/tests/phpstan-locate-phpunit-autoloader.php deleted file mode 100644 index a9e670c..0000000 --- a/tests/phpstan-locate-phpunit-autoloader.php +++ /dev/null @@ -1,22 +0,0 @@ -= 80000 && false !== strpos((string) $dir, 'phpunit-9')) { - break; - } - if (PHP_VERSION_ID < 80000 && false !== strpos((string) $dir, 'phpunit-8')) { - break; - } -} - -if (null === $bestDirFound) { - echo 'Run "composer test" to initialize PHPUnit sources before running PHPStan'.PHP_EOL; - exit(1); -} - -include $bestDirFound.'/vendor/autoload.php';