rector/docs/rector_recipe.md
Tomas Votruba f672eace0e
[DX] Add init-recipe command to create recipe config in root (#4789)
* [DX] Add init-recipe command to initlaize recipe

* update docs
2020-12-05 13:20:13 +00:00

704 B

Generate a new Rector Rule

Creating a new Rector rule means many small steps. You need to create rule file, test file, test fixtures, put it into right category, bla bla bla...

How can we remove repeated work and let us focus only on refactor() method?

What generate Command is Does?

It creates a bare structured Rule. Don't worry, also generates a test case, which is required to contribute.

How to Generate Rector rule in 3 steps?

  1. Initialize rector-recipe.php config

    vendor/bin/rector init-recipe
    
  2. Complete parameters in rector-recipe.php to design your new rule

  3. Run command

    vendor/bin/rector generate
    

That's it :)