-
-
Notifications
You must be signed in to change notification settings - Fork 934
Description
Bug report
I ran into this today while writing yet another event system.
In order to fully describe the type of the closure array $serializers in the following code, I resorted to using never, since that allows inserting a closure with parameter of any type. This allows me to still specify the return type of the closures in $serializers without having to just completely silence PHPStan.
In theory, it should also disallow it from being called, since a never type cannot be satisfied; however, passing something to a never argument is not reported as an error.
In practice, I would use a @phpstan-var to typecast the closure to the appropriate Closure(TBlockType): CompoundTag based on the indexing.
Code snippet that reproduces the problem
https://phpstan.org/r/644bfb47-682d-4a99-ba0e-be0c03cee6db
Expected result
An error should be emitted on line 32, since I'm passing Block to a type of never, which is illegal.