PHPStan\Broker\Broker::hasFunction PHP Method

hasFunction() public method

public hasFunction ( Name $nameNode, Scope $scope ) : boolean
$nameNode PhpParser\Node\Name
$scope PHPStan\Analyser\Scope
return boolean
    public function hasFunction(\PhpParser\Node\Name $nameNode, Scope $scope) : bool
    {
        return $this->resolveFunctionName($nameNode, $scope) !== null;
    }

Usage Example

 /**
  * @param \PhpParser\Node\Expr\FuncCall $node
  * @param \PHPStan\Analyser\Scope $scope
  * @return string[]
  */
 public function processNode(Node $node, Scope $scope) : array
 {
     if (!$node->name instanceof \PhpParser\Node\Name) {
         return [];
     }
     if (!$this->broker->hasFunction($node->name, $scope)) {
         return [];
     }
     $function = $this->broker->getFunction($node->name, $scope);
     return $this->check->check($function, $node, ['Function ' . $function->getName() . ' invoked with %d parameter, %d required.', 'Function ' . $function->getName() . ' invoked with %d parameters, %d required.', 'Function ' . $function->getName() . ' invoked with %d parameter, at least %d required.', 'Function ' . $function->getName() . ' invoked with %d parameters, at least %d required.', 'Function ' . $function->getName() . ' invoked with %d parameter, %d-%d required.', 'Function ' . $function->getName() . ' invoked with %d parameters, %d-%d required.']);
 }
All Usage Examples Of PHPStan\Broker\Broker::hasFunction