PHP Class PDepend\Source\Language\PHP\AbstractPHPParser

With the default settings the parser includes annotations, better known as doc comment tags, in the generated result. This means it extracts the type information of @var tags for properties, and types in @return + @throws tags of functions and methods. The current implementation tries to ignore all scalar types from boolean to void. You should disable this feature for project that have more or less invalid doc comments, because it could produce invalid results. $parser->setIgnoreAnnotations(); Note: Due to the fact that it is possible to use the same name for multiple classes and interfaces, and there is no way to determine to which package it belongs, while the parser handles class, interface or method signatures, the parser could/will create a code tree that doesn't reflect the real source structure.
显示文件 Open project: pdepend/pdepend Class Usage Examples

Protected Properties

Property Type Description
$builder PDepend\Source\Builder\Builder The used data structure builder.
$cache PDepend\Util\Cache\CacheDriver
$compilationUnit PDepend\Source\AST\ASTCompilationUnit The currently parsed file instance.
$tokenStack PDepend\Source\Tokenizer\TokenStack Stack with all active token scopes.
$tokenizer * The used code tokenizer.

Public Methods

Method Description
__construct ( PDepend\Source\Tokenizer\Tokenizer $tokenizer, PDepend\Source\Builder\Builder $builder, PDepend\Util\Cache\CacheDriver $cache ) Constructs a new source parser.
parse ( ) : void Parses the contents of the tokenizer and generates a node tree based on the found tokens.
setIgnoreAnnotations ( ) : void Sets the ignore annotations flag. This means that the parser will ignore doc comment annotations.
setMaxNestingLevel ( integer $maxNestingLevel ) : void Configures the maximum allowed nesting level.

Protected Methods

Method Description
consumeComments ( ) : void This method will consume all comment tokens from the token stream.
consumeToken ( integer $tokenType ) : PDepend\Source\Tokenizer\Token This method will consume the next token in the token stream. It will throw an exception if the type of this token is not identical with $tokenType.
doParseArray ( $static = false ) : PDepend\Source\AST\ASTArray Parses an array structure.
getMaxNestingLevel ( ) : integer Returns the maximum allowed nesting/recursion level.
isArrayStartDelimiter ( ) : boolean Tests if the next token is a valid array start delimiter in the supported PHP version.
isClassName ( integer $tokenType ) : boolean Will return true if the given $tokenType is a valid class name part.
isFileComment ( ) : boolean Checks that the current token could be used as file comment.
isFunctionName ( integer $tokenType ) : boolean Tests if the give token is a valid function name in the supported PHP version.
isKeyword ( $tokenType ) : boolean Tests if the given token type is a reserved keyword in the supported PHP version.
isMethodName ( integer $tokenType ) : boolean
isNextTokenArguments ( ) : boolean This method checks if the next available token starts an arguments node.
isTypeHint ( integer $tokenType ) : boolean Tests if the given token type is a valid formal parameter in the supported PHP version.
parseAllocationExpressionTypeReference ( PDepend\Source\AST\ASTAllocationExpression $allocation ) : PDepend\Source\AST\ASTNode Parse the type reference used in an allocation expression.
parseArguments ( ) : PDepend\Source\AST\ASTArguments This method parses the arguments passed to a function- or method-call.
parseArray ( PDepend\Source\AST\ASTArray $array, boolean $static = false ) : PDepend\Source\AST\ASTArray Parses a php array declaration.
parseArrayElement ( boolean $static = false ) : PDepend\Source\AST\ASTArrayElement Parses a single array element.
parseArrayElements ( PDepend\Source\AST\ASTArray $array, integer $endDelimiter, boolean $static = false ) : PDepend\Source\AST\ASTArray Parses all elements in an array.
parseArrayType ( ) : PDepend\Source\AST\ASTTypeArray
parseAssignmentExpression ( PDepend\Source\AST\ASTNode $left ) : PDepend\Source\AST\ASTAssignmentExpression Parses an assingment expression node.
parseBooleanAndExpression ( ) : PDepend\Source\AST\ASTBooleanAndExpression This method parses a boolean and-expression.
parseBooleanOrExpression ( ) : PDepend\Source\AST\ASTBooleanOrExpression This method parses a boolean or-expression.
parseCallableDeclarationAddition ( PDepend\Source\AST\AbstractASTCallable $callable ) : PDepend\Source\AST\AbstractASTCallable Extension for version specific additions.
parseCastExpression ( ) : PDepend\Source\AST\ASTCaseExpression Parses a cast-expression node.
parseClassDeclaration ( ) : PDepend\Source\AST\ASTClass Parses the dependencies in a class signature.
parseClassExtends ( PDepend\Source\AST\ASTClass $class ) : PDepend\Source\AST\ASTClass Parses a parent class declaration for the given $class.
parseClassName ( ) : string Parses a valid class or interface name and returns the image of the parsed token.
parseClassSignature ( ) : PDepend\Source\AST\ASTClass Parses the signature of a class.
parseCompoundExpression ( ) : PDepend\Source\AST\ASTCompoundExpression This method parses a compound expression node.
parseCompoundVariableOrVariableVariableOrVariable ( ) : PDepend\Source\AST\ASTNode This method is a decision point between the different variable types availanle in PHP. It peeks the next token and then decides whether it is a regular variable or when the next token is of type T_DOLLAR a compound- or variable-variable.
parseConditionalExpression ( ) : PDepend\Source\AST\ASTConditionalExpression This method parses a conditional-expression.
parseConstant ( ) : PDepend\Source\AST\ASTNode Parses a simple PHP constant use and returns a corresponding node.
parseConstantDeclarator ( ) : PDepend\Source\AST\ASTConstantDeclarator Parses a single constant declarator.
parseConstantDeclaratorValue ( ) : PDepend\Source\AST\ASTValue Parses the value of a php constant. By default this can be only static values that were allowed in the oldest supported PHP version.
parseExpressionTypeReference ( PDepend\Source\AST\ASTNode $expr, boolean $classRef ) : PDepend\Source\AST\ASTNode This method parses a type identifier as it is used in expression nodes like {@link \PDepend\Source\AST\ASTInstanceOfExpression} or an object allocation node like {@link \PDepend\Source\AST\ASTAllocationExpression}.
parseFormalParameter ( ) : PDepend\Source\AST\ASTFormalParameter This method will parse a formal parameter. A formal parameter is at least a variable name, but can also contain a default parameter value.
parseFormalParameterOrByReference ( ) : PDepend\Source\AST\ASTFormalParameter This method will parse a formal parameter that can optionally be passed by reference.
parseFunctionName ( ) : string Parses a function name from the given tokenizer and returns the string literal representing the function name. If no valid token exists in the token stream, this method will throw an exception.
parseHeredoc ( ) : PDepend\Source\AST\ASTHeredoc Parses a here- or nowdoc string instance.
parseIdentifier ( ) : PDepend\Source\AST\ASTIdentifier Parses a static identifier expression, as it is used for method and function names.
parseIntegerNumber ( ) : PDepend\Source\AST\ASTLiteral Parses an integer value.
parseInterfaceList ( PDepend\Source\AST\AbstractASTClassOrInterface $abstractType ) : void This method parses a list of interface names as used in the extends part of a interface declaration or in the implements part of a class declaration.
parseLiteral ( ) : PDepend\Source\AST\ASTLiteral This method parses a simple literal and configures the position properties.
parseLiteralOrString ( ) : PDepend\Source\AST\ASTNode This method parses a {@link \PDepend\Source\AST\ASTLiteral} node or an instance of {@link \PDepend\Source\AST\ASTString} that represents a string in double quotes or surrounded by backticks.
parseLogicalAndExpression ( ) : PDepend\Source\AST\ASTLogicalAndExpression This method parses a logical and-expression.
parseLogicalOrExpression ( ) : PDepend\Source\AST\ASTLogicalOrExpression This method parses a logical or-expression.
parseLogicalXorExpression ( ) : PDepend\Source\AST\ASTLogicalXorExpression This method parses a logical xor-expression.
parseMethodName ( ) : string
parseOptionalExpression ( ) : PDepend\Source\AST\ASTNode This method optionally parses an expression node and returns it. When no expression was found this method will return null.
parseOptionalExpressionForVersion ( ) : PDepend\Source\AST\ASTNode This method will be called when the base parser cannot handle an expression in the base version. In this method you can implement version specific expressions.
parseOptionalIndexExpression ( PDepend\Source\AST\ASTNode $node ) : PDepend\Source\AST\ASTNode Parses one or more optional php array or string expressions.
parseParentType ( ) : PDepend\Source\AST\ASTParentReference
parseParenthesisExpressionOrPrimaryPrefix ( ) : PDepend\Source\AST\ASTNode Parses a simple parenthesis expression or a direct object access, which was introduced with PHP 5.4.0:
parsePostfixIdentifier ( ) : PDepend\Source\AST\ASTNode This method parses a PHP version specific identifier for method and property postfix expressions.
parseQualifiedName ( ) : string Parses a php class/method name chain.
parseSelfReference ( PDepend\Source\Tokenizer\Token $token ) : PDepend\Source\AST\ASTSelfReference This method parses a {@link \PDepend\Source\AST\ASTSelfReference} node.
parseSelfType ( ) : PDepend\Source\AST\ASTSelfReference
parseShiftLeftExpression ( ) : PDepend\Source\AST\ASTShiftLeftExpression This method parses a shift left expression node.
parseShiftRightExpression ( ) : PDepend\Source\AST\ASTShiftRightExpression This method parses a shift right expression node.
parseStaticValue ( ) : PDepend\Source\AST\ASTValue This method will parse a static default value as it is used for a parameter, property or constant declaration.
parseStaticValueOrStaticArray ( ) : PDepend\Source\AST\ASTValue This method will parse a static value or a static array as it is used as default value for a parameter or property declaration.
parseStaticValueVersionSpecific ( PDepend\Source\AST\ASTValue $value ) : PDepend\Source\AST\ASTValue Parses additional static values that are valid in the supported php version.
parseTypeBody ( AbstractASTType $type ) : AbstractASTType Parses a class/interface/trait body.
parseTypeHint ( ) : PDepend\Source\AST\ASTNode Parses a type hint that is valid in the supported PHP version.
parseUseDeclaration ( ) : void This method parses a single use declaration and adds a mapping between short name and full qualified name to the use symbol table.
parseUseDeclarations ( ) : void This method parses a list of PHP 5.3 use declarations and adds a mapping between short name and full qualified name to the use symbol table.
parseVariableDeclarator ( ) : PDepend\Source\AST\ASTVariableDeclarator This method will parse a variable declarator.
parseVariableOrConstantOrPrimaryPrefix ( ) : PDepend\Source\AST\ASTNode This method implements the parsing for various expression types like variables, object/static method. All these expressions are valid in several php language constructs like, isset, empty, unset etc.
reduce ( array $expressions ) : PDepend\Source\AST\ASTExpression[] Applies all reduce rules against the given expression list.
reset ( integer $modifiers ) : void Resets some object properties.
setNodePositionsAndReturn ( PDepend\Source\AST\ASTNode $node, array &$tokens = null ) : PDepend\Source\AST\ASTNode This method configures the given node with its start and end positions.
setUpEnvironment ( ) : void Initializes the parser environment.
tearDownEnvironment ( ) : void Restores the parser environment back.
throwUnexpectedTokenException ( PDepend\Source\Tokenizer\Token $token = null ) : void Throws an UnexpectedTokenException

Private Methods

Method Description
createQualifiedTypeName ( string $localName ) : string This method creates a qualified class or interface name based on the current parser state. By default method uses the current namespace scope as prefix for the given local name. And it will fallback to a previously parsed package annotation, when no namespace declaration was parsed.
extractPostfixImage ( PDepend\Source\AST\ASTNode $node ) : string This method will extract the image/name of the real property/variable that is wrapped by {@link \PDepend\Source\AST\ASTIndexExpression} nodes. If the given node is now wrapped by index expressions, this method will return the image of the entire $node.
getNamespaceOrPackage ( ) : PDepend\Source\AST\ASTNamespace Returns the currently active package or namespace.
getNamespaceOrPackageName ( ) : string Returns the name of a declared names. When the parsed code is not namespaced this method will return the name from the @package annotation.
isAlternativeScopeTermination ( integer $tokenType ) : boolean This method returns true when the given token identifier represents the end token of a alternative scope termination symbol. Otherwise this method will return false.
isNextTokenByReference ( ) : boolean Tests that the next available token is the returns by reference token.
isNextTokenFormalParameterList ( ) : boolean Tests that the next available token is an opening parenthesis.
isReadWriteVariable ( PDepend\Source\AST\ASTNode $expr ) : boolean Checks if the given expression is a read/write variable as defined in the PHP zend_language_parser.y definition.
parseAllocationExpression ( ) : PDepend\Source\AST\ASTAllocationExpression Parses an allocation expression.
parseAlternativeScope ( ) : PDepend\Source\AST\ASTScopeStatement Parses the scope of a statement that is surrounded with PHP's alternative syntax for statements.
parseAlternativeScopeTermination ( integer $tokenType ) : void Parses a series of tokens that represent an alternative scope termination.
parseArrayIndexExpression ( PDepend\Source\AST\ASTNode $node ) : PDepend\Source\AST\ASTArrayIndexExpression Parses a mandatory array index expression.
parseBoundVariables ( PDepend\Source\AST\ASTClosure $closure ) : PDepend\Source\AST\ASTClosure Parses a list of bound closure variables.
parseBraceExpression ( PDepend\Source\AST\ASTNode $node, PDepend\Source\Tokenizer\Token $start, integer $closeToken ) : PDepend\Source\AST\ASTNode This method parses a brace expression and adds all parsed node instances to the given {@link \PDepend\Source\AST\ASTNode} object. Finally it returns the prepared input node.
parseBreakStatement ( ) : PDepend\Source\AST\ASTBreakStatement This method parses a break-statement node.
parseByReference ( ) : boolean This method parses a returns by reference token and returns true.
parseCallableDeclaration ( PDepend\Source\AST\AbstractASTCallable $callable ) : void Parses a function or a method and adds it to the parent context node.
parseCatchStatement ( ) : PDepend\Source\AST\ASTCatchStatement This method parses a catch-statement.
parseClassModifiers ( ) : void This method parses an optional class modifier. Valid class modifiers are final or abstract.
parseClassOrInterfaceReference ( boolean $classReference ) : PDepend\Source\AST\ASTClassOrInterfaceReference Parses a class or interface reference node.
parseCloneExpression ( ) : PDepend\Source\AST\ASTCloneExpression Parses a clone-expression node.
parseClosureDeclaration ( ) : PDepend\Source\AST\ASTClosure This method parses a PHP 5.3 closure or lambda function.
parseCommentWithOptionalInlineClassOrInterfaceReference ( ) : PDepend\Source\AST\ASTComment Parses a comment and optionally an embedded class or interface type annotation.
parseCompoundExpressionOrLiteral ( ) : PDepend\Source\AST\ASTNode This method parses a compound expression like:
parseCompoundVariable ( PDepend\Source\Tokenizer\Token $token ) : PDepend\Source\AST\ASTCompoundVariable This method parses a compound variable like:
parseCompoundVariableOrLiteral ( ) : PDepend\Source\AST\ASTNode Parses a PHP compound variable or a simple literal node.
parseCompoundVariableOrVariableVariable ( ) : PDepend\Source\AST\ASTNode This method implements a decision point between compound-variables and variable-variable. It expects that the next token in the token-stream is of type T_DOLLAR and removes it from the stream. Then this method peeks the next available token when it is of type T_CURLY_BRACE_OPEN this is compound variable, otherwise it can be a variable-variable or a compound-variable.
parseConstantDefinition ( ) : PDepend\Source\AST\ASTConstantDefinition Parses a single constant definition with one or more constant declarators.
parseConstantOrParentMemberPrimaryPrefix ( ) : PDepend\Source\AST\ASTNode This method parses a {@link \PDepend\Source\AST\ASTConstant} node or an instance of {@link \PDepend\Source\AST\ASTParentReference} as part of a {@link \PDepend\Source\AST\ASTMemberPrimaryPrefix} that contains the parent reference as its first child when the self token is followed by a double colon token.
parseConstantOrSelfMemberPrimaryPrefix ( ) : PDepend\Source\AST\ASTNode This method parses a {@link \PDepend\Source\AST\ASTConstant} node or an instance of {@link \PDepend\Source\AST\ASTSelfReference} as part of a {@link \PDepend\Source\AST\ASTMemberPrimaryPrefix} that contains the self reference as its first child when the self token is followed by a double colon token.
parseContinueStatement ( ) : PDepend\Source\AST\ASTContinueStatement This method parses a continue-statement node.
parseDeclareList ( PDepend\Source\AST\ASTDeclareStatement $stmt ) : PDepend\Source\AST\ASTDeclareStatement This method parses a list of declare values. A declare list value always consists of a string token and a static scalar.
parseDeclareStatement ( ) : PDepend\Source\AST\ASTDeclareStatement This method parses a declare-statement.
parseDecrementExpression ( array &$expressions ) : PDepend\Source\AST\ASTExpression This method will parse an decrement-expression. Depending on the previous node this can be a {@link \PDepend\Source\AST\ASTPostDecrementExpression} or {@link \PDepend\Source\AST\ASTPostfixExpression}.
parseDoWhileStatement ( ) : PDepend\Source\AST\ASTDoWhileStatement This method parses a do/while-statement.
parseEchoStatement ( ) : PDepend\Source\AST\ASTEchoStatement This method parses a echo-statement node.
parseElseIfStatement ( ) : PDepend\Source\AST\ASTElseIfStatement This method parses a single elseif-statement node.
parseEscapedAstLiteralString ( ) : PDepend\Source\AST\ASTLiteral This method parses an escaped sequence of literal tokens.
parseEvalExpression ( ) : PDepend\Source\AST\ASTEvalExpression Parses a eval-expression node.
parseExitExpression ( ) : PDepend\Source\AST\ASTExitExpression This method parses an exit-expression.
parseExpression ( ) : PDepend\Source\AST\ASTNode This method parses an expression node and returns it. When no expression was found this method will throw an InvalidStateException.
parseExpressionList ( PDepend\Source\AST\ASTNode $exprList ) : PDepend\Source\AST\ASTNode This method parses multiple expressions and adds them as children to the given $exprList node.
parseFieldDeclaration ( ) : PDepend\Source\AST\ASTFieldDeclaration This method will parse a class field declaration with all it's variables.
parseFieldDeclarationClassOrInterfaceReference ( ) : PDepend\Source\AST\ASTClassOrInterfaceReference Extracts non scalar types from a field doc comment and creates a matching type instance.
parseFieldDeclarationType ( ) : PDepend\Source\AST\ASTType This method will extract the type information of a property from it's doc comment information. The returned value will be null when no type information exists.
parseFinallyStatement ( ) : PDepend\Source\AST\ASTFinallyStatement This method parses a finally-statement.
parseForExpression ( ) : PDepend\Source\AST\ASTExpression Parses the expression part of a for-statement.
parseForInit ( ) : PDepend\Source\AST\ASTForInit Parses the init part of a for-statement.
parseForStatement ( ) : PDepend\Source\AST\ASTForStatement This method parses a single for-statement node.
parseForUpdate ( ) : PDepend\Source\AST\ASTForUpdate Parses the update part of a for-statement.
parseForeachStatement ( ) : PDepend\Source\AST\ASTForeachStatement This method parses a single foreach-statement node.
parseFormalParameterAndArrayTypeHint ( ) : PDepend\Source\AST\ASTFormalParameter This method parses a formal parameter that has an array type hint.
parseFormalParameterAndByReference ( ) : PDepend\Source\AST\ASTFormalParameter This method will parse a formal parameter that is passed by reference.
parseFormalParameterAndParentTypeHint ( ) : PDepend\Source\AST\ASTFormalParameter This method will parse a formal parameter that has the keyword parent as parameter type hint.
parseFormalParameterAndSelfTypeHint ( ) : PDepend\Source\AST\ASTFormalParameter This method will parse a formal parameter that has the keyword self as parameter type hint.
parseFormalParameterAndTypeHint ( ) : PDepend\Source\AST\ASTFormalParameter This method parses a formal parameter that has a regular class type hint.
parseFormalParameterOrTypeHintOrByReference ( ) : PDepend\Source\AST\ASTFormalParameter This method parses a formal parameter in all it's variations.
parseFormalParameters ( ) : PDepend\Source\AST\ASTFormalParameters Extracts all dependencies from a callable signature.
parseFullQualifiedClassNamePostfix ( ) : PDepend\Source\AST\ASTClassFqnPostfix Parses a full qualified class name postfix.
parseFunctionDeclaration ( ) : PDepend\Source\AST\ASTFunction This method parses a function declaration.
parseFunctionOrClosureDeclaration ( ) : PDepend\Source\AST\AbstractASTCallable This method parses a simple function or a PHP 5.3 lambda function or closure.
parseFunctionPostfix ( PDepend\Source\AST\ASTNode $node ) : PDepend\Source\AST\ASTNode This method parses a function postfix expression. An object of type {@link \PDepend\Source\AST\ASTFunctionPostfix} represents any valid php function call.
parseGlobalStatement ( ) : PDepend\Source\AST\ASTGlobalStatement This method parses a global-statement.
parseGotoStatement ( ) : PDepend\Source\AST\ASTGotoStatement This method parses a goto-statement.
parseIfStatement ( ) : PDepend\Source\AST\ASTIfStatement This method parses a single if-statement node.
parseIncludeExpression ( ) : PDepend\Source\AST\ASTIncludeExpression Parses a include-expression node.
parseIncludeOnceExpression ( ) : PDepend\Source\AST\ASTIncludeExpression Parses a include_once-expression node.
parseIncrementExpression ( array &$expressions ) : PDepend\Source\AST\ASTExpression This method will parse an increment-expression. Depending on the previous node this can be a {@link \PDepend\Source\AST\ASTPostIncrementExpression} or {@link \PDepend\Source\AST\ASTPostfixExpression}.
parseIndexExpression ( PDepend\Source\AST\ASTNode $node, PDepend\Source\AST\ASTExpression $expr, integer $open, integer $close ) : PDepend\Source\AST\ASTNode Parses an index expression as it is valid to access elements in a php string or array.
parseInstanceOfExpression ( ) : PDepend\Source\AST\ASTInstanceOfExpression This method parse an instance of expression with its associated class or interface reference.
parseInterfaceDeclaration ( ) : PDepend\Source\AST\ASTInterface Parses the dependencies in a interface signature.
parseInterfaceSignature ( ) : PDepend\Source\AST\ASTInterface Parses the signature of an interface and finally returns a configured interface instance.
parseIssetExpression ( ) : PDepend\Source\AST\ASTIssetExpression Parses an isset-expression node.
parseLabelStatement ( ) : PDepend\Source\AST\ASTLabelStatement This method parses a label-statement.
parseListExpression ( ) : PDepend\Source\AST\ASTListExpression This method parses a single list-statement node.
parseMemberPrefixOrFunctionPostfix ( ) : PDepend\Source\AST\ASTNode This method parses a member primary prefix expression or a function postfix expression node.
parseMemberPrimaryPrefix ( PDepend\Source\AST\ASTNode $node ) : PDepend\Source\AST\ASTMemberPrimaryPrefix This method parses a dynamic or object bound member primary expression.
parseMethodDeclaration ( ) : PDepend\Source\AST\ASTMethod This method parses a method declaration.
parseMethodOrConstantPostfix ( ) : PDepend\Source\AST\ASTNode This method parses a method- or constant-postfix expression. This expression will contain an identifier node as nested child.
parseMethodOrFieldDeclaration ( integer $modifiers ) : PDepend\Source\AST\ASTMethod | PDepend\Source\AST\ASTFieldDeclaration This method will parse a list of modifiers and a following property or method.
parseMethodOrPropertyPostfix ( PDepend\Source\AST\ASTNode $node ) : PDepend\Source\AST\ASTNode This method parses a method- or property-postfix expression. This expression will contain the given node as method or property identifier.
parseMethodPostfix ( PDepend\Source\AST\ASTNode $node ) : PDepend\Source\AST\ASTMethodPostfix Parses a method postfix node instance.
parseNamespaceDeclaration ( ) : void This method parses a PHP 5.3 namespace declaration.
parseNonePhpCode ( ) : integer Parses a sequence of none php code tokens and returns the token type of the next token.
parseOptionalAlternativeScopeTermination ( ) : void Parses the termination of a scope statement that uses PHP's laternative syntax format.
parseOptionalBoundVariables ( PDepend\Source\AST\ASTClosure $closure ) : PDepend\Source\AST\ASTClosure Parses an optional set of bound closure variables.
parseOptionalByReference ( ) : boolean Parses an optional by reference token. The return value will be true when a reference token was found, otherwise this method will return false.
parseOptionalElseOrElseIfStatement ( PDepend\Source\AST\ASTStatement $stmt ) : PDepend\Source\AST\ASTStatement This method parses an optional else-, else+if- or elseif-statement.
parseOptionalExtendsList ( PDepend\Source\AST\ASTInterface $interface ) : PDepend\Source\AST\ASTInterface Parses an optional interface list of an interface declaration.
parseOptionalFunctionPostfix ( PDepend\Source\AST\ASTNode $node ) : PDepend\Source\AST\ASTNode This method will parse an optional function postfix.
parseOptionalMemberPrimaryPrefix ( PDepend\Source\AST\ASTNode $node ) : PDepend\Source\AST\ASTNode This method parses an optional member primary expression. It will parse the primary expression when an object operator can be found at the actual token stream position. Otherwise this method simply returns the input {@link \PDepend\Source\AST\ASTNode} instance.
parseOptionalStatement ( ) : PDepend\Source\AST\ASTNode Parses an optional statement or returns null.
parseOptionalStaticMemberPrimaryPrefix ( PDepend\Source\AST\ASTNode $node ) : PDepend\Source\AST\ASTNode This method parses an optional member primary expression. It will parse the primary expression when a double colon operator can be found at the actual token stream position. Otherwise this method simply returns the input {@link \PDepend\Source\AST\ASTNode} instance.
parseOptionalTraitAdaptation ( PDepend\Source\AST\ASTTraitUseStatement $useStatement ) : PDepend\Source\AST\ASTTraitUseStatement Parses the adaptation list of the given use statement or simply reads the terminating semicolon, when no adaptation list exists.
parsePackageAnnotation ( string $comment ) : string Extracts the @package information from the given comment.
parseParentReference ( PDepend\Source\Tokenizer\Token $token ) : PDepend\Source\AST\ASTNode This method parses a {@link \PDepend\Source\AST\ASTParentReference} node.
parseParenthesisExpression ( ) : PDepend\Source\AST\ASTExpression Parses any expression that is surrounded by an opening and a closing parenthesis
parsePostDecrementExpression ( PDepend\Source\AST\ASTNode $child ) : PDepend\Source\AST\ASTPostfixExpression Parses a post decrement-expression and adds the given child to that node.
parsePostIncrementExpression ( PDepend\Source\AST\ASTNode $child ) : PDepend\Source\AST\ASTPostfixExpression Parses a post increment-expression and adds the given child to that node.
parsePreDecrementExpression ( ) : PDepend\Source\AST\ASTPreDecrementExpression Parses a pre decrement-expression and adds the given child to that node.
parsePreIncrementExpression ( ) : PDepend\Source\AST\ASTPreIncrementExpression Parses a pre increment-expression and adds the given child to that node.
parsePropertyPostfix ( PDepend\Source\AST\ASTNode $node ) : PDepend\Source\AST\ASTPropertyPostfix Parses/Creates a property postfix node instance.
parseQualifiedNameRaw ( ) : array(string) This method parses a qualified PHP 5.3 class, interface and namespace identifier and returns the collected tokens as a string array.
parseRegularScope ( ) : PDepend\Source\AST\ASTScope Parse a scope enclosed by curly braces.
parseRequireExpression ( ) : PDepend\Source\AST\ASTRequireExpression Parses a require-expression node.
parseRequireOnceExpression ( ) : PDepend\Source\AST\ASTRequireExpression Parses a require_once-expression node.
parseRequireOrIncludeExpression ( PDepend\Source\AST\ASTExpression $expr, integer $type ) : PDepend\Source\AST\ASTExpression Parses a require_once-, require-, include_once- or include-expression node.
parseReturnAnnotation ( string $comment ) : string This method parses the given doc comment text for a return annotation and it returns the found return type.
parseReturnStatement ( ) : PDepend\Source\AST\ASTReturnStatement This method parses a single return-statement node.
parseScope ( ) : PDepend\Source\AST\ASTScope Extracts all dependencies from a callable body.
parseScopeStatements ( ) : PDepend\Source\AST\ASTScopeStatement Parses all statements that exist in a scope an adds them to a scope instance.
parseStatement ( ) : PDepend\Source\AST\ASTNode Parse a statement.
parseStatementBody ( PDepend\Source\AST\ASTStatement $stmt ) : PDepend\Source\AST\ASTStatement Parses the body of the given statement instance and adds all parsed nodes to that statement.
parseStatementTermination ( ) : void Parses the termination token for a statement. This termination token can be a semicolon or a closing php tag.
parseStaticMemberPrimaryPrefix ( PDepend\Source\AST\ASTNode $node ) : PDepend\Source\AST\ASTMemberPrimaryPrefix This method parses a static member primary expression. The given node contains the used static class or interface identifier. A static member primary prefix can represent the following code expressions:
parseStaticReference ( PDepend\Source\Tokenizer\Token $token ) : PDepend\Source\AST\ASTStaticReference This method parses a {@link \PDepend\Source\AST\ASTStaticReference} node.
parseStaticVariableDeclaration ( PDepend\Source\Tokenizer\Token $token ) : PDepend\Source\AST\ASTStaticVariableDeclaration This method will parse a static variable declaration.
parseStaticVariableDeclarationOrMemberPrimaryPrefix ( ) : PDepend\Source\AST\ASTConstant This method parses a static variable declaration list, a member primary prefix invoked in the static context of a class or it parses a static closure declaration.
parseString ( integer $delimiterType ) : PDepend\Source\AST\ASTString This method parses a php string with all possible embedded expressions.
parseStringExpressions ( PDepend\Source\AST\ASTNode $node, integer $stopToken ) : PDepend\Source\AST\ASTNode This method parses the contents of a string or here-/now-doc node. It will not consume the given stop token, so it is up to the calling method to consume the stop token. The return value of this method is the prepared input string node.
parseStringIndexExpression ( PDepend\Source\AST\ASTNode $node ) : PDepend\Source\AST\ASTStringIndexExpression Parses a mandatory array index expression.
parseStringSequence ( integer $tokenType ) : string Parses a simple string sequence between two tokens of the same type.
parseSwitchLabel ( ) : PDepend\Source\AST\ASTSwitchLabel This method parses a case label of a switch statement.
parseSwitchLabelBody ( PDepend\Source\AST\ASTSwitchLabel $label ) : PDepend\Source\AST\ASTSwitchLabel Parses the body of an switch label node.
parseSwitchLabelDefault ( ) : PDepend\Source\AST\ASTSwitchLabel This method parses the default label of a switch statement.
parseSwitchStatement ( ) : PDepend\Source\AST\ASTSwitchStatement This method parses a switch statement.
parseSwitchStatementBody ( PDepend\Source\AST\ASTSwitchStatement $switch ) : PDepend\Source\AST\ASTSwitchStatement Parses the body of a switch statement.
parseThrowStatement ( ) : PDepend\Source\AST\ASTThrowStatement This method parses a throw-statement.
parseThrowsAnnotations ( string $comment ) : array Returns the class names of all throws annotations with in the given comment block.
parseTraitAdaptation ( ) : PDepend\Source\AST\ASTTraitAdaptation Parses the adaptation expression of a trait use statement.
parseTraitAdaptationAliasStatement ( array $reference ) : PDepend\Source\AST\ASTTraitAdaptationAlias Parses a trait adaptation alias statement.
parseTraitAdaptationPrecedenceStatement ( array $reference ) : PDepend\Source\AST\ASTTraitAdaptationPrecedence Parses a trait adaptation precedence statement.
parseTraitDeclaration ( ) : PDepend\Source\AST\ASTTrait Parses a trait declaration.
parseTraitMethodReference ( ) : array Parses a trait method reference and returns the found reference as an array.
parseTraitReference ( ) : PDepend\Source\AST\ASTTraitReference Parses a trait reference instance.
parseTraitSignature ( ) : PDepend\Source\AST\ASTTrait Parses the signature of a trait.
parseTraitUseStatement ( ) : PDepend\Source\AST\ASTTraitUseStatement Parses a trait use statement.
parseTryStatement ( ) : PDepend\Source\AST\ASTTryStatement This method parses a try-statement + associated catch-statements.
parseUnsetStatement ( ) : PDepend\Source\AST\ASTUnsetStatement This method parses a unset-statement.
parseVarAnnotation ( string $comment ) : array(string) This method parses the given doc comment text for a var annotation and it returns the found property types.
parseVariable ( ) : PDepend\Source\AST\ASTVariable This method parses a simple PHP variable.
parseVariableList ( PDepend\Source\AST\ASTNode $node ) : PDepend\Source\AST\ASTNode This method parses a comma separated list of valid php variables and/or properties and adds them to the given node instance.
parseVariableOrFunctionPostfixOrMemberPrimaryPrefix ( ) : PDepend\Source\AST\ASTNode This method parses any type of variable, function postfix expressions or any kind of member primary prefix.
parseVariableOrMemberByReference ( ) : PDepend\Source\AST\ASTUnaryExpression Parses a variable or any other valid member expression that is prefixed with PHP's reference operator.
parseVariableOrMemberOptionalByReference ( ) : PDepend\Source\AST\ASTUnaryExpression Parses a variable or any other valid member expression that is optionally prefixed with PHP's reference operator.
parseWhileStatement ( ) : PDepend\Source\AST\ASTWhileStatement This method parses a single while-statement node.
parseYield ( ) : PDepend\Source\AST\ASTYieldStatmenet This method parses a yield-statement node.
prepareCallable ( PDepend\Source\AST\AbstractASTCallable $callable ) : void Extracts documented throws and return types and sets them to the given $callable instance.
reduceUnaryExpression ( array $expressions ) : PDepend\Source\AST\ASTExpression[] Reduces all unary-expressions in the given expression list.
stripTrailingComments ( array $tokens ) : PDepend\Source\Tokenizer\Token[] Strips all trailing comments from the given token stream.

