Sstalle\php7cc\NodeAnalyzer\FunctionAnalyzer::isFunctionCallByStaticName PHP Метод

isFunctionCallByStaticName() публичный Метод

public isFunctionCallByStaticName ( PhpParser\Node $node, string | string[] $checkedFunctionName ) : boolean
$node PhpParser\Node
$checkedFunctionName string | string[] If an array as passed, function names should be keys
Результат boolean
    public function isFunctionCallByStaticName(Node $node, $checkedFunctionName)
    {
        $isFunctionCallByStaticName = $node instanceof Node\Expr\FuncCall && $node->name instanceof Node\Name;
        if (!$isFunctionCallByStaticName) {
            return $isFunctionCallByStaticName;
        }
        $calledFunctionName = strtolower($node->name->toString());
        return is_array($checkedFunctionName) ? isset($checkedFunctionName[$calledFunctionName]) : $calledFunctionName === $checkedFunctionName;
    }

Usage Example

Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function enterNode(Node $node)
 {
     if (!$this->functionAnalyzer->isFunctionCallByStaticName($node, $this->mktimeFamilyFunctions) || count($node->args) < 7) {
         return;
     }
     $this->addContextMessage(sprintf('Removed argument $is_dst used for function "%s"', $node->name->__toString()), $node);
 }
All Usage Examples Of Sstalle\php7cc\NodeAnalyzer\FunctionAnalyzer::isFunctionCallByStaticName