SensioLabs\DeprecationDetector\FileInfo\PhpFileInfo::addMethodUsage PHP Method

addMethodUsage() public method

public addMethodUsage ( SensioLabs\DeprecationDetector\FileInfo\Usage\MethodUsage $methodUsage )
$methodUsage SensioLabs\DeprecationDetector\FileInfo\Usage\MethodUsage
    public function addMethodUsage(MethodUsage $methodUsage)
    {
        $this->methodUsages[] = $methodUsage;
    }

Usage Example

 /**
  * {@inheritdoc}
  */
 public function enterNode(Node $node)
 {
     if ($node instanceof Node\Stmt\ClassLike) {
         if (isset($node->namespacedName)) {
             $this->parentName = $node->namespacedName->toString();
         } else {
             $this->parentName = $node->name;
         }
     }
     if ($node instanceof Node\Expr\MethodCall) {
         // skips concat method names like $twig->{'get'.ucfirst($type)}()
         if ($node->name instanceof Node\Expr\BinaryOp\Concat) {
             return;
         }
         // skips variable methods like $definition->$method
         if (!is_string($node->name)) {
             return;
         }
         $type = $node->var->getAttribute('guessedType', null);
         if (null !== $type) {
             $methodUsage = new MethodUsage($node->name, $type, $node->getLine(), false);
             $this->phpFileInfo->addMethodUsage($methodUsage);
         }
     }
 }