-
-
Couldn't load subscription status.
- Fork 80
Open
Labels
Priority: MediumThis issue may be useful, and needs some attention.This issue may be useful, and needs some attention.Status: AcceptedIt's clear what the subject of the issue is about, and what the resolution should be.It's clear what the subject of the issue is about, and what the resolution should be.Status: AvailableNo one has claimed responsibility for resolving this issue.No one has claimed responsibility for resolving this issue.Type: EnhancementMost issues will probably ask for additions or changes.Most issues will probably ask for additions or changes.
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 valueI think I could work on this one
Metadata
Metadata
Assignees
Labels
Priority: MediumThis issue may be useful, and needs some attention.This issue may be useful, and needs some attention.Status: AcceptedIt's clear what the subject of the issue is about, and what the resolution should be.It's clear what the subject of the issue is about, and what the resolution should be.Status: AvailableNo one has claimed responsibility for resolving this issue.No one has claimed responsibility for resolving this issue.Type: EnhancementMost issues will probably ask for additions or changes.Most issues will probably ask for additions or changes.