8000 [Console] Fix global console flag when used in chain · symfony/symfony@52a6cc2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 52a6cc2

Browse files
author
Amrouche Hamza
committed
[Console] Fix global console flag when used in chain
1 parent 73ef74a commit 52a6cc2

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/Symfony/Component/Console/Input/ArgvInput.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,14 @@ public function hasParameterOption($values, $onlyParams = false)
285285
if ($token === $value || 0 === strpos($token, $value.'=')) {
286286
return true;
287287
}
288+
289+
if (0 === strpos($token, '-') && 0 !== strpos($token, '--')) {
290+
$searchableToken = str_replace('-', '', $token);
291+
$searchableValue = str_replace('-', '', $value);
292+
if ('' !== $searchableToken && '' !== $searchableValue && false !== strpos($searchableToken, $searchableValue)) {
293+
return true;
294+
}
295+
}
288296
}
289297
}
290298

src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,9 @@ public function testHasParameterOption()
314314
$input = new ArgvInput(array('cli.php', '-f', 'foo'));
315315
$this->assertTrue($input->hasParameterOption('-f'), '->hasParameterOption() returns true if the given short option is in the raw input');
316316

317+
$input = new ArgvInput(array('cli.php', '-fh'));
318+
$this->assertTrue($input->hasParameterOption('-fh'), '->hasParameterOption() returns true if the given short option is in the raw input');
319+
317320
$input = new ArgvInput(array('cli.php', '--foo', 'foo'));
318321
$this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if the given short option is in the raw input');
319322

0 commit comments

Comments
 (0)
0