File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1006,6 +1006,10 @@ protected function resolvePrimitive(ReflectionParameter $parameter)
1006
1006
return $ parameter ->getDefaultValue ();
1007
1007
}
1008
1008
1009
+ if ($ parameter ->isVariadic ()) {
1010
+ return [];
1011
+ }
1012
+
1009
1013
$ this ->unresolvablePrimitive ($ parameter );
1010
1014
}
1011
1015
Original file line number Diff line number Diff line change @@ -23,6 +23,14 @@ public function testResolvingNonInstantiableWithVariadicRemovesWiths()
23
23
$ this ->assertCount (0 , $ parent ->child ->objects );
24
24
$ this ->assertSame (42 , $ parent ->i );
25
25
}
26
+
27
+ public function testResolveVariadicPrimitive ()
28
+ {
29
+ $ container = new Container ;
30
+ $ parent = $ container ->make (VariadicPrimitive::class);
31
+
32
+ $ this ->assertSame ($ parent ->params , []);
33
+ }
26
34
}
27
35
28
36
interface TestInterface
@@ -73,3 +81,16 @@ public function __construct(TestInterface ...$objects)
73
81
$ this ->objects = $ objects ;
74
82
}
75
83
}
84
+
85
+ class VariadicPrimitive
86
+ {
87
+ /**
88
+ * @var array
89
+ */
90
+ public $ params ;
91
+
92
+ public function __construct (...$ params )
93
+ {
94
+ $ this ->params = $ params ;
95
+ }
96
+ }
You can’t perform that action at this time.
0 commit comments