Open
Description
I'll leave here an example given by @azjezz:
use Psl\Str;
use Psl\Type;
use Psl\Option;
/**
* @var Type\TypeInterface<Option\OptionInterface<string>>
*/
$type = Type\option(Type\string());
$str = 'abc';
$arr = [];
// = 3
$a = $type->coerce($str)->map(Str\length(...))->unwrapOr(0);
// = 0
$b = $type->coerce($arr)->map(Str\length(...))->unwrapOr(0);
$val = Option\none();
$type->matches($val); // true? `matches` has `@psalm-assert-if-true T $value` so now psalm will think it's `Option<string>`, not an issue
$val = Option\some(123);
$type->matches($val); // false? this would require us to unwrap it if it's a some and check the value
I think I could work on this one