Method Details

__construct() public method

Constructs a new source parser.
public __construct ( PDepend\Source\Tokenizer\Tokenizer $tokenizer, PDepend\Source\Builder\Builder $builder, PDepend\Util\Cache\CacheDriver $cache )
$tokenizer PDepend\Source\Tokenizer\Tokenizer
$builder PDepend\Source\Builder\Builder
$cache PDepend\Util\Cache\CacheDriver

consumeComments() protected method

This method will consume all comment tokens from the token stream.
protected consumeComments ( ) : void
return void

consumeToken() protected method

This method will consume the next token in the token stream. It will throw an exception if the type of this token is not identical with $tokenType.
protected consumeToken ( integer $tokenType ) : PDepend\Source\Tokenizer\Token
$tokenType integer The next expected token type.
return PDepend\Source\Tokenizer\Token

doParseArray() protected method

Parses an array structure.
Since: 1.0.0
protected doParseArray ( $static = false ) : PDepend\Source\AST\ASTArray
return PDepend\Source\AST\ASTArray

getMaxNestingLevel() protected method

Returns the maximum allowed nesting/recursion level.
Since: 0.9.12
protected getMaxNestingLevel ( ) : integer
return integer

isArrayStartDelimiter() abstract protected method

Tests if the next token is a valid array start delimiter in the supported PHP version.
Since: 1.0.0
abstract protected isArrayStartDelimiter ( ) : boolean
return boolean

