We chose to try out PHPat for enforcing the dependency rules within the Wikibase REST API namespaces.
This was partially done in this patch: https://gerrit.wikimedia.org/r/865577
Checks for the following namespaces/layers:
- Domain
- Domain Services
- Serialization
- Validation
- Use Cases
- Presentation