-
-
Notifications
You must be signed in to change notification settings - Fork 365
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
[TypeDeclaration] AddVoidReturnTypeWhereNoReturnRector turns @return never
into less specific @return void
#1553
Conversation
@return never
into less specific @return void
/** | ||
* @return never-return | ||
*/ | ||
public function neverReturn() | ||
{ | ||
header('Location: example.com'); | ||
exit(); | ||
} | ||
|
||
/** | ||
* @return never-returns | ||
*/ | ||
public function neverReturns() | ||
{ | ||
header('Location: example.com'); | ||
exit(); | ||
} | ||
|
||
/** | ||
* @return no-return | ||
*/ | ||
public function noReturn() | ||
{ | ||
header('Location: example.com'); | ||
exit(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems rector does not support all "aliases" of the bottom-type phpstan supports:
https://phpstan.org/writing-php-code/phpdoc-types#bottom-type
only @return never
is turned into the NeverType
..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in the latest commit
@return never
into less specific @return void
@return never
into less specific @return void
@return never
into less specific @return void
@return never
into less specific @return void
@@ -36,7 +36,7 @@ final class ScalarStringToTypeMapper | |||
ResourceType::class => ['resource'], | |||
CallableType::class => ['callback', 'callable'], | |||
ObjectWithoutClassType::class => ['object'], | |||
NeverType::class => ['never'], | |||
NeverType::class => ['never', 'never-return', 'never-returns', 'no-return'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added all phpstan bottom types: see https://phpstan.org/writing-php-code/phpdoc-types#bottom-type
Thank you @staabm |
closes rectorphp/rector#6892