1--TEST--
2Call userland function with incorrect number of arguments with strict types
3--FILE--
4<?php
5declare(strict_types=1);
6try {
7    function foo($bar) { }
8    foo();
9} catch (\Error $e) {
10    echo get_class($e) . PHP_EOL;
11    echo $e->getMessage() . PHP_EOL;
12}
13
14try {
15    function bar($foo, $bar) { }
16    bar(1);
17} catch (\Error $e) {
18    echo get_class($e) . PHP_EOL;
19    echo $e->getMessage() . PHP_EOL;
20}
21
22function bat(int $foo, string $bar) { }
23
24try {
25    bat(123);
26} catch (\Error $e) {
27    echo get_class($e) . PHP_EOL;
28    echo $e->getMessage() . PHP_EOL;
29}
30
31try {
32    bat("123");
33} catch (\Error $e) {
34    echo get_class($e) . PHP_EOL;
35    echo $e->getMessage() . PHP_EOL;
36}
37
38try {
39    bat(123, 456);
40} catch (\Error $e) {
41    echo get_class($e) . PHP_EOL;
42    echo $e->getMessage() . PHP_EOL;
43}
44?>
45--EXPECTF--
46ArgumentCountError
47Too few arguments to function foo(), 0 passed in %s and exactly 1 expected
48ArgumentCountError
49Too few arguments to function bar(), 1 passed in %s and exactly 2 expected
50ArgumentCountError
51Too few arguments to function bat(), 1 passed in %s and exactly 2 expected
52TypeError
53bat(): Argument #1 ($foo) must be of type int, string given, called in %s on line %d
54TypeError
55bat(): Argument #2 ($bar) must be of type string, int given, called in %s on line %d
56