arkitect
arkitect copied to clipboard
Traverse also interfaces
Feature Request
Q | A |
---|---|
New Feature | yes |
RFC | yes/no |
BC Break | yes/no |
Summary
Currently interfaces are not traversed therefore we can't create rules for them.
Hi @javaDeveloperKid can you please provide an example? Thanks!
In my case, I wanted to forbid Interface
suffix.
If I understood well your issue @javaDeveloperKid to avoid the suffix Interface
you can use this rule:
$rules = Rule::allClasses()
->that(new ResideInOneOfTheseNamespaces('App'))
->should(new NotHaveNameMatching('*Interface'))
->because('*Interface is not a valid suffix name');
What do you think?
I think you can achieve that with this rule:
$rules[] = Rule::allClasses()
->that(new ResideInOneOfTheseNamespaces('App'))
->andThat(new IsInterface())
->should(new NotHaveNameMatching('*Interface'))
->because('interface names should not end with Interface');