1
0
mirror of https://github.com/rectorphp/rector.git synced 2025-03-16 05:19:45 +01:00
rector/create-rector.php.dist

51 lines
1.4 KiB
Plaintext

<?php
declare(strict_types=1);
use PhpParser\Node\Stmt\ClassMethod;
use Rector\Core\Configuration\Option;
use Rector\Set\ValueObject\SetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::RECTOR_RECIPE, [
// run "bin/rector create" to create a new Rector + tests from this config
'package' => 'Symfony',
'name' => 'RemoveDefaultGetBlockPrefixRector',
'node_types' => [
ClassMethod::class,
],
'description' => 'Rename `getBlockPrefix()` if it returns the default value - class to underscore, e.g. UserFormType = user_form',
'code_before' => <<<'CODE_SAMPLE'
<?php
use Symfony\Component\Form\AbstractType;
class TaskType extends AbstractType
{
public function getBlockPrefix()
{
return 'task';
}
}
CODE_SAMPLE,
'code_after' => <<<'CODE_SAMPLE'
<?php
use Symfony\Component\Form\AbstractType;
class TaskType extends AbstractType
{
}
CODE_SAMPLE,
// e.g. link to RFC or headline in upgrade guide, 1 or more in the list
'source' => [
'https://github.com/symfony/symfony/blob/3.4/UPGRADE-3.0.md',
],
// e.g. symfony30, target config to append this rector to
'set' => SetList::SYMFONY_30,
]);
};