Turns string Form Type references to their CONSTANT alternatives in getParent()
and getExtendedType()
methods in Form in Symfony
use Symfony\Component\Form\AbstractType;
class SomeType extends AbstractType
{
public function getParent()
{
- return 'collection';
+ return \Symfony\Component\Form\Extension\Core\Type\CollectionType::class;
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Symfony\Symfony30\Rector\ClassMethod\FormTypeGetParentRector;
return RectorConfig::configure()
->withRules([
FormTypeGetParentRector::class,
]);