Translations:Developers/Object oriented programming in PHP/Abstract classes and interfaces/13/en

Interfaces establish a high level of security because it's guaranteed that all objects implementing an interface have the same methods and parameters, especially when used in combination with type hinting as this reveals wrong class implementations and parameters very quickly. As a rule of thumb, create an interface for every class type and only use interface for type hinting. This allows you to exchange a class implementation by another one without touching the existing code.