isClassName() protected method

Will return true if the given $tokenType is a valid class name part.
Since: 0.10.6
protected isClassName ( integer $tokenType ) : boolean
$tokenType integer
return boolean

isFileComment() protected method

This method checks that the previous token is an open tag and the following token is not a class, a interface, final, abstract or a function.
protected isFileComment ( ) : boolean
return boolean

isFunctionName() protected method

Tests if the give token is a valid function name in the supported PHP version.
Since: 2.3
protected isFunctionName ( integer $tokenType ) : boolean
$tokenType integer
return boolean

isKeyword() abstract protected method

Tests if the given token type is a reserved keyword in the supported PHP version.
Since: 1.1.1
abstract protected isKeyword ( $tokenType ) : boolean
$tokenType
return boolean

isMethodName() protected method

protected isMethodName ( integer $tokenType ) : boolean
$tokenType integer
return boolean

isNextTokenArguments() protected method

This method checks if the next available token starts an arguments node.
Since: 0.9.8
protected isNextTokenArguments ( ) : boolean
return boolean

isTypeHint() protected method

Tests if the given token type is a valid formal parameter in the supported PHP version.
Since: 1.0.0
protected isTypeHint ( integer $tokenType ) : boolean
$tokenType integer
return boolean

parse() public method

Parses the contents of the tokenizer and generates a node tree based on the found tokens.
public parse ( ) : void
return void

