Use interfaces as typehints where applicable.
Merge pull request #6318 from franzliedke/contracts

[5.0] Use Contracts As Typehints