/**
  * @param Node\Stmt\ClassConst $node
  */
 protected function parseClassConstantNode(Node\Stmt\ClassConst $node)
 {
     foreach ($node->consts as $const) {
         $this->structuralElements[$this->currentStructuralElement->namespacedName->toString()]['constants'][] = ['name' => $const->name, 'startLine' => $node->getLine(), 'docComment' => $node->getDocComment() ? $node->getDocComment()->getText() : null];
     }
 }
Example #2
0
 /**
  * @param ClassConst $node
  *
  * @return RefConstant
  */
 private function createConstant(ClassConst $node)
 {
     $ref = new RefConstant();
     $ref->class = $this->class;
     $ref->name = $node->consts[0]->name;
     $ref->value = $this->getValue($node->consts[0]->value);
     $ref->line = $node->getLine();
     $ref->docComment = $this->createDocComment($node);
     return $ref;
 }
 public function store_class_constant(Node\Stmt\Class_ $class, Node\Stmt\ClassConst $constant)
 {
     if ($comments = $constant->getAttribute('comments')) {
         $phpdoc = new DocBlock($comments[0]->getText());
         $description = $phpdoc->getShortDescription();
         // short circuit @ignore functions
         if ($phpdoc->hasTag('ignore')) {
             return;
         }
     } else {
         $description = '';
     }
     $this->store_model('class_constants', array('constant' => $constant->consts[0]->name, 'class' => $class->name, 'namespace' => !empty($class->namespacedName) ? implode('\\', array_slice($class->namespacedName->parts, 0, -1)) : '', 'file' => $this->_current_file, 'line' => $constant->getLine(), 'type' => $this->get_type_for_node($constant->consts[0]->value), 'description' => $description));
 }