Dependency injection is passing collaborators in rather than constructing them inside. A container is a tool for assembling those graphs automatically. The two get conflated so thoroughly that…
A class with a single meaningful method usually ends up named after the verb — PriceFormatter::format() — and read as a stutter at every call site. __invoke() lets…
Business logic in a controller is reachable from exactly one place: an HTTP request. The first time the same operation is needed from a console command, a queue…
The principle is abstract until you write the test. If exercising one method means stubbing five others that the code under test never calls, the interface is doing…
Replacing a direct call with an event feels like removing coupling. The dependency does not disappear — it moves from a line you can read into a subscriber…
A repository wrapping a single ORM, forwarding find to find, is indirection with nothing behind it — the abstraction has one implementation and will never have another, and…
Two hundred and forty require_once calls where load order was load-bearing, moved onto an autoloader one namespace at a time without a big-bang rewrite.
Floating point cannot represent 0.1 exactly, so money arithmetic accumulates error that shows up as a total that is one cent off. The usual response is to round…