parseAllocationExpressionTypeReference() protected method

Parse the type reference used in an allocation expression.
Since: 2.3
protected parseAllocationExpressionTypeReference ( PDepend\Source\AST\ASTAllocationExpression $allocation ) : PDepend\Source\AST\ASTNode
$allocation PDepend\Source\AST\ASTAllocationExpression
return PDepend\Source\AST\ASTNode

parseArguments() protected method

This method parses the arguments passed to a function- or method-call.
Since: 0.9.6
protected parseArguments ( ) : PDepend\Source\AST\ASTArguments
return PDepend\Source\AST\ASTArguments

parseArray() abstract protected method

Parses a php array declaration.
Since: 1.0.0
abstract protected parseArray ( PDepend\Source\AST\ASTArray $array, boolean $static = false ) : PDepend\Source\AST\ASTArray
$array PDepend\Source\AST\ASTArray
$static boolean
return PDepend\Source\AST\ASTArray

parseArrayElement() protected method

An array element can have a simple value, a key/value pair, a value by reference or a key/value pair with a referenced value.
Since: 1.0.0
protected parseArrayElement ( boolean $static = false ) : PDepend\Source\AST\ASTArrayElement
$static boolean
return PDepend\Source\AST\ASTArrayElement

parseArrayElements() protected method

