rector / rector-generator
Generate Rector rules from command line
Fund package maintenance!
tomasvotruba
Installs: 1 008 482
Dependents: 6
Suggesters: 0
Security: 0
Stars: 12
Watchers: 3
Forks: 6
Open Issues: 0
Type:rector-extension
Requires
- php: >=8.2
- illuminate/container: ^10.42
- nette/utils: ^3.2|^4.0
- nikic/php-parser: ^4.18
- symfony/console: ^6.4
- symfony/filesystem: ^6.4
- symfony/finder: ^6.4
- webmozart/assert: ^1.11
Requires (Dev)
- phpstan/extension-installer: ^1.3
- phpstan/phpstan: ^1.10.55
- phpstan/phpstan-webmozart-assert: ^1.2
- phpunit/phpunit: ^10.5
- rector/rector: dev-main
- symplify/easy-coding-standard: ^12.1
- symplify/phpstan-extensions: ^11.4
- symplify/phpstan-rules: ^12.4
- symplify/vendor-patches: ^11.3
- tomasvotruba/class-leak: ^0.2.6
- tracy/tracy: ^2.10.5
- dev-main
- 0.7.11
- 0.7.10
- 0.7.9
- 0.7.8
- 0.7.7
- 0.7.6
- 0.7.5
- 0.7.4
- 0.7.3
- 0.7.2
- 0.7.1
- 0.7.0
- 0.6.15
- 0.6.14
- 0.6.13
- 0.6.12
- 0.6.11
- 0.6.10
- 0.6.9
- 0.6.8
- 0.6.7
- 0.6.6
- 0.6.5
- 0.6.4
- 0.6.3
- 0.6.2
- 0.6.1
- 0.6.0
- 0.5.1
- 0.5.0
- 0.4.7
- 0.4.6
- 0.4.5
- 0.4.4
- 0.4.3
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.0
- 0.2.0
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- dev-tv-bump-deps
This package is auto-updated.
Last update: 2024-04-18 22:14:10 UTC
README
Every Rector rule requires test, test fixtures, config and the rule.
- rules/Package/Rector/Category/SomeRector.php - rules-tests/Package/Rector/Category/SomeRector/SomeRectorTest.php - rules-tests/Package/Rector/Category/SomeRector/config/confured_rule.php - rules-tests/Package/Rector/Category/SomeRector/Fixture/some_fixture.php.inc
~80 % of the code is repeated text - namespace, Rector name, default test setup etc.
This package will save your typing the repeated code and gives you more space for writing refactor()
method logic.
How to Generate a new Rule?
- Initialize
rector-recipe.php
config
vendor/bin/rector init-recipe
-
Complete parameters in
rector-recipe.php
to design your new rule -
Run command
vendor/bin/rector generate
That's it :)