diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 991d22ed..4a31e0e5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -178,6 +178,17 @@ jobs: - name: "Install dependencies" run: "composer install --no-interaction --no-progress" + - 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" + - uses: "actions/download-artifact@v4" with: name: "result-cache-${{ matrix.php-version }}" diff --git a/infection.json5 b/infection.json5 index 7afd7230..f6a55ac1 100644 --- a/infection.json5 +++ b/infection.json5 @@ -10,6 +10,7 @@ "logs": { "text": "tmp/infection.log" }, + "bootstrap": "build-infection/vendor/autoload.php", "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')); - } - } - -}