public function visitConstants(ClassConst $node)
 {
     $doc = $node->getDocComment();
     foreach ($node->consts as $const) {
         $this->visitConstant($const, $doc);
     }
 }
 private function processClassConstant(\PhpParser\Node\Stmt\ClassConst $node) {
     $constNode = $node->consts[0];
     $const = $this->unit->addConstant($constNode->name);
     $const->setValue($constNode->getAttribute('originalValue'));
     $docComment = $node->getDocComment();
     if ($docComment !== NULL) {
         $block = $this->dockblocParser->parse($docComment, $this->aliasMap);
         $const->setDocBlock($block);
     }
 }
Example #3
0
 private function processClassConstant(NodeType\ClassConst $node)
 {
     $constNode = $node->consts[0];
     $const = $this->unit->addConstant($constNode->name);
     $resolved = $this->resolveExpressionValue($constNode->value);
     $const->setType($resolved['type']);
     $const->setValue($resolved['value']);
     if (isset($resolved['constant'])) {
         $const->setConstantReference($resolved['constant']);
     }
     $docComment = $node->getDocComment();
     if ($docComment !== NULL) {
         $block = $this->docBlockParser->parse($docComment, $this->aliasMap);
         $const->setDocBlock($block);
     }
 }
 /**
  * @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 #5
0
 protected function addConstant(ClassConstNode $node)
 {
     foreach ($node->consts as $const) {
         $constant = new ConstantReflection($const->name, $const->getLine());
         $comment = $this->context->getDocBlockParser()->parse($node->getDocComment(), $this->context, $constant);
         $constant->setDocComment($node->getDocComment());
         $constant->setShortDesc($comment->getShortDesc());
         $constant->setLongDesc($comment->getLongDesc());
         $this->context->getClass()->addConstant($constant);
     }
 }
 public function addConstant(ClassConstNode $node)
 {
     foreach ($node->consts as $const) {
         $constant = new ReflectionConstant($const->name);
         $constant->setStartLine((int) $node->getAttribute('startLine'));
         $constant->setEndLine((int) $node->getAttribute('endLine'));
         $constant->setDocComment((string) $node->getDocComment());
         $constant->setValue($this->resolveValue($const->value));
         $this->context->getReflection()->addConstant($constant);
     }
 }