[depre] Deprecate ReturnTypeWillChangeRector as discourages from filling correct types, use type declaration set instead#7570
Conversation
…ing correct types, use type declaration set instead
|
Hi @TomasVotruba, So far, I had $rector_config->ruleWithConfiguration(
Rector\Transform\Rector\ClassMethod\ReturnTypeWillChangeRector::class,
array(
new Rector\Transform\ValueObject\ClassMethodReference( 'JsonSerializable', 'jsonSerialize' ),
),
);in my Rector config, which resulted in This downgrading removes the When I remove that config, I now get deprecation warnings when running PHPUnit: Obviously, adding Can you maybe guide me to how I can now achieve this, with this rule being deprecated in Rector? Thanks a lot! Best wishes, |
|
Hi, thanks for detailed reporting. We should handle this in downgrade rules then. Can you kick of the PR in the downgrade rules? |
|
Hi @TomasVotruba, Thanks for your reply! Thank you! |
|
That's correct repository. Basically copy pasting the rule there will do for a start :) |
Looking at this attributes, its goal is to delay filling of correct return type declarations.
Our goal is to upgrade as soon as possible with best code quality available. Postponing adding return types where they should be in the first place does not match our goal.
That's why I'm deprecating this rule. Use type declaration set instead, to compleetely avoid these missed types and increase your type coverage and code quality 👍