php-8.0.30-src/Zend/tests/match/007.phpt

27 lines
412 B
PHP

--TEST--
Match expression exception on unhandled case
--FILE--
<?php
function get_value($i) {
return match ($i) {
1 => 1,
2 => 2,
};
}
echo get_value(1) . "\n";
echo get_value(2) . "\n";
echo get_value(3) . "\n";
?>
--EXPECTF--
1
2
Fatal error: Uncaught UnhandledMatchError: Unhandled match value of type int in %s
Stack trace:
#0 %s: get_value(3)
#1 {main}
thrown in %s on line %d