-
-
Notifications
You must be signed in to change notification settings - Fork 333
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
[DeadCode] Remove null as never used param type in RemoveUselessParamTagRector, RemveUselessReturnTagRector #5348
Conversation
2309768
to
d1afd94
Compare
b2b85be
to
3249c18
Compare
|
||
class RemoveNull | ||
{ | ||
function foo() |
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 cause no return tag specified phpstan notice, see https://phpstan.org/r/3c7579fb-dd25-4b55-94a3-637f15380990
Using @return null
handle it, see https://phpstan.org/r/55a5277d-553c-4f7e-a9d7-840c9fd206f7
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.
Exactly, that's false positive that makes error hidden.
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.
I will create separate PR, it currenlty remove @return null with description
as it invalid check
|
||
final class RemoveNull | ||
{ | ||
public $name = null; |
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.
This also make phpstan notice no type specified.
I think instead of remove null
docblock, there should be a rule to resolve the type, then it can be properly removed.
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.
Agreed. That's responsibility of another rules.
|
||
class RemoveNull | ||
{ | ||
public function foo($a = null) |
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.
same here, it cause no param type specified phpstan notice, on big project, it cause a lot of notice
I think removing null is only make sense when it has return and param native type, I will create separate PR. On |
The type declaration doesn't play role. PHPStan complaining is expective behavior, as previously the error was ignored as completed. |
No description provided.