Add return type from strict return $this
final class SomeClass
{
- public function run()
+ public function run(): self
{
return $this;
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictFluentReturnRector;
return RectorConfig::configure()
->withRules([
ReturnTypeFromStrictFluentReturnRector::class,
]);