Skip to content

Commit 7ccd97c

Browse files
committed
fix
1 parent bec4f46 commit 7ccd97c

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/NodeAnalyzer/CallLikeExpectsThisBoundClosureArgsAnalyzer.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@ public function __construct(
2424
*/
2525
public function getArgsUsingThisBoundClosure(CallLike $callLike): array
2626
{
27-
$args = [];
28-
2927
if ($callLike->isFirstClassCallable() || $callLike->getArgs() === []) {
3028
return [];
3129
}
3230

33-
$args = $callLike->getArgs();
34-
$hasClosureArg = (bool) array_filter($args, fn (Arg $arg): bool => $arg->value instanceof Closure);
31+
$callArgs = $callLike->getArgs();
32+
$hasClosureArg = (bool) array_filter($callArgs, fn (Arg $arg): bool => $arg->value instanceof Closure);
3533

3634
if (! $hasClosureArg) {
3735
return [];
3836
}
3937

38+
$argsUsingThisBoundClosure = [];
39+
4040
$reflection = $this->reflectionResolver->resolveFunctionLikeReflectionFromCall($callLike);
4141

4242
if ($reflection === null) {
@@ -52,7 +52,7 @@ public function getArgsUsingThisBoundClosure(CallLike $callLike): array
5252
$parametersAcceptor = ParametersAcceptorSelectorVariantsWrapper::select($reflection, $callLike, $scope);
5353
$parameters = $parametersAcceptor->getParameters();
5454

55-
foreach ($callLike->getArgs() as $index => $arg) {
55+
foreach ($callArgs as $index => $arg) {
5656
if (! $arg->value instanceof Closure) {
5757
continue;
5858
}
@@ -65,7 +65,7 @@ public function getArgsUsingThisBoundClosure(CallLike $callLike): array
6565

6666
$hasObjectBinding = (bool) $parameter->getClosureThisType();
6767
if ($hasObjectBinding && $arg->name->name === $parameter->getName()) {
68-
$args[] = $arg;
68+
$argsUsingThisBoundClosure[] = $arg;
6969
}
7070
}
7171

@@ -81,11 +81,11 @@ public function getArgsUsingThisBoundClosure(CallLike $callLike): array
8181

8282
$hasObjectBinding = (bool) $parameter->getClosureThisType();
8383
if ($hasObjectBinding) {
84-
$args[] = $arg;
84+
$argsUsingThisBoundClosure[] = $arg;
8585
}
8686
}
8787
}
8888

89-
return $args;
89+
return $argsUsingThisBoundClosure;
9090
}
9191
}

0 commit comments

Comments
 (0)