Clean Coding - 10+ Techniques To Clean Your PHP Code
summary
Lists more than ten concrete refactor techniques and PHP features, showing before/after code that actually reduces lines and bugs: use the Elvis (?:) and null coalescing (??) operators to shorten checks, apply the null-safe (?->) operator sparingly, prefer guard clauses over nested ifs, replace magic strings with enums, remove commented “zombie” code, and swap config arrays for a PDFConfig DTO with typed properties, defaults and fluent setters. Demonstrates small helper functions (json_to_array, coin_flip, starts_with) and recommends Carbon for readable date checks.
AI-written summary · about
chapters (8)
- 0:00Introduction and philosophy
- 5:13Reducing complexity
- 13:32Guard clauses and enums
- 18:06Handling zombie code
- 19:08Syntactic sugar
- 26:07Comments vs self-documenting
- 31:29Primitive obsession
- 37:10Conclusion and recap








