← ClaudeAtlas

php-coding-standardslisted

Invoke BEFORE writing or modifying any PHP code. Provides coding standards and naming conventions for Nette repos: TABs, single quotes, strict_types, PSR-12 modifications, use statement ordering. Use this whenever creating, modifying, or refactoring any PHP code - even small bug fixes or one-line changes.
nette/agent-plugins · ★ 44 · Code & Development · score 81
Install: claude install-skill nette/agent-plugins
## PHP Coding Standards ### Using nette/coding-standard Install globally using `/php-fixer:install-php-fixer`. After installation, PHP files are automatically fixed when edited - see the `php-auto-fixer` skill for editing workflow rules (especially `use` statement ordering). ### General Rules - Every PHP file must include `declare(strict_types=1)` - Use two empty lines between methods - Nette convention for visual separation in longer classes - Document shut-up operator use: `@mkdir($dir); // @ - directory may already exist` - Document weak comparison operators: `// == accept null` - Multiple exceptions can be written in a single `exceptions.php` file, and multiple enums into `enums.php` - Interface methods don't need visibility as they're always public - All properties, return values, and parameters must have types - Final constants don't need types as they're self-evident - Write all code, comments, and variables in English only (even if communicating with the user in Czech) ### Strings - Use single quotes - they signal "no interpolation here," making code easier to scan - Use double quotes only when the string contains apostrophes or interpolation is needed - In HTML attributes, double quotes are standard ### Naming Conventions - Avoid abbreviations unless the full name is too long - Use UPPERCASE for two-letter abbreviations (`IO`, `DB`), PascalCase/camelCase for longer ones (`Http`, `Xml`) - Use nouns or noun phrases for class names - Class names should include both