spaze / phpstan-disallowed-calls

PHPStan rules to detect disallowed method & function calls, constant, namespace, attribute & superglobal usages
MIT License
255 stars 17 forks source link

Add support for disallowing conditions on attributes #179

Closed ruudk closed 1 year ago

ruudk commented 1 year ago

I don't have time to contribute the code myself ATM, but just posting this here in case somebody is looking for another great addition to this library: disallowing certain conditions on attributes.

I'm looking for a rule that requires people to set the repositoryClass on a Doctrine\ORM\Mapping\Entity attribute.

So when somebody adds #[Entity] without specifying the repositoryClass it should say: You should define repositoryClass on Entity.

spaze commented 1 year ago

My idea is to have attribute params should be configurable like any other params.

However useful this seems, I don't currently have a use for such rule. But let's see if anyone else has. Or let's see if I'll be able to finish my sponsorship setup so you could sponsor a release for example.

spaze commented 1 year ago

I have released this in 2.13.0 now. Let me know if it works for you and feel free to buy me a 🍺 or a ☕ if this would save you some non-trivial time 😊

ruudk commented 1 year ago

Thanks @spaze. I sponsored you a few good beers, cheers 🍻

spaze commented 1 year ago

Thanks @ruudk! 🍻