Closed TomasVotruba closed 2 months ago
@TomasVotruba is this forcing a return type on DataTransformers in symfony?
I have the following
public function reverseTransform(mixed $value): ?string
{
if (null === $value || '' === (string) $value) {
return null;
}
return 'foo';
}
But rector is changing this to:
public function reverseTransform(mixed $value): object|string
{
if (null === $value || '' === (string) $value) {
return null;
}
return 'foo';
}
But this isn't correct. It can only be ?string
so now I have PHPStan failing on me:
::reverseTransform() should return object|string but returns null.
Ah using the 71 set instead of 64 fixed it.
$rectorConfig->import(Rector\Symfony\Set\SymfonySetList::SYMFONY_71);
Ref https://github.com/rectorphp/rector-symfony/issues/537