Skip to content

Commit 71379f9

Browse files
committed
Make compatible with PHP < 7.4
1 parent b12e5c1 commit 71379f9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/php/lang/ast/emit/PHP.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ protected function emitEnum($result, $enum) {
387387
}');
388388
$result->out->write('public static function from($value) {
389389
if ($r= self::$values[$value] ?? null) return $r;
390-
throw new \ValueError(\util\Objects::stringOf($value)." is not a valid backing value for enum \"".self::class."\"");
390+
throw new \Exception(\util\Objects::stringOf($value)." is not a valid backing value for enum \"".self::class."\"");
391391
}');
392392
} else {
393393
$result->out->write('public $name;');

src/test/php/lang/ast/unittest/emit/EnumTest.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public static function run() {
8989
try {
9090
self::from("illegal");
9191
throw new IllegalStateException("No exception raised");
92-
} catch (\ValueError $expected) {
92+
} catch (\Exception $expected) {
9393
return $expected->getMessage();
9494
}
9595
}

0 commit comments

Comments
 (0)