Change unsafe new static() to new self()
final class SomeClass
{
public function build()
{
- return new static();
+ return new self();
}
}
Configure your rector.php
:
<?php
use Rector\CodeQuality\Rector\New_\NewStaticToNewSelfRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
NewStaticToNewSelfRector::class,
]);