Closed japheth-sh closed 4 months ago
After some investigation, I believe this is because nikic/php-parser had removed ParserFactory::create in their ^5.0 versions, and you had modified composer.json to allow ^5.0 in 4.30.0 without code update. After I force to use 4.29.0, everything is back to correct.
same problem here
After some investigation, I believe this is because nikic/php-parser had removed ParserFactory::create in their ^5.0 versions, and you had modified composer.json to allow ^5.0 in 4.30.0 without code update. After I force to use 4.29.0, everything is back to correct.
Same problem, same solution.
Same problem, downgrading to 4.29.0 solved
Thanks everyone. It should be fixed now. v4.32.0 has been released with support for php-parser v5; if that doesn't work for you, try v4.31.0 which supports v4.
Scribe version
4.30.1
PHP version
8.1
Framework
Laravel
Framework version
9.52.16
Scribe config
What happened?
Met Error
Call to undefined method PhpParser\ParserFactory::create()
at vendor/knuckleswtf/scribe/src/Extracting/MethodAstParser.php:46 42▕ @return \PhpParser\Node\Stmt[]|null 43▕ / 44▕ protected static function parseClassSourceCode(string $sourceCode): ?array 45▕ { ➜ 46▕ $parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7); 47▕ try { 48▕ $ast = $parser->parse($sourceCode); 49▕ } catch (Throwable $error) { 50▕ throw new Exception("Parse error: {$error->getMessage()}");
24 artisan:37 Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
Docs