Rename variable to match method return type
class SomeClass
{
public function run()
{
- $a = $this->getRunner();
+ $runner = $this->getRunner();
}
public function getRunner(): Runner
{
return new Runner();
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Naming\Rector\Assign\RenameVariableToMatchMethodCallReturnTypeRector;
return RectorConfig::configure()
->withRules([
RenameVariableToMatchMethodCallReturnTypeRector::class,
]);