File tree 2 files changed +13
-2
lines changed
Filter options
src/Symfony/Component/Console
2 files changed +13
-2
lines changed
Original file line number Diff line number Diff line change @@ -168,12 +168,12 @@ private function parseArgument($token)
168
168
$ arg = $ this ->definition ->getArgument ($ c );
169
169
$ this ->arguments [$ arg ->getName ()] = $ arg ->isArray () ? array ($ token ) : $ token ;
170
170
171
- // if last argument isArray(), append token to last argument
171
+ // if last argument isArray(), append token to last argument
172
172
} elseif ($ this ->definition ->hasArgument ($ c - 1 ) && $ this ->definition ->getArgument ($ c - 1 )->isArray ()) {
173
173
$ arg = $ this ->definition ->getArgument ($ c - 1 );
174
174
$ this ->arguments [$ arg ->getName ()][] = $ token ;
175
175
176
- // unexpected argument
176
+ // unexpected argument
177
177
} else {
178
178
$ all = $ this ->definition ->getArguments ();
179
179
if (count ($ all )) {
@@ -282,6 +282,14 @@ public function hasParameterOption($values)
282
282
if ($ token === $ value || 0 === strpos ($ token , $ value .'= ' )) {
283
283
return true ;
284
284
}
285
+
286
+ if (0 === strpos ($ token , '- ' ) && 0 !== strpos ($ token , '-- ' )) {
287
+ $ searchableToken = str_replace ('- ' , '' , $ token );
288
+ $ searchableValue = str_replace ('- ' , '' , $ value );
289
+ if ('' !== $ searchableToken && '' !== $ searchableValue && false !== strpos ($ searchableToken , $ searchableValue )) {
290
+ return true ;
291
+ }
292
+ }
285
293
}
286
294
}
287
295
Original file line number Diff line number Diff line change @@ -296,6 +296,9 @@ public function testHasParameterOption()
296
296
$ input = new ArgvInput (array ('cli.php ' , '-f ' , 'foo ' ));
297
297
$ this ->assertTrue ($ input ->hasParameterOption ('-f ' ), '->hasParameterOption() returns true if the given short option is in the raw input ' );
298
298
299
+ $ input = new ArgvInput (array ('cli.php ' , '-fh ' ));
300
+ $ this ->assertTrue ($ input ->hasParameterOption ('-fh ' ), '->hasParameterOption() returns true if the given short option is in the raw input ' );
301
+
299
302
$ input = new ArgvInput (array ('cli.php ' , '--foo ' , 'foo ' ));
300
303
$ this ->assertTrue ($ input ->hasParameterOption ('--foo ' ), '->hasParameterOption() returns true if the given short option is in the raw input ' );
301
304
You can’t perform that action at this time.
0 commit comments