本文整理汇总了PHP中Phan\Language\Context::withNamespace方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::withNamespace方法的具体用法?PHP Context::withNamespace怎么用?PHP Context::withNamespace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phan\Language\Context
的用法示例。
在下文中一共展示了Context::withNamespace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSimple
public function testSimple()
{
$context = new Context();
$context_namespace = $context->withNamespace('\\A');
$context_class = $context_namespace->withClassFQSEN(FullyQualifiedClassName::fromFullyQualifiedString('\\A\\B'));
$context_method = $context_namespace->withMethodFQSEN(FullyQualifiedMethodName::fromFullyQualifiedString('\\A\\b::c'));
$this->assertTrue(!empty($context));
$this->assertTrue(!empty($context_namespace));
$this->assertTrue(!empty($context_class));
$this->assertTrue(!empty($context_method));
}
示例2: testSimple
public function testSimple()
{
$context = new Context();
$context_namespace = $context->withNamespace('\\A');
$context_class = $context_namespace->withScope(new ClassScope($context_namespace->getScope(), FullyQualifiedClassName::fromFullyQualifiedString('\\A\\B')));
$context_method = $context_namespace->withScope(new FunctionLikeScope($context_namespace->getScope(), FullyQualifiedMethodName::fromFullyQualifiedString('\\A\\b::c')));
$this->assertTrue(!empty($context));
$this->assertTrue(!empty($context_namespace));
$this->assertTrue(!empty($context_class));
$this->assertTrue(!empty($context_method));
}
示例3: visitNamespace
/**
* Visit a node with kind `\ast\AST_NAMESPACE`
*
* @param Node $node
* A node to parse
*
* @return Context
* A new or an unchanged context resulting from
* parsing the node
*/
public function visitNamespace(Node $node) : Context
{
return $this->context->withNamespace('\\' . (string) $node->children['name']);
}