From 80bc28feb97b5136e7fff1e7ed10ade3eb020d28 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Sat, 10 Aug 2024 14:18:46 +0200 Subject: [PATCH] Fix and add lowest run --- .github/workflows/ci.yml | 15 +++++++++++++-- composer.json | 18 +++++++++--------- src/Psalm/Internal/BCHelper.php | 2 +- .../fixtures/SuicidalAutoloader/autoloader.php | 2 +- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d1103373cb..bc8c51712ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -115,7 +115,7 @@ jobs: echo "chunks=$(php -r 'echo json_encode(range(1, ${{ env.CHUNK_COUNT }} ));')" >> $GITHUB_OUTPUT tests: - name: "Unit Tests - PHP ${{ matrix.php-version }} ${{ matrix.chunk }}/${{ matrix.count }}" + name: "Unit Tests - PHP ${{ matrix.php-version }} ${{ matrix.dependencies }} ${{ matrix.chunk }}/${{ matrix.count }}" runs-on: ubuntu-latest needs: @@ -129,6 +129,9 @@ jobs: - "8.1" - "8.2" - "8.3" + dependencies: + - highest + - lowest count: ${{ fromJson(needs.chunk-matrix.outputs.count) }} chunk: ${{ fromJson(needs.chunk-matrix.outputs.chunks) }} @@ -158,12 +161,20 @@ jobs: echo "files_cache=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT echo "vcs_cache=$(composer config cache-vcs-dir)" >> $GITHUB_OUTPUT - - name: Generate composer.lock + - name: Generate highest composer.lock + if: ${{ matrix.dependencies == 'highest' }} run: | composer update --no-install env: COMPOSER_ROOT_VERSION: dev-master + - name: Generate lowest composer.lock + if: ${{ matrix.dependencies == 'lowest' }} + run: | + composer update --no-install --prefer-lowest + env: + COMPOSER_ROOT_VERSION: dev-master + - name: Cache composer cache uses: actions/cache@v4 with: diff --git a/composer.json b/composer.json index 4a3507f2d4a..3757b49113f 100644 --- a/composer.json +++ b/composer.json @@ -48,17 +48,17 @@ "require-dev": { "ext-curl": "*", "amphp/phpunit-util": "^2.0", - "bamarni/composer-bin-plugin": "^1.4", - "brianium/paratest": "^6.9", - "mockery/mockery": "^1.5", - "nunomaduro/mock-final-classes": "^1.1", - "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/phpdoc-parser": "^1.6", - "phpunit/phpunit": "^9.6", + "bamarni/composer-bin-plugin": "^1.8", + "brianium/paratest": "^6.11", + "mockery/mockery": "^1.6", + "nunomaduro/mock-final-classes": "^1.2", + "php-parallel-lint/php-parallel-lint": "^1.4", + "phpstan/phpdoc-parser": "^1.29", + "phpunit/phpunit": "^9.6.20", "psalm/plugin-mockery": "^1.1", "psalm/plugin-phpunit": "^0.18", - "slevomat/coding-standard": "^8.4", - "squizlabs/php_codesniffer": "^3.6", + "slevomat/coding-standard": "^8.15", + "squizlabs/php_codesniffer": "^3.10", "symfony/process": "^4.4 || ^5.0 || ^6.0 || ^7.0" }, "suggest": { diff --git a/src/Psalm/Internal/BCHelper.php b/src/Psalm/Internal/BCHelper.php index 51332ef8408..316148d96e4 100644 --- a/src/Psalm/Internal/BCHelper.php +++ b/src/Psalm/Internal/BCHelper.php @@ -38,7 +38,7 @@ public static function getPHPParserClassName(string $className): string public static function usePHPParserV4(): bool { - return class_exists('\PhpParser\Node\Stmt\Throw'); + return class_exists('\PhpParser\Node\Stmt\Throw_'); } public static function isThrow(Node $stmt): bool diff --git a/tests/fixtures/SuicidalAutoloader/autoloader.php b/tests/fixtures/SuicidalAutoloader/autoloader.php index d31e8da0747..d34cd51831b 100644 --- a/tests/fixtures/SuicidalAutoloader/autoloader.php +++ b/tests/fixtures/SuicidalAutoloader/autoloader.php @@ -18,7 +18,7 @@ 'PHPUnit\Framework\DOMElement', 'Stringable', 'AllowDynamicProperties', - 'PhpParser\Node\Stmt\Throw', // BCHelper for nikic/php-parser v4/5 + 'PhpParser\Node\Stmt\Throw_', // BCHelper for nikic/php-parser v4/5 // https://github.com/symfony/symfony/pull/40203 // these are actually functions, referenced as `if (!function_exists(u::class))`