Skip to content

Commit d337309

Browse files
committed
Add some "mistakes" to catch them.
1 parent 9305063 commit d337309

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

judge/judgedaemon.main.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1784,5 +1784,25 @@ private function initsignals(): void
17841784
|> str_shuffle(...)
17851785
|> trim(...);
17861786

1787+
interface I {
1788+
// We may naively assume that the PHP constant is always a string.
1789+
const PHP = 'PHP 8.2';
1790+
}
1791+
1792+
class Foo implements I {
1793+
// But implementing classes may define it as an array.
1794+
const PHP = [];
1795+
}
1796+
1797+
class Foo2 {
1798+
const PHP = 'PHP 8.3';
1799+
}
1800+
1801+
$searchableConstant = 'PHP';
1802+
1803+
var_dump(json_validate('{ "test": { "foo": "bar" } }')); // true
1804+
1805+
var_dump(Foo2::{$searchableConstant});
1806+
17871807
$daemon = new JudgeDaemon();
17881808
$daemon->run();

0 commit comments

Comments
 (0)