phpstan-banned-code icon indicating copy to clipboard operation
phpstan-banned-code copied to clipboard

Support class bann rules

Open staabm opened this issue 6 years ago • 2 comments

Would be great if one could also ban single classes or even namespaces.

This is especially usefull when you wanne get rid of a external dependency in which you cannot annotate the classes itself with @deprecated as you dont own the code

If already supported: a example in the readme would be great

staabm avatar Mar 07 '20 06:03 staabm

I can see the benefits of this, such as if it would detect even just use imports. I'm working on a codebase where people still end up adding use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; though it (and other similar) classes/annotations have been deprecated for a while.

follow-up: It appears that https://github.com/spaze/phpstan-disallowed-calls/pull/51 may be able to support this

alister avatar Feb 18 '21 15:02 alister

Please try https://github.com/spaze/phpstan-disallowed-calls/tree/v1.3.0 as it supports this now.

ruudk avatar Feb 20 '21 07:02 ruudk