How ekino/phpstan-banned-code works
Main Components
a) Core Components:
• PHPStan Integration Layer
• Rule Engine
• Node Analyzer
• Configuration Handler
• Test Framework Integration
b) Key Rules Components:
• Banned Nodes Rule System
• Test Usage Detection System
• Error Builder
Input Layer
• PHP source code files as input
• Configuration (extension.neon) input
• Parameters configuration
Processing Layer
• PHPStan Core Integration (show as an external dependency)
• Rule Processing Pipeline:
• BannedNodesRule processor
• BannedUseTestRule processor
• Node Analysis System:
• Abstract Syntax Tree (AST) analysis
• Node type matching
• Function call detection
Output Layer
• Error reporting system
• Integration with PHPStan's error handler
Use these visual elements:
• Hexagons for decision points
• Blue: Core components
• Green: Input/Configuration
• Red: Error handling/Output
• Gray: External dependencies
Specific Implementation Details:
Configuration flow
• extension.neon → Configuration Handler → Rule Engine
Demonstrate the rule processing pipeline
• Source Code → AST Parser → Node Analyzer → Rule Processors → Error Builder
Supported node types from snippets
• Them by category (function calls, language constructs, etc.)
• How they feed into the node analysis system
Key Relationships to Highlight:
Configuration System
• How parameters.banned_code affects rule behavior
• Demonstrate configuration validation flow
Rule Processing
• How BannedNodesRule processes different node types
• How BannedUseTestRule handles test-related code detection
Error Handling
• How BannedNodesErrorBuilder creates standardized error messages
• Demonstrate integration with PHPStan's error reporting
Level of Detail:
1. Node type detection system
2. Rule processing pipeline
3. Configuration handling
Remember to:
• Version/dependency information
• PHPStan extension installer integration
• Composer package integration points