Turn FFP errors upto 11; report everything
[hiphop-php.git] / hphp / test / slow / inlining / nullthrows1.php
blobbe42a84375b385ed3ae67789f1a833ff1cc14324
1 <?hh // strict
3 function nullthrows<T>(?T $x, ?string $message = null, mixed ...$sprintf_args): T {
4 if ($x !== null) {
5 return $x;
8 if ($message === null) {
9 $message = 'Got unexpected null';
12 throw new Exception($message);
16 function main(C $obj): void {
17 var_dump(nullthrows($obj));
20 class C { }
22 $obj = new C();
24 main($obj);
25 main($obj);
26 main($obj);
27 main($obj);
28 main($obj);