Overview

Namespaces

  • Pharborist
    • Constants
    • ControlStructures
    • Exceptions
    • Functions
    • Generators
    • Namespaces
    • Objects
    • Operators
    • Types
    • Variables

Classes

  • NameNode
  • NamespaceNode
  • UseDeclarationBlockNode
  • UseDeclarationNode
  • UseDeclarationStatementNode

Traits

  • IdentifierNameTrait
  • Overview
  • Namespace
  • Class

Class NamespaceNode

A namespace declaration.

This node is used for both forms of namespace declaration:

namespace \Foo\Bar;

and

namespace \Foo\Baz { // Do amazing things here
}

Everything in the namespace is part of the namespace's body. This is the case even with the first form of the namespace. A parsed file with a namespace declaration at the top will have the declaration as one of its children (alongside any preceding comments and whitespace), and everything else in the file after the namespace declaration will be a descendant of that NamespaceNode.

Pharborist\Node implements Pharborist\NodeInterface
Extended by Pharborist\ParentNode implements Pharborist\ParentNodeInterface
Extended by Pharborist\StatementNode
Extended by Pharborist\Namespaces\NamespaceNode uses Pharborist\DocCommentTrait
Namespace: Pharborist\Namespaces
See: \Pharborist\NameNode
Located at Namespaces/NamespaceNode.php
Methods summary
public static Pharborist\Namespaces\NamespaceNode
# create( Pharborist\Namespaces\NameNode|string $name )

Create namespace declaration.

Create namespace declaration.

Parameters

$name
Namespace path.

Returns

Pharborist\Namespaces\NamespaceNode
public Pharborist\Namespaces\NameNode
# getName( )

Returns

Pharborist\Namespaces\NameNode
public Pharborist\StatementBlockNode
# getBody( )

Returns

Pharborist\StatementBlockNode
public boolean
# owns( Pharborist\Objects\ClassNode|Pharborist\Objects\InterfaceNode|Pharborist\Objects\TraitNode|Pharborist\Functions\FunctionDeclarationNode|Pharborist\Constants\ConstantDeclarationNode $node )

Determine if the node belongs to this namespace.

Determine if the node belongs to this namespace.

Parameters

$node
Node to test if owned by namespace.

Returns

boolean
public Pharborist\Namespaces\UseDeclarationNode[]|Pharborist\NodeCollection
# getUseDeclarations( )

Get use declarations.

Get use declarations.

Returns

Pharborist\Namespaces\UseDeclarationNode[]|Pharborist\NodeCollection
Use declarations.
public array
# getClassAliases( )

Return mapping of class names to fully qualified names.

Return mapping of class names to fully qualified names.

Returns

array
Associative array of namespace alias to fully qualified names.
Methods inherited from Pharborist\StatementNode
addCommentAbove(), getLineCount(), toComment()
Methods inherited from Pharborist\ParentNode
__clone(), __toString(), acceptVisitor(), addChild(), addChildren(), append(), childCount(), children(), clear(), find(), firstChild(), firstToken(), getSourcePosition(), getText(), getTree(), has(), isDescendant(), isEmpty(), lastChild(), lastToken(), mergeNode(), prepend(), walk()
Methods inherited from Pharborist\Node
after(), appendTo(), before(), closest(), fromValue(), furthest(), getLogicalBlock(), getRoot(), getStatement(), hasRoot(), index(), insertAfter(), insertBefore(), is(), isAllOf(), isAnyOf(), next(), nextAll(), nextToken(), nextUntil(), parent(), parents(), parentsUntil(), prependTo(), previous(), previousAll(), previousToken(), previousUntil(), remove(), replaceAll(), replaceWith(), siblings(), sortKey(), swapWith()
Methods used from Pharborist\DocCommentTrait
getDocComment(), getIndent(), setDocComment()
Pharborist API documentation generated by ApiGen