rector-developer
Installation
SKILL.md
Rector PHP Rule Builder
Rector transforms PHP code by traversing the PHP-Parser AST, matching node types, and returning modified nodes from refactor().
Workflow
- Check for an existing configurable rule first — see references/configurable-rules.md. Renaming functions/methods/classes, converting call types, and removing arguments are all covered. Prefer
->withConfiguredRule()over writing a custom rule for these cases. - Identify the PHP-Parser node type(s) to target (see references/node-types.md)
- Write the rule class extending
AbstractRector - If PHP version gated, implement
MinPhpVersionInterface - If configurable, implement
ConfigurableRectorInterface - Register the rule in rector.php config
Rule Skeleton
<?php
declare(strict_types=1);