Parses all elements in an array.
Since: 1.0.0
protected parseArrayElements ( PDepend\Source\AST\ASTArray $array, integer $endDelimiter, boolean $static = false ) : PDepend\Source\AST\ASTArray
$array PDepend\Source\AST\ASTArray
$endDelimiter integer
$static boolean
return PDepend\Source\AST\ASTArray

parseArrayType() protected method

protected parseArrayType ( ) : PDepend\Source\AST\ASTTypeArray
return PDepend\Source\AST\ASTTypeArray

parseAssignmentExpression() protected method

Parses an assingment expression node.
Since: 0.9.12
protected parseAssignmentExpression ( PDepend\Source\AST\ASTNode $left ) : PDepend\Source\AST\ASTAssignmentExpression
$left PDepend\Source\AST\ASTNode The left part of the assignment expression that will be parsed by this method.
return PDepend\Source\AST\ASTAssignmentExpression

parseBooleanAndExpression() protected method

This method parses a boolean and-expression.
Since: 0.9.8
protected parseBooleanAndExpression ( ) : PDepend\Source\AST\ASTBooleanAndExpression
return PDepend\Source\AST\ASTBooleanAndExpression

parseBooleanOrExpression() protected method

This method parses a boolean or-expression.
Since: 0.9.8
protected parseBooleanOrExpression ( ) : PDepend\Source\AST\ASTBooleanOrExpression
return PDepend\Source\AST\ASTBooleanOrExpression

parseCallableDeclarationAddition() protected method

Extension for version specific additions.
protected parseCallableDeclarationAddition ( PDepend\Source\AST\AbstractASTCallable $callable ) : PDepend\Source\AST\AbstractASTCallable
$callable PDepend\Source\AST\AbstractASTCallable
return PDepend\Source\AST\AbstractASTCallable

parseCastExpression() protected method

Parses a cast-expression node.
Since: 0.10.0
protected parseCastExpression ( ) : PDepend\Source\AST\ASTCaseExpression
return PDepend\Source\AST\ASTCaseExpression

parseClassDeclaration() protected method

Parses the dependencies in a class signature.
protected parseClassDeclaration ( ) : PDepend\Source\AST\ASTClass
return PDepend\Source\AST\ASTClass

parseClassExtends() protected method

Parses a parent class declaration for the given $class.
Since: 1.0.0
protected parseClassExtends ( PDepend\Source\AST\ASTClass $class ) : PDepend\Source\AST\ASTClass
$class PDepend\Source\AST\ASTClass
return PDepend\Source\AST\ASTClass

