diff --git a/src/StubsGenerator.php b/src/StubsGenerator.php index f0242d8..cdde6b2 100644 --- a/src/StubsGenerator.php +++ b/src/StubsGenerator.php @@ -2,6 +2,7 @@ namespace StubsGenerator; use PhpParser\Error; +use PhpParser\Lexer\Emulative; use PhpParser\NodeTraverser; use PhpParser\NodeVisitor\NameResolver; use PhpParser\ParserFactory; @@ -111,7 +112,8 @@ public function __construct(int $symbols = self::DEFAULT, array $config = []) */ public function generate(Finder $finder): Result { - $parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7); + // Change default PHP 8.1 lexer to PHP 8.0. + $parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7, new Emulative(['phpVersion' => Emulative::PHP_8_0])); $traverser = new NodeTraverser(); $visitor = new NodeVisitor($this->symbols, $this->config);