PHPStan\Rules\Methods\ReturnTypeRule::processNode PHP Method

processNode() public method

public processNode ( PhpParser\Node $node, Scope $scope ) : array
$node PhpParser\Node
$scope PHPStan\Analyser\Scope
return array
    public function processNode(Node $node, Scope $scope) : array
    {
        if ($scope->getFunction() === null) {
            return [];
        }
        if ($scope->isInAnonymousFunction()) {
            return [];
        }
        $method = $scope->getFunction();
        if (!$method instanceof MethodReflection) {
            return [];
        }
        return $this->returnTypeCheck->checkReturnType($scope, $method->getReturnType(), $node->expr, sprintf('Method %s::%s() should return %%s but empty return statement found.', $method->getDeclaringClass()->getName(), $method->getName()), sprintf('Method %s::%s() with return type void returns %%s but should not return anything.', $method->getDeclaringClass()->getName(), $method->getName()), sprintf('Method %s::%s() should return %%s but returns %%s.', $method->getDeclaringClass()->getName(), $method->getName()));
    }