diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 991d22ed..635d82da 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,6 +8,10 @@ on: branches: - "2.0.x" +concurrency: + group: build-${{ github.head_ref || github.run_id }} # will be canceled on subsequent pushes in pull requests but not branches + cancel-in-progress: true + jobs: lint: name: "Lint" @@ -169,7 +173,7 @@ jobs: php-version: "${{ matrix.php-version }}" ini-file: development extensions: pdo, mysqli, pgsql, pdo_mysql, pdo_pgsql, pdo_sqlite, mongodb - tools: infection:0.31.6 + tools: infection:0.31.7 - name: "Allow installing on PHP 8.4" if: matrix.php-version == '8.4' @@ -178,10 +182,30 @@ jobs: - name: "Install dependencies" run: "composer install --no-interaction --no-progress" - - uses: "actions/download-artifact@v4" + - name: "Checkout build-infection" + uses: actions/checkout@v5 + with: + repository: "phpstan/build-infection" + path: "build-infection" + ref: "1.x" + + - name: "Install build-infection dependencies" + working-directory: "build-infection" + run: "composer install --no-interaction --no-progress" + + - name: "Configure infection" + run: | + php build-infection/bin/infection-config.php \ + > infection.json5 + cat infection.json5 | jq + + - name: "Cache Result cache" + uses: actions/cache@v4 with: - name: "result-cache-${{ matrix.php-version }}" - path: "tmp/" + path: ./tmp + key: "result-cache-v1-${{ matrix.php-version }}-${{ github.run_id }}" + restore-keys: | + result-cache-v1-${{ matrix.php-version }}- - name: "Run infection" run: | @@ -240,9 +264,3 @@ jobs: - name: "PHPStan" run: "make phpstan" - - - uses: "actions/upload-artifact@v4" - with: - # "update-packages" is not relevant for the download-artifact counterpart, but we need it here to get unique artifact names across all jobs - name: "result-cache-${{ matrix.php-version }}${{ matrix.update-packages && '-packages-updated' || '' }}" - path: "tmp/resultCache.php" diff --git a/infection.json5 b/infection.json5 deleted file mode 100644 index 7afd7230..00000000 --- a/infection.json5 +++ /dev/null @@ -1,17 +0,0 @@ -{ - "$schema": "vendor/infection/infection/resources/schema.json", - "timeout": 30, - "source": { - "directories": [ - "src" - ] - }, - "staticAnalysisTool": "phpstan", - "logs": { - "text": "tmp/infection.log" - }, - "mutators": { - "@default": false, - "PHPStan\\Infection\\TrinaryLogicMutator": true - } -} diff --git a/phpstan.neon b/phpstan.neon index 385b9690..b5f35ecc 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -25,7 +25,6 @@ parameters: - tests/*/data-attributes/* - tests/*/data-php-*/* - tests/Rules/Doctrine/ORM/entity-manager.php - - tests/Infection/ reportUnmatchedIgnoredErrors: false diff --git a/tests/Infection/TrinaryLogicMutator.php b/tests/Infection/TrinaryLogicMutator.php deleted file mode 100644 index 67e9b530..00000000 --- a/tests/Infection/TrinaryLogicMutator.php +++ /dev/null @@ -1,69 +0,0 @@ - - */ -final class TrinaryLogicMutator implements Mutator -{ - - public static function getDefinition(): Definition - { - return new Definition( - <<<'TXT' - Replaces TrinaryLogic->yes() with !TrinaryLogic->no() and vice versa. - TXT - , - MutatorCategory::ORTHOGONAL_REPLACEMENT, - null, - <<<'DIFF' - - $type->isBoolean()->yes(); - + !$type->isBoolean()->no(); - DIFF, - ); - } - - public function getName(): string - { - return 'TrinaryLogicMutator'; - } - - public function canMutate(Node $node): bool - { - if (!$node instanceof Node\Expr\MethodCall) { - return false; - } - - if (!$node->name instanceof Node\Identifier) { - return false; - } - - if (!in_array($node->name->name, ['yes', 'no'], true)) { - return false; - } - - return true; - } - - public function mutate(Node $node): iterable - { - if (!$node->name instanceof Node\Identifier) { - throw new LogicException(); - } - - if ($node->name->name === 'yes') { - yield new Node\Expr\BooleanNot(new Node\Expr\MethodCall($node->var, 'no')); - } else { - yield new Node\Expr\BooleanNot(new Node\Expr\MethodCall($node->var, 'yes')); - } - } - -}