diff --git a/src/Mutator/Number/DecrementInteger.php b/src/Mutator/Number/DecrementInteger.php index 16c521375..8a2ebdb95 100644 --- a/src/Mutator/Number/DecrementInteger.php +++ b/src/Mutator/Number/DecrementInteger.php @@ -40,6 +40,7 @@ use Infection\Mutator\GetMutatorName; use Infection\Mutator\MutatorCategory; use Infection\PhpParser\Visitor\ParentConnector; +use const PHP_INT_MIN; use PhpParser\Node; /** @@ -97,6 +98,10 @@ public function canMutate(Node $node): bool return false; } + if ($node->value === PHP_INT_MIN) { + return false; + } + if ( $node->value === 1 && ($this->isPartOfComparison($node) || ParentConnector::getParent($node) instanceof Node\Expr\Assign) diff --git a/tests/phpunit/Mutator/Number/DecrementIntegerTest.php b/tests/phpunit/Mutator/Number/DecrementIntegerTest.php index b4b00a079..2f3e1d9f0 100644 --- a/tests/phpunit/Mutator/Number/DecrementIntegerTest.php +++ b/tests/phpunit/Mutator/Number/DecrementIntegerTest.php @@ -504,6 +504,16 @@ public function mutationsProvider(): iterable [ + <<<'PHP' +