phpstan-developer
Installation
SKILL.md
PHPStan Extension Builder
PHPStan finds bugs by traversing the PHP-Parser AST, resolving types via PHPStan's type system, and reporting errors from processNode().
Workflow
- Identify the PHP-Parser node type to target — use
var_dump(get_class($node))withNode::classas a temporarygetNodeType()to discover node types, or check the php-parser docs - For cross-file analysis (e.g. "find unused things", "check all calls to X"), use a Collector to gather data and a
CollectedDataNoderule to report — see references/collectors.md - Write the Rule class extending nothing — implement
Ruleinterface directly - Write the test class extending
RuleTestCasewith fixture PHP files - Register the rule in a neon config file
Rule Skeleton
<?php
declare(strict_types=1);