You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Is is feasible to
add non-empty-array and non-empty-list support to the type system, such that:
the return Psl\Iter\first and other functions can be T and not T|null?
Describe the solution you'd like
I want to be able to do things like:
<?phpdeclare(strict_types=1);
usePsl;
class FooExtractor
{
/** @param list<Foo> $foos */publicfunction__invoke(array$foos): Foo
{
$foosFiltered = Vec\filter(
$foos,
function (Foo$foo): bool {
...
}
);
//assert $foosFiltered type is non-empty-list/array here.//this will error as the return type is `T|null`returnIter\first($foosFiltered);
}
}
Is there a better way to achieve what I'm trying to do?
Thanks!
The text was updated successfully, but these errors were encountered:
first reported in azjezz/psl#145 by @bendavies
The text was updated successfully, but these errors were encountered: