Skip to content

Commit

Permalink
Final touch: using $types as variable parameter for consistency usage…
Browse files Browse the repository at this point in the history
… with other method
  • Loading branch information
samsonasik committed Sep 22, 2024
1 parent c56c720 commit 1fa7330
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/PhpParser/Node/BetterNodeFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,18 +225,20 @@ function (Node $subNode) use (&$returns): ?int {
*
* @template T of Node
* @param Node[] $nodes
* @param class-string<T>|array<class-string<T>> $type
* @param class-string<T>|array<class-string<T>> $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
&& ($nodes[0] instanceof ClassMethod || $nodes[0] instanceof Function_ || $nodes[0] instanceof Closure)) {
$nodes = (array) $nodes[0]->stmts;
}

$types = is_string($type) ? [$type] : $type;
if (is_string($types)) {
$types = [$types];
}

/** @var T[] $foundNodes */
$foundNodes = [];
Expand Down

0 comments on commit 1fa7330

Please sign in to comment.