From 1fa7330f87c4c563a967c91886e4756031359764 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sun, 22 Sep 2024 17:24:49 +0700 Subject: [PATCH] Final touch: using $types as variable parameter for consistency usage with other method --- src/PhpParser/Node/BetterNodeFinder.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 = [];