PHP Best Practices Modern PHP 8.x patterns, PSR standards, type system best practices, and SOLID principles. Contains 51 rules for writing clean, maintainable PHP code. Step 1: Detect PHP Version Always check the project's PHP version before giving any advice. Features vary significantly across 8.0 - 8.5. Never suggest syntax that doesn't exist in the project's version. Check for the required PHP version: Also check the runtime version: Feature Availability by Version | Feature | Version | Rule Prefix | |---------|---------|-------------| | Union types, match, nullsafe, named args, constructo…