[dx] add "treat classes as final" option, to enable more advanced level of rules without making every class explicitly final
This should be an optional feature, off by default. When enabled, rules like AddTypeToConstRector should run even on final classes.
Devs often want to use more such type coverage features in Rector, but making everything final is way too much work just to try it out.
Let's make upgrades a bit more easier by adding this option 🤗
return RectorConfig::configure()
->treatClassesAsFinal()
@samsonasik Could you kick this off?
I will try
Looking at the rule, it seems we can do: "inline_public" config instead, that's will make less destructive when choose which rule that needs to allow add type on "public/protected" proprerty/const.
I will create 2 PRs alternative for it.
Indeed. I think both options would be valuable👌
I created 2 alternative PRs:
- https://github.com/rectorphp/rector-src/pull/6974
- https://github.com/rectorphp/rector-src/pull/6975
I prefer "alternative 2" option, as this feel less destructive, and more "inline_public" with other typed rules:
- https://getrector.com/rule-detail/class-property-assign-to-constructor-promotion-rector
- https://getrector.com/rule-detail/typed-property-from-assigns-rector
Let's close this as implemented 👍
👍
This issue has been automatically locked because it has been closed for 150 days. Please open a new issue if you have a similar problem.