php-language-extensions
php-language-extensions copied to clipboard
Allow TestTag on classes
I would like to put the TestTag attribute on a class-level. Marking the entire class as intended for use in tests only.
I sometimes write extremely simple implementations of interfaces that only exist for making writing tests that interact with the interface simpler. Instead of configuring a mock, you can just create an instance of this class with a couple of constructor arguments.
It is sometimes useful that these classes are available in the library for other code that depends on this library. So writing tests there becomes easier.
What do you think of this change? Would you accept a pull-request to adjust the attribute for this? And an additional pull-request in DaveLiddament/phpstan-php-language-extensions for the implementation?
Yes, that change sounds like a great idea.
If you're happy to give the implementation a go then please send through a PR. Otherwise I can take a look in the next couple of weeks.
Thanks for your interest in this project.
See https://github.com/DaveLiddament/php-language-extensions/pull/26. Probably best to wait with merge untill implemenation of the rules is done.
Implemented by #26