1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-10 15:50:26 +01:00
psalm/docs/running_psalm/issues/UnhandledMatchCondition.md

20 lines
343 B
Markdown
Raw Normal View History

2020-09-01 04:59:47 +02:00
# UnhandledMatchCondition
Emitted when a match expression does not handle one or more options.
```php
<?php
function matchOne(): string {
$foo = rand(0, 1) ? "foo" : "bar";
return match ($foo) {
'foo' => 'foo',
};
}
```
## Why this is bad
The above code will fail 50% of the time with an `UnhandledMatchError` error.