本文整理汇总了PHP中PhpParser\Node::toString方法的典型用法代码示例。如果您正苦于以下问题:PHP Node::toString方法的具体用法?PHP Node::toString怎么用?PHP Node::toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpParser\Node
的用法示例。
在下文中一共展示了Node::toString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: enterNode
/**
* Enter the node and record the name.
*
* @param \PhpParser\Node $node
*
* @return \PhpParser\Node
*/
public function enterNode(Node $node)
{
if ($node instanceof FullyQualified) {
$this->names[] = $node->toString();
}
return $node;
}
示例2: leaveNode
public function leaveNode(Node $node)
{
if ($node instanceof Node\Name) {
if ($node->toString() == $this->fromNs) {
$node->set($this->toNs);
}
}
}
示例3: leaveNode
public function leaveNode(Node $node)
{
if ($node instanceof Node\Name) {
return new Node\Name($node->toString('_'));
} elseif ($node instanceof Stmt\Class_ || $node instanceof Stmt\Interface_ || $node instanceof Stmt\Function_) {
$node->name = $node->namespacedName->toString('_');
} elseif ($node instanceof Stmt\Const_) {
foreach ($node->consts as $const) {
$const->name = $const->namespacedName->toString('_');
}
} elseif ($node instanceof Stmt\Namespace_) {
// returning an array merges is into the parent array
return $node->stmts;
} elseif ($node instanceof Stmt\Use_) {
// returning false removed the node altogether
return false;
}
}