1. Go to this page and download the library: Download guanguans/rector-rules library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
guanguans / rector-rules example snippets
use Guanguans\RectorRules\Rector\File\SortFileFunctionStmtRector;
use Guanguans\RectorRules\Rector\FunctionLike\RenameGarbageParamNameRector;
use Guanguans\RectorRules\Rector\Name\RenameToConventionalCaseNameRector;
use PhpParser\NodeVisitor\ParentConnectingVisitor;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withSets([
Guanguans\RectorRules\Set\SetList::ALL,
// ...
])
// ...
->registerDecoratingNodeVisitor(ParentConnectingVisitor::class)
->withConfiguredRule(RenameToConventionalCaseNameRector::class, [
'assertMatches*Snapshot', // Exclude `spatie/pest-plugin-snapshots` function name
'beforeEach', // Exclude `pestphp/pest` function name
'PDO', // Exclude `ext-pdo` class name
])
// ...
->withRules([
RenameGarbageParamNameRector::class,
SortFileFunctionStmtRector::class,
// ...
]);