qossmic / deptrac

Keep your architecture clean.
https://qossmic.github.io/deptrac
MIT License
2.61k stars 135 forks source link

Configure layer internal tag #1318

Closed brightbyte closed 8 months ago

brightbyte commented 9 months ago

Make @internal tag configurable

Some projects, like MediaWiki, use the @internal tag with a different semantics than the one imposed by deptrac. In the case of MediaWiki, the intended semantics is "not for use by extensions", i.e. "internal to the core repo".

To work around this issue, allow the config file to specify which tag deptrac will interpret as "layer-internal". The @deptrac-internal tag will continue to always work.

brightbyte commented 9 months ago

Tests need fixing, but otherwise LGTM.

Thank you for the quick response! I'll sort out the tests later today, sorry for the mess.

brightbyte commented 9 months ago

In most of your tests, you are passing an empty array as a parameter. This is no longer valid as you have specified in the __constructor PHPDoc that the array always has the key present. I think the PHPStan static analyser should complain about it too.

I had an idea: if we make it so all tags are exposed through ClassLikereference, we don't have to inject the config here anymore. We'd only need the config in DependsOnInternalToken.

gennadigennadigennadi commented 8 months ago

@brightbyte thank you very much for your contributing, I looking forward to see more of your work land in deptrac.