guanguans/rector-rules

A set of additional rules for rector/rector. - 一套针对 `rector/rector` 的附加规则。

Fund package maintenance!
Sponsors

Installs: 347

Dependents: 4

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/guanguans/rector-rules

1.3.0 2026-01-14 05:12 UTC

This package is auto-updated.

Last update: 2026-01-16 05:36:37 UTC


README

Note

A set of additional rules for rector/rector. - 一套针对 rector/rector 的附加规则。

tests php-cs-fixer codecov Latest Stable Version GitHub release (with filter) Total Downloads License

Requirement

  • PHP >= 7.4

Installation

composer require guanguans/rector-rules --dev --ansi -v

Usage

🧐 Rules Overview

In your rector configuration register rules

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

composer checks:required
composer php-cs-fixer:fix
composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.