Overview

Namespaces

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

Classes

  • ArrayLookupNode
  • BacktickNode
  • BlankStatementNode
  • CommaListNode
  • CommentNode
  • DocCommentNode
  • EchoStatementNode
  • EchoTagStatementNode
  • ExpressionStatementNode
  • Filter
  • Formatter
  • FormatterFactory
  • LineCommentBlockNode
  • Node
  • NodeCollection
  • OperatorFactory
  • ParenthesisNode
  • ParentNode
  • Parser
  • PartialCommentNode
  • PartialNode
  • RootNode
  • SourceDiscovery
  • SourcePosition
  • SplatNode
  • StatementBlockNode
  • StatementNode
  • TemplateNode
  • Token
  • TokenIterator
  • Tokenizer
  • TokenNode
  • UnsetStatementNode
  • VisitorBase
  • WhitespaceNode

Interfaces

  • ExpressionNode
  • NodeInterface
  • ParentNodeInterface
  • ParserException
  • VisitorInterface

Traits

  • DocCommentTrait
  • ParenTrait
  • UncommentTrait
  • Overview
  • Namespace
  • Class

Class StatementNode

Base class for any statement.

A statement is a single executable unit of PHP code. You can think of a statement as a single "sentence" of code, usually ending with a semicolon. A single statement usually (but not always!) occupies a single line.

Here's an example of a perfectly valid statement:

<code>echo "Let's not go to Camelot. 'Tis a silly place.\n";</code>

Statements can contain other statements, or a block of statements surrounded by curly braces. A single statement is usually made up of one or more expressions.

Declarations are also statements. For instance, if/elseif/else and switch/case structures are statements, including all of their blocks. So is are class and function declarations. The body of the class or function is a statement block, but it's contained by the class or function declaration, which is a statement.

Pharborist\Node implements Pharborist\NodeInterface
Extended by Pharborist\ParentNode implements Pharborist\ParentNodeInterface
Extended by Pharborist\StatementNode

Direct known subclasses

Pharborist\BlankStatementNode, Pharborist\ControlStructures\BreakStatementNode, Pharborist\ControlStructures\IfNode, Pharborist\ControlStructures\ReturnStatementNode, Pharborist\ControlStructures\SwitchNode, Pharborist\ControlStructures\WhileNode, Pharborist\EchoStatementNode, Pharborist\EchoTagStatementNode, Pharborist\Exceptions\ThrowStatementNode, Pharborist\Exceptions\TryCatchNode, Pharborist\ExpressionStatementNode, Pharborist\Functions\FunctionDeclarationNode, Pharborist\ControlStructures\CaseNode, Pharborist\Generators\YieldStatementNode, Pharborist\Namespaces\NamespaceNode, Pharborist\Namespaces\UseDeclarationStatementNode, Pharborist\Objects\ClassStatementNode, Pharborist\Objects\InterfaceMethodNode, Pharborist\Objects\InterfaceNode, Pharborist\Objects\SingleInheritanceNode, Pharborist\Objects\TraitAdaptationStatementNode, Pharborist\UnsetStatementNode, Pharborist\Variables\GlobalStatementNode, Pharborist\ControlStructures\ContinueStatementNode, Pharborist\Variables\StaticVariableStatementNode, Pharborist\ControlStructures\DeclareNode, Pharborist\ControlStructures\DefaultNode, Pharborist\ControlStructures\DoWhileNode, Pharborist\ControlStructures\ForeachNode, Pharborist\ControlStructures\ForNode, Pharborist\ControlStructures\GotoStatementNode

Indirect known subclasses

Pharborist\Constants\ConstantDeclarationStatementNode, Pharborist\Objects\ClassMemberListNode, Pharborist\Objects\ClassMethodNode, Pharborist\Objects\ClassNode, Pharborist\Objects\TraitAliasNode, Pharborist\Objects\TraitNode, Pharborist\Objects\TraitPrecedenceNode, Pharborist\Objects\TraitUseNode
Abstract
Namespace: Pharborist
Located at StatementNode.php
Methods summary
public integer
# getLineCount( )

Gets the number of lines spanned by this statement.

Gets the number of lines spanned by this statement.

Returns

integer

Always returns at least one, because any statement will be at least one line long.

public Pharborist\CommentNode|Pharborist\LineCommentBlockNode
# toComment( )

Creates a commented-out version of this statement.

Creates a commented-out version of this statement.

Returns

Pharborist\CommentNode|Pharborist\LineCommentBlockNode
public
# addCommentAbove( Pharborist\LineCommentBlockNode|string $comment )

Adds a line comment block above the statement.

Adds a line comment block above the statement.

Parameters

$comment
The comment to add.

Returns


$this

Throws

InvalidArgumentException
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()
Pharborist API documentation generated by ApiGen