-
-
Notifications
You must be signed in to change notification settings - Fork 431
Fix PHPStan @return unused type return.type on RectorInterface #7406
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
Conversation
|
All checks have passed 🎉 @TomasVotruba I am merging it ;) |
| * @return Node|Node[]|null|int | ||
| * | ||
| * For int return, choose: | ||
| * | ||
| * ✔️ To decorate current node and its children to not be traversed on current rule, return one of: | ||
| * - NodeVisitor::DONT_TRAVERSE_CHILDREN | ||
| * - NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN | ||
| * | ||
| * ✔️ To remove node of Node\Stmt or Node\Param, return: | ||
| * - NodeVisitor::REMOVE_NODE | ||
| */ |
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 prefer to keep original list, as now any int value can be returned by PHPStan, which is not true.
Could you revert this one?
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.
Ok, the rule classes itself then need update to add @return for specific constant then, eg:
/**
* @param StmtsAwareInterface $node
+ * @return null|Node|NodeVisitor::DONT_TRAVERSE_CHILDREN
*/
public function refactor(Node $node): null|Node|intI will revert this and update rule classes
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 created PR to use NodeVisitor::* on RectorInterface::refactor(), then update its rules @return to use its constant at PR:
On latest PHPStan
2.1.30, usingInterface::*seems mark as all must be returned, but not support partial of it, so useintover it.Added comment note for how return
intworks.