@rdlowrey I strongly disagree with your view, at least regarding this PSR. Frameworks are about interoperability, and the performance impact of instantiating an object is the last of the concerns (my laptop alone can instantiate tens of millions of PHP objects per second).

Even if, unlike Java, PHP does not enforce return types, it doesn't mean that interface documentation shouldn't enforce a return type. If an implementation fails to return the proper type, it's a runtime error, and its author will have to fix it. All modern PHP MVC frameworks and ORM rely on enforced return types in interfaces, hence my surprise reading your words.

The code sample you attached above is exactly what everybody is trying to avoid: `if (...) elseif (...) {... } else { ... }`. An interface will allow to treat a string, a resource, or whatever streamable thing you can think about, to behave the same way.

Thus the *consumer* of the interface doesn't have to worry about what's returned, but knows how to use it, whatever the underlying implementation. That's the whole purpose of interfaces and OOP.