Skip to content

Bring Mutation Test score back to 100% #1382

@Ocramius

Description

@Ocramius

Seen in #1381 and #1380 ( https://github.com/Roave/BetterReflection/actions/runs/6983487200/job/19004937424?pr=1381#step:5:11665 )

Error: ] The minimum required MSI percentage should be 100%, but actual is      
         99.73%. Improve your tests!        
Escaped mutants:
================

1) /home/runner/work/BetterReflection/BetterReflection/src/Reflection/ReflectionFunctionAbstract.php:112    [M] GreaterThan

--- Original
+++ New
@@ @@
         $startLine = null;
         if ($node->hasAttribute('startLine')) {
             $startLine = $node->getStartLine();
-            assert($startLine > 0);
+            assert($startLine >= 0);
         }
         $endLine = null;
         if ($node->hasAttribute('endLine')) {


2) /home/runner/work/BetterReflection/BetterReflection/src/Reflection/ReflectionFunctionAbstract.php:118    [M] GreaterThan

--- Original
+++ New
@@ @@
         $endLine = null;
         if ($node->hasAttribute('endLine')) {
             $endLine = $node->getEndLine();
-            assert($endLine > 0);
+            assert($endLine >= 0);
         }
         $this->startLine = $startLine;
         $this->endLine = $endLine;


3) /home/runner/work/BetterReflection/BetterReflection/src/Reflection/ReflectionFunctionAbstract.php:507    [M] InstanceOf_

--- Original
+++ New
@@ @@
         if ($returnType === null) {
             return null;
         }
-        assert($returnType instanceof Node\Identifier || $returnType instanceof Node\Name || $returnType instanceof Node\NullableType || $returnType instanceof Node\UnionType || $returnType instanceof Node\IntersectionType);
+        assert(true || $returnType instanceof Node\Name || $returnType instanceof Node\NullableType || $returnType instanceof Node\UnionType || $returnType instanceof Node\IntersectionType);
         return ReflectionType::createFromNode($this->reflector, $this, $returnType);
     }
     /** @return list<ReflectionAttribute> */


4) /home/runner/work/BetterReflection/BetterReflection/src/Reflection/ReflectionFunctionAbstract.php:507    [M] InstanceOf_

--- Original
+++ New
@@ @@
         if ($returnType === null) {
             return null;
         }
-        assert($returnType instanceof Node\Identifier || $returnType instanceof Node\Name || $returnType instanceof Node\NullableType || $returnType instanceof Node\UnionType || $returnType instanceof Node\IntersectionType);
+        assert($returnType instanceof Node\Identifier || true || $returnType instanceof Node\NullableType || $returnType instanceof Node\UnionType || $returnType instanceof Node\IntersectionType);
         return ReflectionType::createFromNode($this->reflector, $this, $returnType);
     }
     /** @return list<ReflectionAttribute> */


5) /home/runner/work/BetterReflection/BetterReflection/src/Reflection/ReflectionFunctionAbstract.php:507    [M] InstanceOf_

--- Original
-        assert($returnType instanceof Node\Identifier || $returnType instanceof Node\Name || $returnType instanceof Node\NullableType || $returnType instanceof Node\UnionType || $returnType instanceof Node\IntersectionType);
+        assert($returnType instanceof Node\Identifier || $returnType instanceof Node\Name || $returnType instanceof Node\NullableType || $returnType instanceof Node\UnionType || false);
         return ReflectionType::createFromNode($this->reflector, $this, $returnType);
     }
     /** @return list<ReflectionAttribute> */


9) /home/runner/work/BetterReflection/BetterReflection/src/Reflection/ReflectionFunctionAbstract.php:507    [M] LogicalOrAllSubExprNegation

--- Original
+++ New
@@ @@
         if ($returnType === null) {
             return null;
         }
