xref: /PHP-8.1/Zend/tests/arg_unpack/method.phpt (revision d3b484df)
1--TEST--
2Unpack arguments for method calls
3--FILE--
4<?php
5
6class Foo {
7    public function test(...$args) {
8        var_dump($args);
9    }
10
11    public static function test2(...$args) {
12        var_dump($args);
13    }
14}
15
16$foo = new Foo;
17Foo::test2(1, 2, ...[3, 4], ...[], ...[5]);
18
19?>
20--EXPECT--
21array(5) {
22  [0]=>
23  int(1)
24  [1]=>
25  int(2)
26  [2]=>
27  int(3)
28  [3]=>
29  int(4)
30  [4]=>
31  int(5)
32}
33