/opt/cpanel/ea-wappspector/vendor/rector/rector/rules/DeadCode/SideEffect
Edit: /opt/cpanel/ea-wappspector/vendor/rector/rector/rules/DeadCode/SideEffect/PureFunctionDetector.php (1519B)
nodeNameResolver = $nodeNameResolver;
$this->reflectionProvider = $reflectionProvider;
}
public function detect(FuncCall $funcCall, Scope $scope) : bool
{
$funcCallName = $this->nodeNameResolver->getName($funcCall);
if ($funcCallName === null) {
return \false;
}
$name = new Name($funcCallName);
$hasFunction = $this->reflectionProvider->hasFunction($name, $scope);
if (!$hasFunction) {
return \false;
}
$functionReflection = $this->reflectionProvider->getFunction($name, $scope);
if (!$functionReflection instanceof NativeFunctionReflection) {
return \false;
}
// yes() and maybe() may have side effect
return $functionReflection->hasSideEffects()->no();
}
}