Skip to content

Commit bec4f46

Browse files
committed
feedback changes
1 parent fc270ae commit bec4f46

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/NodeAnalyzer/CallLikeExpectsThisBoundClosureArgsAnalyzer.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,20 @@ public function __construct(
2525
public function getArgsUsingThisBoundClosure(CallLike $callLike): array
2626
{
2727
$args = [];
28-
$reflection = $this->reflectionResolver->resolveFunctionLikeReflectionFromCall($callLike);
2928

3029
if ($callLike->isFirstClassCallable() || $callLike->getArgs() === []) {
3130
return [];
3231
}
3332

33+
$args = $callLike->getArgs();
34+
$hasClosureArg = (bool) array_filter($args, fn (Arg $arg): bool => $arg->value instanceof Closure);
35+
36+
if (! $hasClosureArg) {
37+
return [];
38+
}
39+
40+
$reflection = $this->reflectionResolver->resolveFunctionLikeReflectionFromCall($callLike);
41+
3442
if ($reflection === null) {
3543
return [];
3644
}

0 commit comments

Comments
 (0)