Phan\Language\Context::withNamespace PHP Method

withNamespace() public method

*
public withNamespace ( string $namespace ) : Context
$namespace string The namespace of the file
return Context A clone of this context with the given value is returned
    public function withNamespace(string $namespace) : Context
    {
        $context = clone $this;
        $context->namespace = $namespace;
        return $context;
    }

Usage Example

Example #1
0
 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));
 }
All Usage Examples Of Phan\Language\Context::withNamespace