Skip to content

Do not fail if phpstan/phpdoc-parser is missing#7279

Merged
soyuka merged 4 commits into
api-platform:4.1from
VincentLanglet:docParser
Jul 15, 2025
Merged

Do not fail if phpstan/phpdoc-parser is missing#7279
soyuka merged 4 commits into
api-platform:4.1from
VincentLanglet:docParser

Conversation

@VincentLanglet

@VincentLanglet VincentLanglet commented Jul 5, 2025

Copy link
Copy Markdown
Contributor
Q A
Branch? 4.1
Tickets Closes #7275
License MIT
Doc PR api-platform/docs#...

Not fully sure about this one @soyuka but

So since phpDocParser/lexer will be null when PhpDocParser is not installed, a null check might be enough.

@VincentLanglet VincentLanglet changed the title Require phpstan/phpdoc-parser Do not fail if phpstan/phpdoc-parser is missing Jul 5, 2025
@VincentLanglet

Copy link
Copy Markdown
Contributor Author

@PicassoHouessou could you try this branch ? Does it solve your issue ?

@PicassoHouessou

Copy link
Copy Markdown

Hello @VincentLanglet. It solves my issue.

@maxhelias maxhelias left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It ok for me, as "phpstan/phpdoc-parser" is also a suggested package for metadata component : https://github.com/api-platform/core/blob/4.1/src/Metadata/composer.json#L52

@maxhelias

Copy link
Copy Markdown
Contributor

Also, in Laravel, can you unconfigure the service if the dependency is not present? This would be better for performance, even if there is a cache on MetadataFactory services

@soyuka soyuka merged commit 6bc1121 into api-platform:4.1 Jul 15, 2025
111 checks passed
@soyuka

soyuka commented Jul 15, 2025

Copy link
Copy Markdown
Member

Thanks! @maxhelias yes we just need to not register the service in the first place but if I remember we're adding this dependency inside Laravel.

@maxhelias

maxhelias commented Jul 15, 2025

Copy link
Copy Markdown
Contributor

@soyuka Since we’ve removed the phpdocumentor/reflection-docblock parser, phpstan/phpdoc-parser is now just a dev dependency and also appears in the "suggest" section of composer.json like the Symfony bundle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants