5 function main_scalar_none() {
6 require 'fix_exceptions.inc';
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
;
22 var_dump($function(null));
23 } catch (TypeError
$e) {
24 echo "*** Caught " . $e->getMessage() . PHP_EOL
;
27 echo PHP_EOL
. "Done";