fix:repo cleanup
This commit is contained in:
@@ -51,7 +51,6 @@ final class Calculator
|
||||
assert($nodes !== null);
|
||||
|
||||
return $this->calculateForAbstractSyntaxTree($nodes);
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Error $error) {
|
||||
throw new RuntimeException(
|
||||
|
||||
@@ -32,7 +32,7 @@ final readonly class ComplexityCollection implements Countable, IteratorAggregat
|
||||
|
||||
public static function fromList(Complexity ...$items): self
|
||||
{
|
||||
return new self($items);
|
||||
return new self(array_values($items));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-8
@@ -13,7 +13,6 @@ use function assert;
|
||||
use function is_array;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\New_;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\Stmt;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
@@ -111,7 +110,6 @@ final class ComplexityCalculatingVisitor extends NodeVisitorAbstract
|
||||
}
|
||||
|
||||
assert(isset($parent->namespacedName));
|
||||
assert($parent->namespacedName instanceof Name);
|
||||
|
||||
return $parent->namespacedName->toString() . '::' . $node->name->toString();
|
||||
}
|
||||
@@ -122,12 +120,7 @@ final class ComplexityCalculatingVisitor extends NodeVisitorAbstract
|
||||
private function functionName(Function_ $node): string
|
||||
{
|
||||
assert(isset($node->namespacedName));
|
||||
assert($node->namespacedName instanceof Name);
|
||||
|
||||
$functionName = $node->namespacedName->toString();
|
||||
|
||||
assert($functionName !== '');
|
||||
|
||||
return $functionName;
|
||||
return $node->namespacedName->toString();
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -31,7 +31,7 @@ final class CyclomaticComplexityCalculatingVisitor extends NodeVisitorAbstract
|
||||
*/
|
||||
private int $cyclomaticComplexity = 1;
|
||||
|
||||
public function enterNode(Node $node): void
|
||||
public function enterNode(Node $node): null
|
||||
{
|
||||
switch ($node::class) {
|
||||
case BooleanAnd::class:
|
||||
@@ -49,6 +49,8 @@ final class CyclomaticComplexityCalculatingVisitor extends NodeVisitorAbstract
|
||||
case While_::class:
|
||||
$this->cyclomaticComplexity++;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user