phpstan-disallowed-calls icon indicating copy to clipboard operation
phpstan-disallowed-calls copied to clipboard

Introduce `disallowIn` as inverse of `allowIn`

Open ruudk opened this issue 3 years ago • 1 comments

It would be great if I could enforce some rules that only apply in some directories.

Currently, the only way to get that working is to construct a list of all options using wildcards, and then exclude the target from it. Not very ideal / scalable.

What do you think, would this be worth adding? Of course I can work on a PR to address it.

ruudk avatar Dec 01 '21 15:12 ruudk

I'm solving similar situation with different PHPStan config file with different rules. For example

https://github.com/spaze/michalspacek.cz/blob/5f1606dc130823f0b717b14eea846a3e70452a65/site/composer.json#L80 and https://github.com/spaze/michalspacek.cz/blob/master/site/phpstan-vendor.neon

It might make sense as there's already something similar for params (allowExceptParams et al.). If the extra config doesn't help, then it might be worthwhile but maybe it should follow the "allowExcept" naming pattern.

spaze avatar Dec 01 '21 18:12 spaze

I've just released this in 2.9.0, hope it's still useful (realized today it is useful for me too 😊)

spaze avatar Nov 04 '22 18:11 spaze

I'm sorry but I can't remember why I wanted to use this back in 2021... But thanks for fixing it. Maybe I'll use it in the future 😊

ruudk avatar Nov 07 '22 09:11 ruudk