Add config option to exclude mixin classes#198
Conversation
There was a problem hiding this comment.
Not sure if $type->describe(VerbosityLevel::typeOnly()) is the best way to get the class names here.
There was a problem hiding this comment.
It's not, because it would skip generic types in @mixin like Foo<T>. The best way is to ask $type instanceof TypeWithClassName and then about $type->getClassName().
There was a problem hiding this comment.
I thought describe would return Foo<T> if it is called on GenericObjectType.
What about the case when it's not an instance of TypeWithClassName?
There was a problem hiding this comment.
I thought describe would return Foo if it is called on GenericObjectType.
Yes, exactly, which is why your code wouldn't work if Foo should be excluded.
I realized you should probably use TypeUtils::getDirectClassNames() which is the easiest and also takes unions into account.
365f49c to
b7b4e12
Compare
|
Nice, thank you! Please note that once I release this and Larastan gets the configuration in its extension.neon, you also have to bump the minimal required PHPStan version, otherwise PHPStan will crash with an error message that it doesn't know this parameter. (That's why it's added to parametersSchema). |
|
Yeah, sure! Thank you! |
From the discussion at larastan/larastan#555
This PR adds a config option to blacklist classes for
@mixinannotation.I did not find an easy way to test this. Because the config file needs to be changed. So, if you can point me how to test this, I will do it.