r/PHPhelp • u/eurosat7 • Apr 07 '25
phpstan rule for trait method usage
I want to apply a rule that if a class uses a trait it also has to use some marked methods that are defined in that trait. Does anybody know/has a rule I could use?
Or any other qa tool extension for phpmd, phpcpd, phpcsfixer,psalm... Anything that I could use for a pre merge hook in gitlab.
A PhpStorm qa rule plugin would be my plan c.
TIA!
2
Upvotes
View all comments
Show parent comment
1
u/Jutboy Apr 07 '25
I'm not sure exactly what you are trying to do but if you define a structure for your classes you can ensure that they have defined methods. If they are not present then you will get an error which you can use to with gitlab. Does that accomplish what you want?