Skip to content

Trying to remove false positive on logical or. #860

Trying to remove false positive on logical or.

Trying to remove false positive on logical or. #860

Triggered via pull request April 2, 2023 10:55
Status Success
Total duration 5m 29s
Artifacts

mt-annotations.yaml

on: pull_request
Matrix: tests
Annotations Status
2s
Annotations Status
Fit to window
Zoom out
Zoom in

Annotations

10 warnings
Mutation Testing Code Review Annotations 8.0: src/Mutator/Boolean/LogicalOr.php#L92
Escaped Mutant for Mutator "LogicalOr": --- Original +++ New @@ @@ } $nodeLeft = $node->left; $nodeRight = $node->right; - if (!property_exists($nodeLeft, 'left') || !property_exists($nodeLeft, 'right') || !property_exists($nodeRight, 'left') || !property_exists($nodeRight, 'right')) { + if (!property_exists($nodeLeft, 'left') && !property_exists($nodeLeft, 'right') || !property_exists($nodeRight, 'left') || !property_exists($nodeRight, 'right')) { return true; } $nodeLeftLeft = $nodeLeft->left;
Mutation Testing Code Review Annotations 8.0: src/Mutator/Boolean/LogicalOr.php#L92
Escaped Mutant for Mutator "LogicalOr": --- Original +++ New @@ @@ } $nodeLeft = $node->left; $nodeRight = $node->right; - if (!property_exists($nodeLeft, 'left') || !property_exists($nodeLeft, 'right') || !property_exists($nodeRight, 'left') || !property_exists($nodeRight, 'right')) { + if ((!property_exists($nodeLeft, 'left') || !property_exists($nodeLeft, 'right')) && !property_exists($nodeRight, 'left') || !property_exists($nodeRight, 'right')) { return true; } $nodeLeftLeft = $nodeLeft->left;
Mutation Testing Code Review Annotations 8.0: src/Mutator/Boolean/LogicalOr.php#L92
Escaped Mutant for Mutator "LogicalOr": --- Original +++ New @@ @@ } $nodeLeft = $node->left; $nodeRight = $node->right; - if (!property_exists($nodeLeft, 'left') || !property_exists($nodeLeft, 'right') || !property_exists($nodeRight, 'left') || !property_exists($nodeRight, 'right')) { + if ((!property_exists($nodeLeft, 'left') || !property_exists($nodeLeft, 'right') || !property_exists($nodeRight, 'left')) && !property_exists($nodeRight, 'right')) { return true; } $nodeLeftLeft = $nodeLeft->left;
Mutation Testing Code Review Annotations 8.0: src/Mutator/Boolean/LogicalOr.php#L148
Escaped Mutant for Mutator "LogicalAnd": --- Original +++ New @@ @@ } $greaterOp = [Node\Expr\BinaryOp\Greater::class, Node\Expr\BinaryOp\GreaterOrEqual::class]; $smallerOp = [Node\Expr\BinaryOp\Smaller::class, Node\Expr\BinaryOp\SmallerOrEqual::class]; - if (in_array($classNodeLeft, $greaterOp, true) && in_array($classNodeRight, $smallerOp, true) || in_array($classNodeLeft, $smallerOp, true) && in_array($classNodeRight, $greaterOp, true)) { + if (in_array($classNodeLeft, $greaterOp, true) || in_array($classNodeRight, $smallerOp, true) || in_array($classNodeLeft, $smallerOp, true) && in_array($classNodeRight, $greaterOp, true)) { $varNameLeft = null; $valueLeft = null; $numberScalar = [Node\Scalar\LNumber::class, Node\Scalar\DNumber::class];
Mutation Testing Code Review Annotations 8.0: src/Mutator/Boolean/LogicalOr.php#L151
Escaped Mutant for Mutator "LogicalAnd": --- Original +++ New @@ @@ } $greaterOp = [Node\Expr\BinaryOp\Greater::class, Node\Expr\BinaryOp\GreaterOrEqual::class]; $smallerOp = [Node\Expr\BinaryOp\Smaller::class, Node\Expr\BinaryOp\SmallerOrEqual::class]; - if (in_array($classNodeLeft, $greaterOp, true) && in_array($classNodeRight, $smallerOp, true) || in_array($classNodeLeft, $smallerOp, true) && in_array($classNodeRight, $greaterOp, true)) { + if (in_array($classNodeLeft, $greaterOp, true) && in_array($classNodeRight, $smallerOp, true) || (in_array($classNodeLeft, $smallerOp, true) || in_array($classNodeRight, $greaterOp, true))) { $varNameLeft = null; $valueLeft = null; $numberScalar = [Node\Scalar\LNumber::class, Node\Scalar\DNumber::class];
Mutation Testing Code Review Annotations 8.0: src/Mutator/Boolean/LogicalOr.php#L163
Escaped Mutant for Mutator "InstanceOf_": --- Original +++ New @@ @@ $varNameLeft = null; $valueLeft = null; $numberScalar = [Node\Scalar\LNumber::class, Node\Scalar\DNumber::class]; - if ($nodeLeftLeft instanceof Node\Expr\Variable) { + if (true) { $varNameLeft = $nodeLeftLeft->name; } elseif (in_array(get_class($nodeLeftLeft), $numberScalar, true)) { $valueLeft = $nodeLeftLeft->value;
Mutation Testing Code Review Annotations 8.0: src/Mutator/Boolean/LogicalOr.php#L171
Escaped Mutant for Mutator "InstanceOf_": --- Original +++ New @@ @@ } else { return true; } - if ($nodeLeftRight instanceof Node\Expr\Variable && $varNameLeft === null) { + if (true && $varNameLeft === null) { $varNameLeft = $nodeLeftRight->name; } elseif (in_array(get_class($nodeLeftRight), $numberScalar, true) && $valueLeft === null) { $valueLeft = $nodeLeftRight->value;
Mutation Testing Code Review Annotations 8.0: src/Mutator/Boolean/LogicalOr.php#L171
Escaped Mutant for Mutator "InstanceOf_": --- Original +++ New @@ @@ } else { return true; } - if ($nodeLeftRight instanceof Node\Expr\Variable && $varNameLeft === null) { + if (false && $varNameLeft === null) { $varNameLeft = $nodeLeftRight->name; } elseif (in_array(get_class($nodeLeftRight), $numberScalar, true) && $valueLeft === null) { $valueLeft = $nodeLeftRight->value;
Mutation Testing Code Review Annotations 8.0: src/Mutator/Boolean/LogicalOr.php#L171
Escaped Mutant for Mutator "Identical": --- Original +++ New @@ @@ } else { return true; } - if ($nodeLeftRight instanceof Node\Expr\Variable && $varNameLeft === null) { + if ($nodeLeftRight instanceof Node\Expr\Variable && $varNameLeft !== null) { $varNameLeft = $nodeLeftRight->name; } elseif (in_array(get_class($nodeLeftRight), $numberScalar, true) && $valueLeft === null) { $valueLeft = $nodeLeftRight->value;
Mutation Testing Code Review Annotations 8.0: src/Mutator/Boolean/LogicalOr.php#L171
Escaped Mutant for Mutator "LogicalAnd": --- Original +++ New @@ @@ } else { return true; } - if ($nodeLeftRight instanceof Node\Expr\Variable && $varNameLeft === null) { + if ($nodeLeftRight instanceof Node\Expr\Variable || $varNameLeft === null) { $varNameLeft = $nodeLeftRight->name; } elseif (in_array(get_class($nodeLeftRight), $numberScalar, true) && $valueLeft === null) { $valueLeft = $nodeLeftRight->value;