mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-17 22:39:03 +02:00
N°5809 Update nikic/php-parser from 4.14.0 to 4.18.0
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
|
||||
namespace PhpParser;
|
||||
|
||||
use PhpParser\Lexer\Emulative;
|
||||
use PhpParser\Parser\Php7;
|
||||
|
||||
class ParserFactory
|
||||
{
|
||||
const PREFER_PHP7 = 1;
|
||||
@@ -41,4 +44,33 @@ class ParserFactory
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a parser targeting the newest version supported by this library. Code for older
|
||||
* versions will be accepted if there have been no relevant backwards-compatibility breaks in
|
||||
* PHP.
|
||||
*
|
||||
* All supported lexer attributes (comments, startLine, endLine, startTokenPos, endTokenPos,
|
||||
* startFilePos, endFilePos) will be enabled.
|
||||
*/
|
||||
public function createForNewestSupportedVersion(): Parser {
|
||||
return new Php7(new Emulative($this->getLexerOptions()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a parser targeting the host PHP version, that is the PHP version we're currently
|
||||
* running on. This parser will not use any token emulation.
|
||||
*
|
||||
* All supported lexer attributes (comments, startLine, endLine, startTokenPos, endTokenPos,
|
||||
* startFilePos, endFilePos) will be enabled.
|
||||
*/
|
||||
public function createForHostVersion(): Parser {
|
||||
return new Php7(new Lexer($this->getLexerOptions()));
|
||||
}
|
||||
|
||||
private function getLexerOptions(): array {
|
||||
return ['usedAttributes' => [
|
||||
'comments', 'startLine', 'endLine', 'startTokenPos', 'endTokenPos', 'startFilePos', 'endFilePos',
|
||||
]];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user