Style terms
Coding style is not about aesthetics — it is about communication. Consistent formatting, naming conventions, linting rules, and documentation standards reduce cognitive load and make code reviews faster and less painful. This category covers the conventions and tooling that help teams write code that reads as if one thoughtful person wrote it all.
More on Style
History
Code style emerged as a formal discipline in the 1980s and 1990s as software teams grew and version control systems became standard; early concerns centered on indentation, naming, and readability to reduce merge conflicts and maintenance costs. The PHP community formalized style guidance through the PHP Standards Recommendation (PSR) series starting in 2009, with PSR-1 and PSR-2 establishing baseline conventions that became widely adopted. Automated tooling—first PHP_CodeSniffer (2006), later PHP-CS-Fixer and Rector—shifted style enforcement from code review to CI/CD pipelines, eliminating manual bikeshedding and enabling consistent refactoring at scale. Modern practice has evolved to treat style as both a technical concern (linting, type hints, docblocks) and a team communication layer (commit messages, documentation standards, semantic versioning), with PSR-12 and static analysis tools like PHPStan becoming de facto standards in professional PHP development. Today style encompasses not just formatting but architectural clarity, making it foundational to code quality and team productivity.
Key concepts
- Naming Conventions
- PSR-1: Basic Coding Standard
- PSR-12 Coding Standard
- Code Documentation Standards
- Commit Message Best Practices
- Early Return Pattern
- Guard Clause Pattern
- PHP-CS-Fixer vs PHP_CodeSniffer
Best references
-
PSR Standards — PHP-FIG Official PHP Framework Interop Group specifications. Essential for understanding PSR-1, PSR-4, PSR-12, and other coding standards referenced throughout this category.
-
PHP-CS-Fixer Documentation Official reference for the most widely-used PHP code style fixer. Critical for implementing automated style enforcement in CI workflows.
-
PHPStan Documentation Canonical guide to PHPStan static analysis levels (0–9) and type checking. Directly supports understanding modern PHP type safety and code quality practices.
-
Conventional Commits Official specification for standardized commit message format. Foundation for commit message best practices and automated changelog generation.
Typed relationships here
Edges touching a Style term.
- Early Return Pattern Mitigates Deep Nesting 14h
- Guard Clause Pattern Often seen in Defensive Programming 3d
- Guard Clause Pattern Mitigates Deep Nesting 4d
- Guard Clause Pattern Applies Fail Fast Principle 4d
- Guard Clause Pattern Leverages Early Return Pattern 4d