Open evang522 opened 1 year ago
this shouldn't really happen unless the type is known not to be empty ( https://github.com/php-standard-library/psalm-plugin/blob/main/src/EventHandler/Iter/First/FunctionReturnTypeProvider.php#L36-L42 ), i will look further into it 👍
Describe the bug When provided an array with type
list<string>
, the output of Psl\Iter\first($array) is considered by the plugin'sFunctionReturnTypeProvider
to be never null, which is presumably not true.To Reproduce
Run Psalm with this plugin enabled on the following code:
Output:
When duplicating the code of \Psl\Iter\first so that the plugin is not applied, this problem does not occur:
Output: No errors found!
Expected behavior \Psl\Iter\first return type is considered to be possibly null as long as the array is not
non-empty-list<*>
Environment (please complete the following information):
Thanks a lot!