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); } }
/** * @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; }
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]; } }
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); } }
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)); }