Remove @return docblock that contradicts the declared native return type
final class SomeClass
{
- /**
- * @return SomeObject
- */
public function getName(): string
{
return $this->someObject->getName();
}
}
Configure your rector.php:
<?php
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\ClassMethod\RemoveReturnTagIncompatibleWithNativeTypeRector;
return RectorConfig::configure()
->withRules([
RemoveReturnTagIncompatibleWithNativeTypeRector::class,
]);