DowngradeStaticTypeDeclarationRector
Remove "static" return and param type, add a "@param $this" and "@return $this" tag instead
class SomeClass
{
- public function getStatic(): static
+ /**
+ * @return static
+ */
+ public function getStatic()
{
return new static();
}
}
Configure your rector.php:
<?php
use Rector\Config\RectorConfig;
use Rector\DowngradePhp80\Rector\ClassMethod\DowngradeStaticTypeDeclarationRector;
return RectorConfig::configure()
->withRules([
DowngradeStaticTypeDeclarationRector::class,
]);