File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
src/Symfony/Component/Console/Input Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -150,11 +150,22 @@ protected function parseLongOption($token)
150
150
*/
151
151
protected function parseArgument ($ token )
152
152
{
153
- if (!$ this ->definition ->hasArgument (count ($ this ->arguments ))) {
154
- throw new \RuntimeException ('Too many arguments. ' );
155
- }
153
+ $ c = count ($ this ->arguments );
154
+
155
+ // if input is expecting another argument, add it
156
+ if ($ this ->definition ->hasArgument ($ c )) {
157
+ $ arg = $ this ->definition ->getArgument ($ c );
158
+ $ this ->arguments [$ arg ->getName ()] = $ arg ->isArray ()? array ($ token ) : $ token ;
159
+
160
+ // if last argument isArray(), append token to last argument
161
+ } elseif ($ this ->definition ->hasArgument ($ c - 1 ) && $ this ->definition ->getArgument ($ c - 1 )->isArray ()) {
162
+ $ arg = $ this ->definition ->getArgument ($ c - 1 );
163
+ $ this ->arguments [$ arg ->getName ()][] = $ token ;
156
164
157
- $ this ->arguments [$ this ->definition ->getArgument (count ($ this ->arguments ))->getName ()] = $ token ;
165
+ // unexpected argument
166
+ } else {
167
+ throw new RuntimeException ('Too many arguments. ' );
168
+ }
158
169
}
159
170
160
171
/**
You can’t perform that action at this time.
0 commit comments