Thanks to visit codestin.com
Credit goes to github.com

Skip to content

PropertyInfo PhpStanExtractor is incompatible with version 2.0 of phpstan/phpdoc-parser #58796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Steveb-p opened this issue Nov 7, 2024 · 5 comments
Labels
Bug Help wanted Issues and PRs which are looking for volunteers to complete them. PropertyInfo Status: Reviewed

Comments

@Steveb-p
Copy link
Contributor

Steveb-p commented Nov 7, 2024

Symfony version(s) affected

5.4, 6.4, 7.2

Description

A new version of PHPStan's parser has been released (2.0.0).

Installation with 2.0.0 causes issues with the following code:

$this->phpDocParser = new PhpDocParser(new TypeParser(new ConstExprParser()), new ConstExprParser());

Because ConstExprParser now has required constructor arguments.

Since this is an optional dependency, how are we going to handle it?

How to reproduce

In my case it was any project using symfony/serializer-pack. Since this also installed the phpstan/phpdoc-parser with any version, I received 2.0.0.

Possible Solution

No response

Additional Context

No response

@stof
Copy link
Member

stof commented Nov 7, 2024

Supporting both versions of the package should be easy (for 2.0, we need to create a config object in its default config and pass it to all those constructors instead of using those constructors with their default constructor arguments), so I suggest we add support for version 2.0 in a patch release

@derrabus derrabus added Help wanted Issues and PRs which are looking for volunteers to complete them. Status: Reviewed and removed Status: Needs Review labels Nov 7, 2024
@derrabus
Copy link
Member

derrabus commented Nov 7, 2024

PR welcome.

@xabbuh
Copy link
Member

xabbuh commented Nov 7, 2024

I'm on it

@xabbuh
Copy link
Member

xabbuh commented Nov 7, 2024

see #58800

derrabus added a commit that referenced this issue Nov 7, 2024
…er 2 (xabbuh)

This PR was merged into the 7.1 branch.

Discussion
----------

[Serializer][TypeInfo] fix support for phpstan/phpdoc-parser 2

| Q             | A
| ------------- | ---
| Branch?       | 7.1
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        | related to #58796
| License       | MIT

Commits
-------

ecb34a7 fix support for phpstan/phpdoc-parser 2
@chriskapp
Copy link
Contributor

Also for others, if you use symfony/type-info v7.1.6 calling PropertyAccess::createPropertyAccessor() with PHP-doc parser 2 causes the issue:

Too few arguments to function PHPStan\\PhpDocParser\\Lexer\\Lexer::__construct(), 0 passed

but the PR #58804 from @xabbuh resolves this, so we only need to wait for a next release at the symfony/type-info package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Help wanted Issues and PRs which are looking for volunteers to complete them. PropertyInfo Status: Reviewed
Projects
None yet
Development

No branches or pull requests

6 participants