https://github.com/guanguans/rector-rules
A set of rector/rector rules. - 一套 rector/rector 规则。
https://github.com/guanguans/rector-rules
dev format formatter lint linter rector refactor rule standard static-analysis testing
Last synced: 3 months ago
JSON representation
A set of rector/rector rules. - 一套 rector/rector 规则。
- Host: GitHub
- URL: https://github.com/guanguans/rector-rules
- Owner: guanguans
- License: mit
- Created: 2025-12-27T08:47:21.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-01-14T05:18:07.000Z (3 months ago)
- Last Synced: 2026-01-14T09:15:49.942Z (3 months ago)
- Topics: dev, format, formatter, lint, linter, rector, refactor, rule, standard, static-analysis, testing
- Language: PHP
- Homepage:
- Size: 183 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# rector-rules
> [!NOTE]
> A set of additional rules for rector/rector. - 一套针对 `rector/rector` 的附加规则。
[](https://github.com/guanguans/rector-rules/actions/workflows/tests.yml)
[](https://github.com/guanguans/rector-rules/actions/workflows/php-cs-fixer.yml)
[](https://codecov.io/gh/guanguans/rector-rules)
[](https://packagist.org/packages/guanguans/rector-rules)
[](https://github.com/guanguans/rector-rules/releases)
[](https://packagist.org/packages/guanguans/rector-rules)
[](https://packagist.org/packages/guanguans/rector-rules)
## Requirement
* PHP >= 7.4
## Installation
```shell
composer require guanguans/rector-rules --dev --ansi -v
```
## Usage
### :monocle_face: [Rules Overview](docs/rules-overview.md)
### In your rector configuration register rules
```php
use Guanguans\RectorRules\Rector\File\SortFileFunctionStmtRector;
use Guanguans\RectorRules\Rector\Name\RenameToPsrNameRector;
use PhpParser\NodeVisitor\ParentConnectingVisitor;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->registerDecoratingNodeVisitor(ParentConnectingVisitor::class)
->withConfiguredRule(RenameToPsrNameRector::class, [
'assertMatches*Snapshot',
'beforeEach',
'PDO',
])
// ...
->withRules([
SortFileFunctionStmtRector::class,
// ...
]);
```
## Composer scripts
```shell
composer checks:required
composer php-cs-fixer:fix
composer test
```
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
* [guanguans](https://github.com/guanguans)
* [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE) for more information.