### Bug report Please see test code. ### Code snippet that reproduces the problem https://phpstan.org/r/522a319c-1f35-4dd7-b77b-65116c199df2 ### Expected output There should be a 2nd error for line 32. > Parameter #1 $to of static method Mapper::map() expects A|array, Closure given. ### Did PHPStan help you today? Did it make you happy in any way? ❤️
Activity
[-]Narrowed type gets lost?[/-][+]Narrowed type lost?[/+]VincentLanglet commentedon Apr 27, 2026
There is no reason to report an error line 32.
[$to, 'y']is an array, even if it's callable.sreichel commentedon Apr 27, 2026
There should be an error for 1st
$fromparameter?$fromis closure. L31 should cause two errors.VincentLanglet commentedon Apr 27, 2026
You get your error on level 7 https://phpstan.org/r/a84a4840-fbb9-49f3-8779-2ca4db87e3a1
array|Closure might be accepted by array|A.
The "maybe" errors are reported on level 7+
sreichel commentedon Apr 27, 2026
Thanks.
github-actions commentedon May 29, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.