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

[5.0] Use Contracts As Typehints
Ensure content and escaped tags are not quotted when set
Revert "Ensure content and escaped tags are not quotted when set"

This reverts commit fd4cdfb87b61133f8bdd454062bb5adca77bc5ed.
Ensure content and escaped tags are not quotted when accessed
Ensure content and escaped tags are not quotted when accessed
Some code formatting.
Fix conflicts.