Skip to content

Commit 67ba647

Browse files
phpstan-botclaude
andcommitted
Address review: native return type and reorder $this check
- Add native return type to resolveCallUserFuncCalleeReflection - Move $this check to be first inside the loop Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 45fb724 commit 67ba647

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

src/Analyser/ExprHandler/FuncCallHandler.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@ public function processExpr(NodeScopeResolver $nodeScopeResolver, Stmt $stmt, Ex
225225
$innerCalleeReflection = $this->resolveCallUserFuncCalleeReflection($innerFuncCall, $scope);
226226

227227
foreach ($innerArgs as $i => $innerArg) {
228+
$argValue = $innerArg->value;
229+
if ($argValue instanceof Variable && $argValue->name === 'this') {
230+
continue;
231+
}
232+
228233
$innerParameter = null;
229234
if (isset($innerParameters[$i])) {
230235
$innerParameter = $innerParameters[$i];
@@ -236,11 +241,6 @@ public function processExpr(NodeScopeResolver $nodeScopeResolver, Stmt $stmt, Ex
236241
continue;
237242
}
238243

239-
$argValue = $innerArg->value;
240-
if ($argValue instanceof Variable && $argValue->name === 'this') {
241-
continue;
242-
}
243-
244244
$byRefType = $nodeScopeResolver->resolveByRefParameterType($innerFuncCall, $innerCalleeReflection, $innerParameter, $scope);
245245
$scope = $nodeScopeResolver->processVirtualAssign(
246246
$scope,
@@ -867,10 +867,7 @@ public function resolveType(MutatingScope $scope, Expr $expr): Type
867867
return VoidToNullTypeTransformer::transform($parametersAcceptor->getReturnType(), $expr);
868868
}
869869

870-
/**
871-
* @return FunctionReflection|MethodReflection|null
872-
*/
873-
private function resolveCallUserFuncCalleeReflection(FuncCall $innerFuncCall, MutatingScope $scope)
870+
private function resolveCallUserFuncCalleeReflection(FuncCall $innerFuncCall, MutatingScope $scope): FunctionReflection|MethodReflection|null
874871
{
875872
if ($innerFuncCall->name instanceof Name && $this->reflectionProvider->hasFunction($innerFuncCall->name, $scope)) {
876873
return $this->reflectionProvider->getFunction($innerFuncCall->name, $scope);

0 commit comments

Comments
 (0)