mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 10:07:12 +00:00
add support for phpstan/phpdoc-parser 2
This commit is contained in:
@@ -21,8 +21,10 @@ use PHPStan\PhpDocParser\Parser\ConstExprParser;
|
||||
use PHPStan\PhpDocParser\Parser\PhpDocParser;
|
||||
use PHPStan\PhpDocParser\Parser\TokenIterator;
|
||||
use PHPStan\PhpDocParser\Parser\TypeParser;
|
||||
use PHPStan\PhpDocParser\ParserConfig;
|
||||
use RuntimeException;
|
||||
|
||||
use function class_exists;
|
||||
use function ltrim;
|
||||
use function property_exists;
|
||||
use function rtrim;
|
||||
@@ -44,16 +46,27 @@ class AbstractPHPStanFactory implements Factory
|
||||
|
||||
public function __construct(PHPStanFactory ...$factories)
|
||||
{
|
||||
$this->lexer = new Lexer(true);
|
||||
$constParser = new ConstExprParser(true, true, ['lines' => true, 'indexes' => true]);
|
||||
$this->parser = new PhpDocParser(
|
||||
new TypeParser($constParser, true, ['lines' => true, 'indexes' => true]),
|
||||
$constParser,
|
||||
true,
|
||||
true,
|
||||
['lines' => true, 'indexes' => true],
|
||||
true
|
||||
);
|
||||
if (class_exists(ParserConfig::class)) {
|
||||
$config = new ParserConfig(['indexes' => true, 'lines' => true]);
|
||||
$this->lexer = new Lexer($config);
|
||||
$constParser = new ConstExprParser($config);
|
||||
$this->parser = new PhpDocParser(
|
||||
$config,
|
||||
new TypeParser($config, $constParser),
|
||||
$constParser
|
||||
);
|
||||
} else {
|
||||
$this->lexer = new Lexer(true);
|
||||
$constParser = new ConstExprParser(true, true, ['lines' => true, 'indexes' => true]);
|
||||
$this->parser = new PhpDocParser(
|
||||
new TypeParser($constParser, true, ['lines' => true, 'indexes' => true]),
|
||||
$constParser,
|
||||
true,
|
||||
true,
|
||||
['lines' => true, 'indexes' => true],
|
||||
true
|
||||
);
|
||||
}
|
||||
$this->factories = $factories;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user