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--EXPECTF-- 27Testing int: 28*** Caught Too few arguments to function {closure}(), 0 passed in %s on line %d and exactly 1 expected 29Testing float: 30*** Caught Too few arguments to function {closure}(), 0 passed in %s on line %d and exactly 1 expected 31Testing string: 32*** Caught Too few arguments to function {closure}(), 0 passed in %s on line %d and exactly 1 expected 33Testing bool: 34*** Caught Too few arguments to function {closure}(), 0 passed in %s on line %d and exactly 1 expected 35Testing int nullable: 36NULL 37Testing float nullable: 38NULL 39Testing string nullable: 40NULL 41Testing bool nullable: 42NULL 43 44Done 45