parseClassName() protected method

Parses a valid class or interface name and returns the image of the parsed token.
protected parseClassName ( ) : string
return string

parseClassSignature() protected method

The signature of a class consists of optional class modifiers like, final or abstract, the T_CLASS token, the class name, an optional parent class and an optional list of implemented interfaces.
Since: 1.0.0
protected parseClassSignature ( ) : PDepend\Source\AST\ASTClass
return PDepend\Source\AST\ASTClass

parseCompoundExpression() protected method

------------------ {'_' . foo . $bar} ------------------
Since: 0.9.6
protected parseCompoundExpression ( ) : PDepend\Source\AST\ASTCompoundExpression
return PDepend\Source\AST\ASTCompoundExpression

parseCompoundVariableOrVariableVariableOrVariable() protected method

---- $foo; ---- ----- $$foo; ----- ------ ${FOO}; ------
Since: 0.9.6
protected parseCompoundVariableOrVariableVariableOrVariable ( ) : PDepend\Source\AST\ASTNode
return PDepend\Source\AST\ASTNode

parseConditionalExpression() protected method

-------------- $foo = ($bar ? 42 : 23); --------------
Since: 0.9.8
protected parseConditionalExpression ( ) : PDepend\Source\AST\ASTConditionalExpression
return PDepend\Source\AST\ASTConditionalExpression

parseConstant() protected method

Parses a simple PHP constant use and returns a corresponding node.
Since: 1.0.0
protected parseConstant ( ) : PDepend\Source\AST\ASTNode
return PDepend\Source\AST\ASTNode

parseConstantDeclarator() protected method

class Foo { -------- const BAR = 42; -------- } Or in a comma separated constant defintion: class Foo { -------- const BAR = 42, -------- -------------- const BAZ = 'Foobar', -------------- ---------- const FOO = 3.14; ---------- }
Since: 0.9.6
protected parseConstantDeclarator ( ) : PDepend\Source\AST\ASTConstantDeclarator
return PDepend\Source\AST\ASTConstantDeclarator

parseConstantDeclaratorValue() protected method

Parses the value of a php constant. By default this can be only static values that were allowed in the oldest supported PHP version.
Since: 2.2.x
protected parseConstantDeclaratorValue ( ) : PDepend\Source\AST\ASTValue
return PDepend\Source\AST\ASTValue

parseExpressionTypeReference() protected method

This method parses a type identifier as it is used in expression nodes like {@link \PDepend\Source\AST\ASTInstanceOfExpression} or an object allocation node like {@link \PDepend\Source\AST\ASTAllocationExpression}.
protected parseExpressionTypeReference ( PDepend\Source\AST\ASTNode $expr, boolean $classRef ) : PDepend\Source\AST\ASTNode
$expr PDepend\Source\AST\ASTNode
$classRef boolean
return PDepend\Source\AST\ASTNode

parseFormalParameter() protected method

-- ------- function foo(Bar $x, $y = 42) } -- -------
Since: 0.9.6
protected parseFormalParameter ( ) : PDepend\Source\AST\ASTFormalParameter
return PDepend\Source\AST\ASTFormalParameter

parseFormalParameterOrByReference() protected method

--- ------- function foo(array &$x, $y = 42) } --- -------
Since: 0.9.6
protected parseFormalParameterOrByReference ( ) : PDepend\Source\AST\ASTFormalParameter
return PDepend\Source\AST\ASTFormalParameter

parseFunctionName() protected method

Parses a function name from the given tokenizer and returns the string literal representing the function name. If no valid token exists in the token stream, this method will throw an exception.
Since: 0.10.0
protected parseFunctionName ( ) : string
return string

parseHeredoc() protected method

Parses a here- or nowdoc string instance.
Since: 0.9.12
protected parseHeredoc ( ) : PDepend\Source\AST\ASTHeredoc
return PDepend\Source\AST\ASTHeredoc

parseIdentifier() protected method

Parses a static identifier expression, as it is used for method and function names.
Since: 0.9.12
protected parseIdentifier ( ) : PDepend\Source\AST\ASTIdentifier
return PDepend\Source\AST\ASTIdentifier

parseIntegerNumber() protected method

Parses an integer value.
Since: 1.0.0
protected parseIntegerNumber ( ) : PDepend\Source\AST\ASTLiteral
return PDepend\Source\AST\ASTLiteral

parseInterfaceList() protected method

This method parses a list of interface names as used in the extends part of a interface declaration or in the implements part of a class declaration.
protected parseInterfaceList ( PDepend\Source\AST\AbstractASTClassOrInterface $abstractType ) : void
$abstractType PDepend\Source\AST\AbstractASTClassOrInterface
return void

parseLiteral() protected method

This method parses a simple literal and configures the position properties.
Since: 0.9.10
protected parseLiteral ( ) : PDepend\Source\AST\ASTLiteral
return PDepend\Source\AST\ASTLiteral

parseLiteralOrString() protected method

This method parses a {@link \PDepend\Source\AST\ASTLiteral} node or an instance of {@link \PDepend\Source\AST\ASTString} that represents a string in double quotes or surrounded by backticks.
protected parseLiteralOrString ( ) : PDepend\Source\AST\ASTNode
return PDepend\Source\AST\ASTNode

parseLogicalAndExpression() protected method

This method parses a logical and-expression.
Since: 0.9.8
protected parseLogicalAndExpression ( ) : PDepend\Source\AST\ASTLogicalAndExpression
return PDepend\Source\AST\ASTLogicalAndExpression

parseLogicalOrExpression() protected method

This method parses a logical or-expression.
Since: 0.9.8
protected parseLogicalOrExpression ( ) : PDepend\Source\AST\ASTLogicalOrExpression
return PDepend\Source\AST\ASTLogicalOrExpression

parseLogicalXorExpression() protected method

This method parses a logical xor-expression.
Since: 0.9.8
protected parseLogicalXorExpression ( ) : PDepend\Source\AST\ASTLogicalXorExpression
return PDepend\Source\AST\ASTLogicalXorExpression

parseMethodName() protected method

protected parseMethodName ( ) : string
return string

parseOptionalExpression() protected method

This method optionally parses an expression node and returns it. When no expression was found this method will return null.
Since: 0.9.6
protected parseOptionalExpression ( ) : PDepend\Source\AST\ASTNode
return PDepend\Source\AST\ASTNode

parseOptionalExpressionForVersion() protected method

This method will be called when the base parser cannot handle an expression in the base version. In this method you can implement version specific expressions.
Since: 2.2
protected parseOptionalExpressionForVersion ( ) : PDepend\Source\AST\ASTNode
return PDepend\Source\AST\ASTNode

parseOptionalIndexExpression() protected method

--------- $array[0]; --------- ---------------- $array[1]['foo']; ---------------- ---------------- $string{1}[0]{0}; ----------------
Since: 0.9.12
protected parseOptionalIndexExpression ( PDepend\Source\AST\ASTNode $node ) : PDepend\Source\AST\ASTNode
$node PDepend\Source\AST\ASTNode The parent/context node instance.
return PDepend\Source\AST\ASTNode

