summaryrefslogtreecommitdiff
path: root/Zend/tests/function_arguments/variadic_argument_type_error.phpt
blob: 3a9bc050ccc35335a7fb11bcb6ff5957f810b626 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
--TEST--
Call userland function with incorrect variadic argument type
--FILE--
<?php

function foo($foo, int ...$bar) {}

try {
    foo(1, []);
} catch (TypeError $exception) {
    echo $exception->getMessage() . "\n";
}

try {
    foo(1, 1, 1, []);
} catch (TypeError $exception) {
    echo $exception->getMessage() . "\n";
}

--EXPECTF--
foo(): Argument #2 ($bar) must be of type int, array given, called in %s on line %d
foo(): Argument #4 ($bar) must be of type int, array given, called in %s on line %d