TypePHP 编译器
https://swoole.com/aot/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
679 B
33 lines
679 B
--TEST--
|
|
finally runs for return nested in if/else branches without changing return value
|
|
--FILE--
|
|
<?php
|
|
|
|
function nested_finally_return(int $value): string
|
|
{
|
|
$state = "start";
|
|
try {
|
|
if ($value > 0) {
|
|
$state .= ":positive";
|
|
return $state;
|
|
} else {
|
|
$state .= ":negative";
|
|
return $state;
|
|
}
|
|
} finally {
|
|
echo "finally:$state\n";
|
|
$state .= ":finally";
|
|
}
|
|
}
|
|
|
|
function main(): void
|
|
{
|
|
var_dump(nested_finally_return(1));
|
|
var_dump(nested_finally_return(-1));
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
finally:start:positive
|
|
string(14) "start:positive"
|
|
finally:start:negative
|
|
string(14) "start:negative"
|
|
|