From 3ed109e8faa05875b2995a1dd58616d9917c8111 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Thu, 12 Dec 2024 21:08:44 +0100 Subject: [PATCH] Fix alwaysTrue errors --- phpstan.neon | 1 + src/NodeAnalyzer/ComplexityAffectingNodeFinder.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpstan.neon b/phpstan.neon index a44594b..5c517a1 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -19,6 +19,7 @@ parameters: ignoreErrors: - identifier: missingType.generics + - identifier: instanceof.alwaysTrue # skip as always string - '#Parameter \#1 \$currentWorkingDirectory of class PHPStan\\DependencyInjection\\ContainerFactory constructor expects string, string\|false given#' diff --git a/src/NodeAnalyzer/ComplexityAffectingNodeFinder.php b/src/NodeAnalyzer/ComplexityAffectingNodeFinder.php index 378ea76..0c9610c 100644 --- a/src/NodeAnalyzer/ComplexityAffectingNodeFinder.php +++ b/src/NodeAnalyzer/ComplexityAffectingNodeFinder.php @@ -72,7 +72,7 @@ public function isBreakingNode(Node $node): bool if ($this->isInstanceOf($node, self::BREAKING_NODE_TYPES)) { // skip empty breaks /** @var Goto_|Break_|Continue_ $node */ - if ($node instanceof Goto_ && $node->name instanceof Identifier) { + if ($node instanceof Goto_) { return true; }