Description
I'm working on sniff to check the usage of forbidden classes. Something similar to Generic.PHP.ForbiddenFunctions
.
It would have 4 properties, forbiddenExtends
, forbiddenTraits
, forbiddenInterfaces
and forbiddenClasses
<- maybe some better name for checks with new
or ::
operator.
It would be possible to disable that class or specify the alternate class which should be used.
My motivation comes from the Laravel Framework, which has Facades like \Illuminate\Support\Facades\Cache
and each facade has also global alias \Cache
. Some people don't like Facades at all and want to disable them. Others don't use an alias and want to use the original class or vice versa.
My sniff would check it and acts properly. I have some proof of concept. However, I would like to know if you are OK with this kind of sniff. Don't want to spend too much time when you would not accept it later. If you are OK with that, in the following days I would create PR.