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

addMethodDeprecation() public method

public addMethodDeprecation ( SensioLabs\DeprecationDetector\FileInfo\Deprecation\MethodDeprecation $methodDeprecation )
$methodDeprecation SensioLabs\DeprecationDetector\FileInfo\Deprecation\MethodDeprecation
    public function addMethodDeprecation(MethodDeprecation $methodDeprecation)
    {
        if (!isset($this->methodDeprecations[$methodDeprecation->parentName()])) {
            $this->methodDeprecations[$methodDeprecation->parentName()] = array();
        }
        $this->methodDeprecations[$methodDeprecation->parentName()][$methodDeprecation->name()] = $methodDeprecation;
    }

Usage Example

 /**
  * {@inheritdoc}
  */
 public function enterNode(Node $node)
 {
     if ($node instanceof Node\Stmt\ClassLike) {
         if ($node instanceof Node\Stmt\Class_ && $node->isAnonymous()) {
             return;
         }
         $this->parentName = $node->namespacedName->toString();
     }
     if (!$this->hasDeprecatedDocComment($node)) {
         return;
     }
     if ($node instanceof Node\Stmt\Function_) {
         $this->phpFileInfo->addFunctionDeprecation(new FunctionDeprecation($node->name, $this->getDeprecatedDocComment($node)));
         return;
     }
     if ($node instanceof Node\Stmt\Class_) {
         $this->phpFileInfo->addClassDeprecation(new ClassDeprecation($this->parentName, $this->getDeprecatedDocComment($node)));
         return;
     }
     if ($node instanceof Node\Stmt\Interface_) {
         $this->phpFileInfo->addInterfaceDeprecation(new InterfaceDeprecation($this->parentName, $this->getDeprecatedDocComment($node)));
         return;
     }
     if ($node instanceof Node\Stmt\ClassMethod) {
         $this->phpFileInfo->addMethodDeprecation(new MethodDeprecation($this->parentName, $node->name, $this->getDeprecatedDocComment($node)));
         return;
     }
 }