Changes createForm(new FormType), add(new FormType) to ones with "FormType::class"
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
final class SomeController extends Controller
{
public function action()
{
- $form = $this->createForm(new TeamType);
+ $form = $this->createForm(TeamType::class);
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Symfony\Symfony30\Rector\MethodCall\FormTypeInstanceToClassConstRector;
return RectorConfig::configure()
->withRules([
FormTypeInstanceToClassConstRector::class,
]);