-        assert($returnType instanceof Node\Identifier || $returnType instanceof Node\Name || $returnType instanceof Node\NullableType || $returnType instanceof Node\UnionType || $returnType instanceof Node\IntersectionType);
+        assert(!$returnType instanceof Node\Identifier || !$returnType instanceof Node\Name || !$returnType instanceof Node\NullableType || !$returnType instanceof Node\UnionType || !$returnType instanceof Node\IntersectionType);
         return ReflectionType::createFromNode($this->reflector, $this, $returnType);
     }
     /** @return list<ReflectionAttribute> */

Not Covered mutants:
====================
Warning: Escaped Mutant for Mutator "GreaterThan":

--- Original
+++ New
@@ @@
         $startLine = null;
         if ($node->hasAttribute('startLine')) {
             $startLine = $node->getStartLine();
-            assert($startLine > 0);
+            assert($startLine >= 0);
         }
         $endLine = null;
         if ($node->hasAttribute('endLine')) {


Warning: Escaped Mutant for Mutator "GreaterThan":

--- Original
+++ New
@@ @@
         $endLine = null;
         if ($node->hasAttribute('endLine')) {
             $endLine = $node->getEndLine();


Warning: Escaped Mutant for Mutator "InstanceOf_":

--- Original
+++ New
@@ @@
         if ($returnType === null) {
             return null;
         }
-        assert($returnType instanceof Node\Identifier || $returnType instanceof Node\Name || $returnType instanceof Node\NullableType || $returnType instanceof Node\UnionType || $returnType instanceof Node\IntersectionType);
+        assert($returnType instanceof Node\Identifier || $returnType instanceof Node\Name || $returnType instanceof Node\NullableType || true || $returnType instanceof Node\IntersectionType);
         return ReflectionType::createFromNode($this->reflector, $this, $returnType);
     }
     /** @return list<ReflectionAttribute> */


Warning: Escaped Mutant for Mutator "InstanceOf_":

--- Original
+++ New
@@ @@
         if ($returnType === null) {
             return null;
         }
-        assert($returnType instanceof Node\Identifier || $returnType instanceof Node\Name || $returnType instanceof Node\NullableType || $returnType instanceof Node\UnionType || $returnType instanceof Node\IntersectionType);
+        assert($returnType instanceof Node\Identifier || $returnType instanceof Node\Name || $returnType instanceof Node\NullableType || $returnType instanceof Node\UnionType || true);
         return ReflectionType::createFromNode($this->reflector, $this, $returnType);
     }
     /** @return list<ReflectionAttribute> */


Warning: Escaped Mutant for Mutator "InstanceOf_":

--- Original
+++ New
@@ @@
         if ($returnType === null) {
             return null;
         }
-        assert($returnType instanceof Node\Identifier || $returnType instanceof Node\Name || $returnType instanceof Node\NullableType || $returnType instanceof Node\UnionType || $returnType instanceof Node\IntersectionType);
+        assert($returnType instanceof Node\Identifier || $returnType instanceof Node\Name || $returnType instanceof Node\NullableType || $returnType instanceof Node\UnionType || false);
         return ReflectionType::createFromNode($this->reflector, $this, $returnType);
     }
     /** @return list<ReflectionAttribute> */


Warning: Escaped Mutant for Mutator "LogicalOrAllSubExprNegation":

--- Original
+++ New
@@ @@
         if ($returnType === null) {
             return null;
         }
-        assert($returnType instanceof Node\Identifier || $returnType instanceof Node\Name || $returnType instanceof Node\NullableType || $returnType instanceof Node\UnionType || $returnType instanceof Node\IntersectionType);
+        assert(!$returnType instanceof Node\Identifier || !$returnType instanceof Node\Name || !$returnType instanceof Node\NullableType || !$returnType instanceof Node\UnionType || !$returnType instanceof Node\IntersectionType);
         return ReflectionType::createFromNode($this->reflector, $this, $returnType);
     }
     /** @return list<ReflectionAttribute> */

Warning:  Dashboard report has not been sent: The current process is a pull request build

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions