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

Don't crash on shorthand nullable return types #878

Conversation

weirdan
Copy link

@weirdan weirdan commented Jan 30, 2020

Previously slevomat/coding-standard would crash (report an Internal.Exception issue) on shorthand nullable return types in a docblock (e.g. @return ?int). This change fixes the crash.

Example of a crash

FILE: /home/weirdan/src/doctrine-psalm-plugin/stubs/ObjectRepository.php
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 1 | ERROR | An error occurred during processing; checking has been aborted. The error message was: Undefined property: PHPStan\PhpDocParser\Ast\Type\NullableTypeNode::$types in
   |       | /home/weirdan/src/doctrine-psalm-plugin/vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/AnnotationTypeHelper.php on line 306 (Internal.Exception)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Previously slevomat/coding-standard would crash on shorthand nullable
return types in a docblock (e.g. `@return ?int`). This change fixes the
crash.
weirdan added a commit to psalm/psalm-plugin-doctrine that referenced this pull request Jan 30, 2020
@weirdan weirdan requested a review from kukulich January 30, 2020 02:58
@kukulich
Copy link
Contributor

Thank you for your report.

Fixed in master.

@kukulich kukulich closed this Jan 31, 2020
@kukulich kukulich added the Bug label Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants