rector / rector-generator
Generate Rector rules from command line
Fund package maintenance!
tomasvotruba
Installs: 1 036 889
Dependents: 2
Suggesters: 0
Security: 0
Stars: 11
Watchers: 3
Forks: 6
Open Issues: 0
Type:rector-extension
Requires
- php: >=8.2
- illuminate/container: ^11.10
- nette/utils: ^3.2|^4.0
- nikic/php-parser: ^4.19
- symfony/console: ^6.4
- symfony/filesystem: ^6.4|^7.0
- symfony/finder: ^6.4|^7.0
- webmozart/assert: ^1.11
Requires (Dev)
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^1.11
- phpstan/phpstan-webmozart-assert: ^1.2
- phpunit/phpunit: ^10.5
- rector/rector: dev-main
- symplify/easy-coding-standard: ^12.3
- symplify/phpstan-extensions: ^11.4
- symplify/phpstan-rules: ^12.4
- symplify/vendor-patches: ^11.3
- tomasvotruba/class-leak: ^0.2
- tracy/tracy: ^2.10.5
- dev-main
- 0.7.12
- 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-06-23 00:59:20 UTC
README
[Deprecated] Rector Generator
Note: We've had this custom package for creating Rector rules from simple file for years.
Yet in recent times, we practically never used it and only copy-paste old rule to new one :) package has no value, time to let go.
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 :)