TokenIterator
in package
Table of Contents
- $index : int
- $newline : string|null
- $savePoints : array<string|int, int>
- $skippedTokenTypes : array<int, int>
- $tokens : array<int, array{: string, : int, : int}>
- __construct() : mixed
- addEndOfLineToSkippedTokens() : void
- consumeTokenType() : void
- consumeTokenValue() : void
- currentTokenIndex() : int
- currentTokenLine() : int
- currentTokenOffset() : int
- currentTokenType() : int
- currentTokenValue() : string
- dropSavePoint() : void
- endIndexOfLastRelevantToken() : int
- forwardToTheEnd() : void
- getContentBetween() : string
- getDetectedNewline() : string|null
- getSkippedHorizontalWhiteSpaceIfAny() : string
- getTokenCount() : int
- getTokens() : array<int, array{: string, : int, : int}>
- hasParentheses() : bool
- Whether the given position is immediately surrounded by parenthesis.
- hasTokenImmediatelyAfter() : bool
- Check whether the position is directly followed by a certain token type.
- hasTokenImmediatelyBefore() : bool
- Check whether the position is directly preceded by a certain token type.
- isCurrentTokenType() : bool
- isCurrentTokenValue() : bool
- isPrecededByHorizontalWhitespace() : bool
- joinUntil() : string
- next() : void
- pushSavePoint() : void
- removeEndOfLineFromSkippedTokens() : void
- rollback() : void
- tryConsumeTokenType() : bool
- tryConsumeTokenValue() : bool
- detectNewline() : void
- skipIrrelevantTokens() : void
- throwError() : void
Properties
$index
private
int
$index
$newline
private
string|null
$newline
= null
$savePoints
private
array<string|int, int>
$savePoints
= []
$skippedTokenTypes
private
array<int, int>
$skippedTokenTypes
= [PHPStanPhpDocParserLexerLexer::TOKEN_HORIZONTAL_WS]
$tokens
private
array<int, array{: string, : int, : int}>
$tokens
Methods
__construct()
public
__construct(array<int, array{: string, : int, : int}> $tokens, int $index) : mixed
Parameters
- $tokens : array<int, array{: string, : int, : int}>
- $index : int
Return values
mixed —addEndOfLineToSkippedTokens()
public
addEndOfLineToSkippedTokens() : void
Return values
void —consumeTokenType()
public
consumeTokenType(int $tokenType) : void
Parameters
- $tokenType : int
Tags
Return values
void —consumeTokenValue()
public
consumeTokenValue(int $tokenType, string $tokenValue) : void
Parameters
- $tokenType : int
- $tokenValue : string
Tags
Return values
void —currentTokenIndex()
public
currentTokenIndex() : int
Return values
int —currentTokenLine()
public
currentTokenLine() : int
Return values
int —currentTokenOffset()
public
currentTokenOffset() : int
Return values
int —currentTokenType()
public
currentTokenType() : int
Return values
int —currentTokenValue()
public
currentTokenValue() : string
Return values
string —dropSavePoint()
public
dropSavePoint() : void
Return values
void —endIndexOfLastRelevantToken()
public
endIndexOfLastRelevantToken() : int
Return values
int —forwardToTheEnd()
public
forwardToTheEnd() : void
Tags
Return values
void —getContentBetween()
public
getContentBetween(int $startPos, int $endPos) : string
Parameters
- $startPos : int
- $endPos : int
Return values
string —getDetectedNewline()
public
getDetectedNewline() : string|null
Return values
string|null —getSkippedHorizontalWhiteSpaceIfAny()
public
getSkippedHorizontalWhiteSpaceIfAny() : string
Return values
string —getTokenCount()
public
getTokenCount() : int
Return values
int —getTokens()
public
getTokens() : array<int, array{: string, : int, : int}>
Return values
array<int, array{: string, : int, : int}> —hasParentheses()
Whether the given position is immediately surrounded by parenthesis.
public
hasParentheses(int $startPos, int $endPos) : bool
Parameters
- $startPos : int
- $endPos : int
Return values
bool —hasTokenImmediatelyAfter()
Check whether the position is directly followed by a certain token type.
public
hasTokenImmediatelyAfter(int $pos, int $expectedTokenType) : bool
During this check TOKEN_HORIZONTAL_WS and TOKEN_PHPDOC_EOL are skipped
Parameters
- $pos : int
- $expectedTokenType : int
Return values
bool —hasTokenImmediatelyBefore()
Check whether the position is directly preceded by a certain token type.
public
hasTokenImmediatelyBefore(int $pos, int $expectedTokenType) : bool
During this check TOKEN_HORIZONTAL_WS and TOKEN_PHPDOC_EOL are skipped
Parameters
- $pos : int
- $expectedTokenType : int
Return values
bool —isCurrentTokenType()
public
isCurrentTokenType(int ...$tokenType) : bool
Parameters
- $tokenType : int
Return values
bool —isCurrentTokenValue()
public
isCurrentTokenValue(string $tokenValue) : bool
Parameters
- $tokenValue : string
Return values
bool —isPrecededByHorizontalWhitespace()
public
isPrecededByHorizontalWhitespace() : bool
Return values
bool —joinUntil()
public
joinUntil(int ...$tokenType) : string
Parameters
- $tokenType : int
Tags
Return values
string —next()
public
next() : void
Return values
void —pushSavePoint()
public
pushSavePoint() : void
Return values
void —removeEndOfLineFromSkippedTokens()
public
removeEndOfLineFromSkippedTokens() : void
Return values
void —rollback()
public
rollback() : void
Return values
void —tryConsumeTokenType()
public
tryConsumeTokenType(int $tokenType) : bool
Parameters
- $tokenType : int
Tags
Return values
bool —tryConsumeTokenValue()
public
tryConsumeTokenValue(string $tokenValue) : bool
Parameters
- $tokenValue : string
Tags
Return values
bool —detectNewline()
private
detectNewline() : void
Return values
void —skipIrrelevantTokens()
private
skipIrrelevantTokens() : void
Return values
void —throwError()
private
throwError(int $expectedTokenType[, string|null $expectedTokenValue = null ]) : void
Parameters
- $expectedTokenType : int
- $expectedTokenValue : string|null = null