Skip to content

Commit 4ebdd1a

Browse files
committed
Merge branch '2.4'
* 2.4: udpated LICENSE year update year on licenses rundown and typo fix [Process] Fix #9861 : Revert TTY mode [Form] Update minimal requirement in composer.json Fix Empty translations with Qt files [Console] Fixed command name guessing if an alternative is an alias. Update UPGRADE-2.3.md to account for #9388 [WebProfilerBundle] Fixed profiler toolbar icons for XHTML. [BrowserKit] Throw exception on invalid cookie expiration timestamp [Propel1Bridge][ModelChoiceList] add exception message for invalid classes
2 parents 90cd91b + 86e13d5 commit 4ebdd1a

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

Application.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,16 @@ public function find($name)
561561
throw new \InvalidArgumentException($message);
562562
}
563563

564+
// filter out aliases for commands which are already on the list
565+
if (count($commands) > 1) {
566+
$commandList = $this->commands;
567+
$commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands) {
568+
$commandName = $commandList[$nameOrAlias]->getName();
569+
570+
return $commandName === $nameOrAlias || !in_array($commandName, $commands);
571+
});
572+
}
573+
564574
$exact = in_array($name, $commands, true);
565575
if (count($commands) > 1 && !$exact) {
566576
$suggestions = $this->getAbbreviationSuggestions(array_values($commands));

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2004-2013 Fabien Potencier
1+
Copyright (c) 2004-2014 Fabien Potencier
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

Tests/ApplicationTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,19 @@ public function testFindAlternativeCommands()
393393
}
394394
}
395395

396+
public function testFindAlternativeCommandsWithAnAlias()
397+
{
398+
$fooCommand = new \FooCommand();
399+
$fooCommand->setAliases(array('foo2'));
400+
401+
$application = new Application();
402+
$application->add($fooCommand);
403+
404+
$result = $application->find('foo');
405+
406+
$this->assertSame($fooCommand, $result);
407+
}
408+
396409
public function testFindAlternativeNamespace()
397410
{
398411
$application = new Application();

0 commit comments

Comments
 (0)