Skip to content

Prefer $this return type over static #7437

Answered by TomasVotruba
dpi asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

the best way is to add rule that add what you don't want via skip() method:
https://github.com/rectorphp/rector/blob/main/docs/how_to_ignore_rule_or_paths.md

On the other hand, the static return type is far better than docblocks, as it give PHPStan and Rector 100 % confidence about type.
So more rule can work with it and build on it :)

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@dpi
Comment options

@TomasVotruba
Comment options

Answer selected by dpi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants