Make too few args throw instead of log
[hiphop-php.git] / hphp / test / slow / php7_backported / scalar-types / scalar_none.php
blob26c54cdb850604d24489141a6d1671455a181977
1 <?php
4 <<__EntryPoint>>
5 function main_scalar_none() {
6 require 'fix_exceptions.inc';
8 $functions = [
9 'int' => function (int $i) { return $i; },
10 'float' => function (float $f) { return $f; },
11 'string' => function (string $s) { return $s; },
12 'bool' => function (bool $b) { return $b; },
13 'int nullable' => function (int $i = NULL) { return $i; },
14 'float nullable' => function (float $f = NULL) { return $f; },
15 'string nullable' => function (string $s = NULL) { return $s; },
16 'bool nullable' => function (bool $b = NULL) { return $b; }
19 foreach ($functions as $type => $function) {
20 echo "Testing $type:", PHP_EOL;
21 try {
22 var_dump($function(null));
23 } catch (TypeError $e) {
24 echo "*** Caught " . $e->getMessage() . PHP_EOL;
27 echo PHP_EOL . "Done";