/opt/cpanel/ea-wappspector/vendor/rector/rector/src/PhpParser/NodeFinder
Edit: /opt/cpanel/ea-wappspector/vendor/rector/rector/src/PhpParser/NodeFinder/LocalMethodCallFinder.php (2319B)
betterNodeFinder = $betterNodeFinder;
$this->nodeTypeResolver = $nodeTypeResolver;
$this->nodeNameResolver = $nodeNameResolver;
}
/**
* @return MethodCall[]|StaticCall[]
*/
public function match(Class_ $class, ClassMethod $classMethod) : array
{
$className = $this->nodeNameResolver->getName($class);
if (!\is_string($className)) {
return [];
}
$classMethodName = $this->nodeNameResolver->getName($classMethod);
/** @var MethodCall[]|StaticCall[] $matchingMethodCalls */
$matchingMethodCalls = $this->betterNodeFinder->find($class->getMethods(), function (Node $subNode) use($className, $classMethodName) : bool {
if (!$subNode instanceof MethodCall && !$subNode instanceof StaticCall) {
return \false;
}
if (!$this->nodeNameResolver->isName($subNode->name, $classMethodName)) {
return \false;
}
$callerType = $subNode instanceof MethodCall ? $this->nodeTypeResolver->getType($subNode->var) : $this->nodeTypeResolver->getType($subNode->class);
if (!$callerType instanceof TypeWithClassName) {
return \false;
}
return $callerType->getClassName() === $className;
});
return $matchingMethodCalls;
}
}