diff --git a/src/PhpParser/Node/BetterNodeFinder.php b/src/PhpParser/Node/BetterNodeFinder.php index afbfc1a99c..3b24e98dfb 100644 --- a/src/PhpParser/Node/BetterNodeFinder.php +++ b/src/PhpParser/Node/BetterNodeFinder.php @@ -225,10 +225,10 @@ function (Node $subNode) use (&$returns): ?int { * * @template T of Node * @param Node[] $nodes - * @param class-string|array> $type + * @param class-string|array> $types * @return T[] */ - public function findInstancesOfScoped(array $nodes, string|array $type): array + public function findInstancesOfScoped(array $nodes, string|array $types): array { // here verify only pass single nodes as FunctionLike if (count($nodes) === 1 @@ -236,7 +236,9 @@ public function findInstancesOfScoped(array $nodes, string|array $type): array $nodes = (array) $nodes[0]->stmts; } - $types = is_string($type) ? [$type] : $type; + if (is_string($types)) { + $types = [$types]; + } /** @var T[] $foundNodes */ $foundNodes = [];