PHP interfaces
Guilty Of PHP articles about PHP interfaces
2 articles
-
Can a PHP Class Extend Two Classes? Use Interfaces, Traits, or Composition
A class gets one parent, but it can satisfy multiple contracts, reuse a trait method, and call another object for a separate service.
-
Pass a One-Off PHP Object to a Function That Expects an Interface
Create an anonymous Formatter directly in a function call, pass it constructor arguments, and extend a base class when it needs a protected helper.