parseParentType() protected method

protected parseParentType ( ) : PDepend\Source\AST\ASTParentReference
return PDepend\Source\AST\ASTParentReference

parseParenthesisExpressionOrPrimaryPrefix() protected method

(new MyClass())->bar();
Since: 1.0.0
protected parseParenthesisExpressionOrPrimaryPrefix ( ) : PDepend\Source\AST\ASTNode
return PDepend\Source\AST\ASTNode

parsePostfixIdentifier() protected method

This method parses a PHP version specific identifier for method and property postfix expressions.
Since: 1.0.0
protected parsePostfixIdentifier ( ) : PDepend\Source\AST\ASTNode
return PDepend\Source\AST\ASTNode

parseQualifiedName() protected method

PDepend\Source\Parser::parse();
protected parseQualifiedName ( ) : string
return string

parseSelfReference() protected method

This method parses a {@link \PDepend\Source\AST\ASTSelfReference} node.
Since: 0.9.6
protected parseSelfReference ( PDepend\Source\Tokenizer\Token $token ) : PDepend\Source\AST\ASTSelfReference
$token PDepend\Source\Tokenizer\Token The "self" keyword token.
return PDepend\Source\AST\ASTSelfReference

parseSelfType() protected method

protected parseSelfType ( ) : PDepend\Source\AST\ASTSelfReference
return PDepend\Source\AST\ASTSelfReference

parseShiftLeftExpression() protected method

This method parses a shift left expression node.
Since: 1.0.1
protected parseShiftLeftExpression ( ) : PDepend\Source\AST\ASTShiftLeftExpression
return PDepend\Source\AST\ASTShiftLeftExpression

parseShiftRightExpression() protected method

This method parses a shift right expression node.
Since: 1.0.1
protected parseShiftRightExpression ( ) : PDepend\Source\AST\ASTShiftRightExpression
return PDepend\Source\AST\ASTShiftRightExpression

parseStaticValue() protected method

This method will parse a static default value as it is used for a parameter, property or constant declaration.
Since: 0.9.5
protected parseStaticValue ( ) : PDepend\Source\AST\ASTValue
return PDepend\Source\AST\ASTValue

parseStaticValueOrStaticArray() protected method

This method will parse a static value or a static array as it is used as default value for a parameter or property declaration.
Since: 0.9.6
protected parseStaticValueOrStaticArray ( ) : PDepend\Source\AST\ASTValue
return PDepend\Source\AST\ASTValue

parseStaticValueVersionSpecific() protected method

Parses additional static values that are valid in the supported php version.
protected parseStaticValueVersionSpecific ( PDepend\Source\AST\ASTValue $value ) : PDepend\Source\AST\ASTValue
$value PDepend\Source\AST\ASTValue
return PDepend\Source\AST\ASTValue

parseTypeBody() protected method

Parses a class/interface/trait body.
protected parseTypeBody ( AbstractASTType $type ) : AbstractASTType
$type PDepend\Source\AST\AbstractASTType
return PDepend\Source\AST\AbstractASTType

parseTypeHint() protected method

Parses a type hint that is valid in the supported PHP version.
Since: 1.0.0
protected parseTypeHint ( ) : PDepend\Source\AST\ASTNode
return PDepend\Source\AST\ASTNode

parseUseDeclaration() protected method

This method parses a single use declaration and adds a mapping between short name and full qualified name to the use symbol table.
Since: 0.9.5
protected parseUseDeclaration ( ) : void
return void

parseUseDeclarations() protected method

use \foo\bar as fb, \foobar\Bar;
Since: 0.9.5
protected parseUseDeclarations ( ) : void
return void

parseVariableDeclarator() protected method

Parameter declarator function foo($x = 23) { } Property declarator class Foo{ protected $bar = 42; } Static declarator function baz() { static $foo; }
Since: 0.9.6
protected parseVariableDeclarator ( ) : PDepend\Source\AST\ASTVariableDeclarator
return PDepend\Source\AST\ASTVariableDeclarator

parseVariableOrConstantOrPrimaryPrefix() protected method

This method implements the parsing for various expression types like variables, object/static method. All these expressions are valid in several php language constructs like, isset, empty, unset etc.
Since: 0.9.12
protected parseVariableOrConstantOrPrimaryPrefix ( ) : PDepend\Source\AST\ASTNode
return PDepend\Source\AST\ASTNode

reduce() protected method

Applies all reduce rules against the given expression list.
Since: 0.10.0
protected reduce ( array $expressions ) : PDepend\Source\AST\ASTExpression[]
$expressions array Unprepared input array with parsed expression nodes found in the source tree.
return PDepend\Source\AST\ASTExpression[]

reset() protected method

Resets some object properties.
protected reset ( integer $modifiers ) : void
$modifiers integer Optional default modifiers.
return void

setIgnoreAnnotations() public method

Sets the ignore annotations flag. This means that the parser will ignore doc comment annotations.
public setIgnoreAnnotations ( ) : void
return void

setMaxNestingLevel() public method

Configures the maximum allowed nesting level.
Since: 0.9.12
public setMaxNestingLevel ( integer $maxNestingLevel ) : void
$maxNestingLevel integer The maximum allowed nesting level.
return void

setNodePositionsAndReturn() protected method

This method configures the given node with its start and end positions.
Since: 0.9.8
protected setNodePositionsAndReturn ( PDepend\Source\AST\ASTNode $node, array &$tokens = null ) : PDepend\Source\AST\ASTNode
$node PDepend\Source\AST\ASTNode
$tokens array
return PDepend\Source\AST\ASTNode

setUpEnvironment() protected method

Initializes the parser environment.
Since: 0.9.12
protected setUpEnvironment ( ) : void
return void

tearDownEnvironment() protected method

Restores the parser environment back.
Since: 0.9.12
protected tearDownEnvironment ( ) : void
return void

throwUnexpectedTokenException() protected method

Throws an UnexpectedTokenException
Since: 2.2.5
protected throwUnexpectedTokenException ( PDepend\Source\Tokenizer\Token $token = null ) : void
$token PDepend\Source\Tokenizer\Token
return void

Property Details

$builder protected_oe property

The used data structure builder.
protected Builder,PDepend\Source\Builder $builder
return PDepend\Source\Builder\Builder

$cache protected_oe property

Since: 0.10.0
protected CacheDriver,PDepend\Util\Cache $cache
return PDepend\Util\Cache\CacheDriver

$compilationUnit protected_oe property

The currently parsed file instance.
protected ASTCompilationUnit,PDepend\Source\AST $compilationUnit
return PDepend\Source\AST\ASTCompilationUnit

$tokenStack protected_oe property

Stack with all active token scopes.
protected TokenStack,PDepend\Source\Tokenizer $tokenStack
return PDepend\Source\Tokenizer\TokenStack

$tokenizer protected_oe property

* The used code tokenizer.
protected $tokenizer