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

[5.0] Use Contracts As Typehints
Make repository method public.