Skip to content
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

Incompatible with phpstan/phpdoc-parser >= 1.6 #1379

Closed
martijnc opened this issue Jun 10, 2022 · 9 comments
Closed

Incompatible with phpstan/phpdoc-parser >= 1.6 #1379

martijnc opened this issue Jun 10, 2022 · 9 comments

Comments

@martijnc
Copy link

phpstan/phpdoc-parser@1.6.0 introduced PHPStan\PhpDocParser\Ast\PhpDoc\TypelessParamTagValueNode in phpstan/phpdoc-parser@9d45205 which it returns instead of PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode for docblock @param definitions without a type.

Slevomat typehints ParamTagValueNode in ParameterAnnotation::__construct(), but as of phpdoc-parser@1.6.0 this can also be TypelessParamTagValueNode resulting in the following error when PHPCS encounters a docblock with a typeless @param.

Fatal error: Uncaught TypeError: SlevomatCodingStandard\Helpers\Annotation\ParameterAnnotation::__construct(): Argument #5 ($contentNode) must be of type ?PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode, PHPStan\PhpDocParser\Ast\PhpDoc\TypelessParamTagValueNode given, called in /Volumes/Projects/mortar/vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/AnnotationHelper.php on line 357 and defined in /Volumes/Projects/mortar/vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/Annotation/ParameterAnnotation.php:31

@esserj
Copy link
Contributor

esserj commented Jun 10, 2022

example annotation
@param $someTypelessParam

@akalongman
Copy link

As a workeround I added "phpstan/phpdoc-parser": "1.5.*" in a composer.json

Zeuh added a commit to DSI-Universite-Rennes2/php-standford-like-password-policy that referenced this issue Jun 11, 2022
@kukulich
Copy link
Contributor

Implemented in 55e5dc5

@Ilyes512
Copy link

Awesome that it was fixed so quickly! Can we have a new tag/release @kukulich? Thanks!

@kukulich
Copy link
Contributor

@Ilyes512 There's sponsor button on the top of this page.

@Ilyes512
Copy link

Whoa... that does sound a little passive aggressive, but I will definitly keep you in mind in future :). Your work definitly deserve compensation!

@kukulich
Copy link
Contributor

It's easy. I work on this mostly in my free time. So if you ask for release, you can motivate me to do it :) Or just wait :)

@ViktorCollin
Copy link

ViktorCollin commented Jun 21, 2022

First of all I want to thank you for your good work of this!

Im curious if it would be possible to patch this even in the 7.2 branch and release a fix version for it or is that not part of the plan?

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants