mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-19 14:27:14 +01:00
1.1 KiB
1.1 KiB
Generate own Rector from Recipe
1. Configure Rector Recipe in rector.yaml
# rector.yaml
parameters:
rector_recipe:
# run "bin/rector create" to create a new Rector + tests from this config
package: "Celebrity"
name: "SplitToExplodeRector"
node_types:
# put main node first, it is used to create namespace
- "Assign"
description: "Removes unneeded $a = $a assigns"
code_before: >
<?php
class SomeClass
{
public function run()
{
$a = $a;
}
}
code_after: >
<?php
class SomeClass
{
public function run()
{
}
}
source: # e.g. link to RFC or headline in upgrade guide, 1 or more in the list
- ""
set: "celebrity" # e.g. symfony30, target config to append this rector to
2. Generate it
vendor/bin/rector create
That's it :)