Inheritance: extends PhpParser\NodeVisitorAbstract
 public function leaveNode(Node $node)
 {
     parent::leaveNode($node);
     if ($node instanceof ClassMethod || $node instanceof Function_) {
         array_pop($this->currentMethod);
     }
 }
 /**
  * {@inheritDoc}
  */
 public function leaveNode(Node $node)
 {
     parent::leaveNode($node);
     if ($this->currentStructuralElement === $node) {
         $this->currentStructuralElement = null;
     }
 }
Beispiel #3
0
 protected function resolveOtherName(Name $name, $type)
 {
     if (!$name instanceof FullyQualified) {
         $name->setAttribute('resolvedFqcn', parent::resolveOtherName($name, $type));
     }
     return $name;
 }
 protected function resolveClassName(PhpParser\Node\Name $name)
 {
     if ($name->isFullyQualified()) {
         return $name;
     }
     $old = $name->toString();
     $resolved = parent::resolveClassName($name);
     $this->resolvedClasses[$old] = $resolved->toString();
     return $resolved;
 }
Beispiel #5
0
 public function enterNode(Node $node)
 {
     parent::enterNode($node);
     $comment = $node->getDocComment();
     if ($comment) {
         $regex = "(@(param|return|var|type)\\h+(\\S+))";
         $comment->setText(preg_replace_callback($regex, function ($match) {
             $type = $this->parseTypeDecl($match[2]);
             return "@{$match[1]} {$type}";
         }, $comment->getText()));
     }
 }
 function enterNode(\PhpParser\Node $node)
 {
     if ($this->useDocBlock) {
         if ($node instanceof Function_ || $node instanceof \PhpParser\Node\Stmt\ClassMethod) {
             $this->importReturnValue($node);
         }
         if ($node instanceof Property) {
             $this->importVarType($node);
         }
     }
     parent::enterNode($node);
 }
 /**
  * @param \PhpParser\Node $node
  */
 public function enterNode(Node $node)
 {
     parent::enterNode($node);
     if ($node instanceof UseUse) {
         $name = $node->name->toString();
         $this->addToRegistry($name);
     } elseif ($node instanceof Expr\StaticCall || $node instanceof Expr\StaticPropertyFetch || $node instanceof Expr\ClassConstFetch || $node instanceof Expr\New_ || $node instanceof Expr\Instanceof_) {
         if ($node->class instanceof Name) {
             $name = $node->class->toString();
             $this->addToRegistry($name);
         }
     }
 }
 public function enterNode(Node $node)
 {
     parent::enterNode($node);
     try {
         if ($doc = $node->getDocComment()) {
             $docBlock = new DocBlock($doc->getText());
             if ($tagNames = $this->collectTagNamesBy($docBlock->getTags())) {
                 $node->setAttribute(self::TAG_NAMES_ATTRIBUTE, $tagNames);
             }
         }
     } catch (\Exception $e) {
         $parseError = new Error($e->getMessage(), $node->getLine());
         $this->logger->warning($parseError->getMessage(), array($this->file));
     }
 }
 /**
  * {@inheritDoc}
  */
 public function enterNode(Node $node)
 {
     parent::enterNode($node);
     if ($node instanceof Node\Stmt\Class_) {
         $this->parseClassNode($node);
     } elseif ($node instanceof Node\Stmt\Interface_) {
         $this->parseInterfaceNode($node);
     } elseif ($node instanceof Node\Stmt\Trait_) {
         $this->parseTraitNode($node);
     } elseif ($node instanceof Node\Stmt\TraitUse) {
         $this->parseTraitUseNode($node);
     } elseif ($node instanceof Node\Stmt\Property) {
         $this->parseClassPropertyNode($node);
     } elseif ($node instanceof Node\Stmt\ClassMethod) {
         $this->parseClassMethodNode($node);
     } elseif ($node instanceof Node\Stmt\ClassConst) {
         $this->parseClassConstantNode($node);
     } elseif ($node instanceof Node\Stmt\Function_) {
         $this->parseFunctionNode($node);
     } elseif ($node instanceof Node\Stmt\Const_) {
         $this->parseConstantNode($node);
     }
 }
 public function enterNode(Node $node)
 {
     parent::enterNode($node);
     try {
         if ($doc = $node->getDocComment()) {
             $docBlock = $this->docBlockFactory->create(str_replace('[]', '', $doc->getText()), new Context((string) $this->namespace, (array) $this->namespaceAliases));
             if ($tagNames = $this->collectTagNamesBy($docBlock->getTags())) {
                 $node->setAttribute(self::TAG_NAMES_ATTRIBUTE, $tagNames);
             }
         }
     } catch (\Exception $e) {
         $parseError = new Error($e->getMessage(), $node->getLine());
         $this->logger->warning($parseError->getMessage(), array($this->file));
     }
 }