本文整理汇总了PHP中PhpParser\Node\Stmt::getAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP Stmt::getAttribute方法的具体用法?PHP Stmt::getAttribute怎么用?PHP Stmt::getAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpParser\Node\Stmt
的用法示例。
在下文中一共展示了Stmt::getAttribute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addCommentsFromAttributes
/**
* @param \EBT\ExtensionBuilder\Domain\Model\AbstractObject $object
* @param \PhpParser\Node\Stmt $node
*/
protected function addCommentsFromAttributes(Model\AbstractObject $object, \PhpParser\Node\Stmt $node)
{
$comments = $node->getAttribute('comments');
if (is_array($comments)) {
foreach ($comments as $comment) {
if ($comment instanceof \PhpParser\Comment\Doc) {
$object->setDocComment($comment->getReformattedText());
} elseif ($comment instanceof \PhpParser\Comment) {
$object->addComment($comment->getText());
}
}
}
}
示例2: getEndLine
/**
* Get the line number that this function ends on.
*
* @return int
*/
public function getEndLine()
{
return (int) $this->node->getAttribute('endLine', -1);
}
示例3: verifyNotControlStructure
private function verifyNotControlStructure(Node\Stmt $node)
{
$nodeType = str_replace('Stmt_', '', $node->getType());
if (isset(self::$constructStructureMap[$nodeType])) {
throw ASTException::containsControlStructure(self::$constructStructureMap[$nodeType], $node->getAttribute('startLine'));
}
}
示例4: buildClassLikeReflection
protected function buildClassLikeReflection(AbstractNode $node)
{
if ($node instanceof InterfaceNode) {
$class = new ReflectionInterface((string) $node->namespacedName);
} elseif ($node instanceof TraitNode) {
$class = new ReflectionTrait((string) $node->namespacedName);
} else {
$class = new ReflectionClass((string) $node->namespacedName);
}
$class->setFilename((string) $this->context->getFilePath());
$class->setStartLine((int) $node->getAttribute('startLine'));
$class->setEndLine((int) $node->getAttribute('endLine'));
$class->setAliases($this->context->getAliases());
$class->setDocComment((string) $node->getDocComment());
$this->context->enterReflection($class);
return $class;
}