I have been going over SOLID principles again since PHP 7's release. In particular the idea of the Liskov substitution principle which in a nutshell, states that any extension of a class should be able to be used anywhere its parent class can be used.
Part of this principle is coding to an interface, so your methods have defined contracts to adhear to. However, in PHP 5 and below, return types don't exist. So although you must have the same parameter types passed into methods using interfaces, you can return any old type you like. With big projects, this makes keeping to this principle much harder than other languages.
I do not have PHP 7 installed just yet to test this out, nor have I actually seen any documentation in the PHP manual or on any blog sites hyping the new features.
Are return types possible with interfaces in PHP 7?
Seems a little confusion has somehow occurred from this question? Regardless, the link @Jarrid posted contained the information I missed and seems to completely answer my curiosity.
Declaring return types has several motivators and use-cases:
- Prevent sub-types from breaking the expected return type of the super-type, especially in interfaces