Change $container->get("some_name") to bare type, useful since Symfony 3.4
use PHPUnit\Framework\TestCase;
final class SomeTest extends TestCase
{
public function run()
{
$container = $this->getContainer();
- $someClass = $container->get('some_name');
+ $someClass = $container->get(SomeType::class);
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Symfony\Symfony34\Rector\Closure\ContainerGetNameToTypeInTestsRector;
return RectorConfig::configure()
->withRules([
ContainerGetNameToTypeInTestsRector::class,
]);