PHPStan\Analyser\Scope::isInAnonymousFunction PHP Method

isInAnonymousFunction() public method

public isInAnonymousFunction ( ) : boolean
return boolean
    public function isInAnonymousFunction() : bool
    {
        return $this->inAnonymousFunctionReturnType !== null;
    }

Usage Example

 /**
  * @param \PhpParser\Node\Stmt\Return_ $node
  * @param \PHPStan\Analyser\Scope $scope
  * @return string[]
  */
 public function processNode(Node $node, Scope $scope) : array
 {
     if (!$scope->isInAnonymousFunction()) {
         return [];
     }
     return $this->returnTypeCheck->checkReturnType($scope, $scope->getAnonymousFunctionReturnType(), $node->expr, 'Anonymous function should return %s but empty return statement found.', 'Anonymous function with return type void returns %s but should not return anything.', 'Anonymous function should return %s but returns %s.');
 }
All Usage Examples Of PHPStan\Analyser\Scope::isInAnonymousFunction