function ParserAbstract::__construct
Same name in this branch
- 11.1.x vendor/mck89/peast/lib/Peast/Syntax/ParserAbstract.php \Peast\Syntax\ParserAbstract::__construct()
Creates a parser instance.
Options:
- phpVersion: ?PhpVersion,
Parameters
Lexer $lexer A lexer:
PhpVersion $phpVersion PHP version to target, defaults to latest supported. This: option is best-effort: Even if specified, parsing will generally assume the latest supported version and only adjust behavior in minor ways, for example by omitting errors in older versions and interpreting type hints as a name or identifier depending on version.
File
-
vendor/
nikic/ php-parser/ lib/ PhpParser/ ParserAbstract.php, line 156
Class
Namespace
PhpParserCode
public function __construct(Lexer $lexer, ?PhpVersion $phpVersion = null) {
$this->lexer = $lexer;
$this->phpVersion = $phpVersion ?? PhpVersion::getNewestSupported();
$this->initReduceCallbacks();
$this->phpTokenToSymbol = $this->createTokenMap();
$this->dropTokens = array_fill_keys([
\T_WHITESPACE,
\T_OPEN_TAG,
\T_COMMENT,
\T_DOC_COMMENT,
\T_BAD_CHARACTER,
], true);
}