api-platform / core

The server component of API Platform: hypermedia and GraphQL APIs in minutes
https://api-platform.com
MIT License
2.45k stars 878 forks source link

PHPStan PHPDocParser missing constructor attribute #6795

Closed dbotezat closed 1 week ago

dbotezat commented 1 week ago

API Platform version(s) affected: 4.0.8

Description

[critical] Uncaught Error: Too few arguments to function PHPStan\PhpDocParser\Parser\ConstExprParser::__construct(), 0 passed in /DriversCheck/dev/projects/beed-backend/vendor/api-platform/core/src/Metadata/Resource/Factory/PhpDocResourceMetadataCollectionFactory.php on line 62 and exactly 1 expected

currently using phptan v1.12

How to reproduce

create new ymfony project usinc smyfony cli add api platform via composer

Possible Solution

repalce with $phpDocParser = new PhpDocParser(new ParserConfig(),new TypeParser(new ConstExprParser()), new ConstExprParser()); Additional Context

Error screenshot image

Composer requirements screenshot image

dbotezat commented 1 week ago

this fixed the issue

if (class_exists(PhpDocParser::class)) { $config = new ParserConfig([]); $phpDocParser = new PhpDocParser($config,new TypeParser($config,new ConstExprParser($config)), new ConstExprParser($config)); $lexer = new Lexer($config); }

what exactly should i use as an array param in new ParserConfig(???) ... i did not research

soyuka commented 1 week ago

it's going to be fixed by https://github.com/api-platform/core/pull/6789