SensioLabs\DeprecationDetector\FileInfo\PhpFileInfo::addFunctionDeprecation PHP Метод

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

public addFunctionDeprecation ( SensioLabs\DeprecationDetector\FileInfo\Deprecation\FunctionDeprecation $deprecation )
$deprecation SensioLabs\DeprecationDetector\FileInfo\Deprecation\FunctionDeprecation
    public function addFunctionDeprecation(FunctionDeprecation $deprecation)
    {
        $this->functionDeprecations[$deprecation->name()] = $deprecation;
    }

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;
     }
 }