Environment
- PHP Version:
- DiscordPHP Version:
Description
My static analyser (PHPStan) fails with the following code:
$member->roles->any(fn() => true)
Cannot call method any() on
array<Discord\Parts\Guild\Role>|(Discord\Helpers\ExCollectionInterface&iterable<Discord\Parts\Guild\Role>).
🪪 method.nonObject
Expected behavior
No error - this method can only return ExCollectionInterface&iterable<Role> so the call to any is type safe.
Additional context
There was mention of the proposed fix (removing the impossible type) causing issues with most IDEs and even intelliphense. See: #1430.
Environment
Description
My static analyser (PHPStan) fails with the following code:
Expected behavior
No error - this method can only return
ExCollectionInterface&iterable<Role>so the call toanyis type safe.Additional context
There was mention of the proposed fix (removing the impossible type) causing issues with most IDEs and even intelliphense. See: #1430.