1--TEST--
2Scalar type missing parameters
3--FILE--
4<?php
5
6$functions = [
7    'int' => function (int $i) { return $i; },
8    'float' => function (float $f) { return $f; },
9    'string' => function (string $s) { return $s; },
10    'bool' => function (bool $b) { return $b; },
11    'int nullable' => function (int $i = NULL) { return $i; },
12    'float nullable' => function (float $f = NULL) { return $f; },
13    'string nullable' => function (string $s = NULL) { return $s; },
14    'bool nullable' => function (bool $b = NULL) { return $b; }
15];
16
17foreach ($functions as $type => $function) {
18    echo "Testing $type:", PHP_EOL;
19    try {
20        var_dump($function());
21    } catch (Throwable $e) {
22        echo "*** Caught " . $e->getMessage() . PHP_EOL;
23    }
24}
25echo PHP_EOL . "Done";
26?>
27--EXPECTF--
28Testing int:
29*** Caught Too few arguments to function {closure}(), 0 passed in %s on line %d and exactly 1 expected
30Testing float:
31*** Caught Too few arguments to function {closure}(), 0 passed in %s on line %d and exactly 1 expected
32Testing string:
33*** Caught Too few arguments to function {closure}(), 0 passed in %s on line %d and exactly 1 expected
34Testing bool:
35*** Caught Too few arguments to function {closure}(), 0 passed in %s on line %d and exactly 1 expected
36Testing int nullable:
37NULL
38Testing float nullable:
39NULL
40Testing string nullable:
41NULL
42Testing bool nullable:
43NULL
44
45Done
46