PHP traits promise code reuse, but often deliver hidden coupling, poor readability, and testing pain. This article explains why traits are a design smell in real-world PHP and what to use instead.
- What PHP traits really are (and what they are not)
- Why traits break readability, encapsulation, and tests
- Common architectural smells caused by traits
- Why PHP 8.x improvements don't fix the core problem
- Practical alternatives: composition, DI, strategies
- A quick refactor example from trait to clean design
