Skip to content

Commit

Permalink
Merge branch '3.4' into 4.4
Browse files Browse the repository at this point in the history
* 3.4:
  fix unix root dir issue
  sync validator translation files with master
  fix anchor
  fix links to releases page (formerly known as "roadmap")
  [Console] Don't load same-namespace alternatives on exact match found
  • Loading branch information
fabpot committed Feb 14, 2020
2 parents 1a7e4ea + f6f6a60 commit 7a6e3c0
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Expand Up @@ -11,7 +11,7 @@
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.
Additionally (see https://symfony.com/roadmap):
Additionally (see https://symfony.com/releases):
- Always add tests and ensure they pass.
- Never break backward compatibility (see https://symfony.com/bc).
- Bug fixes must be submitted against the lowest maintained branch where they apply
Expand Down
Expand Up @@ -153,7 +153,7 @@
<td class="font-normal">{{ collector.symfonyeom }}</td>
<td class="font-normal">{{ collector.symfonyeol }}</td>
<td class="font-normal">
<a href="https://symfony.com/roadmap?version={{ collector.symfonyminorversion }}#checker">View roadmap</a>
<a href="https://symfony.com/releases/{{ collector.symfonyminorversion }}#release-checker">View roadmap</a>
</td>
</tr>
</tbody>
Expand Down
20 changes: 17 additions & 3 deletions src/Symfony/Component/Console/Application.php
Expand Up @@ -672,7 +672,15 @@ public function find($name)
// filter out aliases for commands which are already on the list
if (\count($commands) > 1) {
$commandList = $this->commandLoader ? array_merge(array_flip($this->commandLoader->getNames()), $this->commands) : $this->commands;
$commands = array_unique(array_filter($commands, function ($nameOrAlias) use (&$commandList, $commands, &$aliases) {

if (isset($commandList[$name])) {
return $this->get($name);
}

foreach ($commands as $k => $nameOrAlias) {
if ($nameOrAlias === $name) {
return $this->get($nameOrAlias);
}
if (!$commandList[$nameOrAlias] instanceof Command) {
$commandList[$nameOrAlias] = $this->commandLoader->get($nameOrAlias);
}
Expand All @@ -681,8 +689,14 @@ public function find($name)

$aliases[$nameOrAlias] = $commandName;

return $commandName === $nameOrAlias || !\in_array($commandName, $commands);
}));
if ($commandName === $nameOrAlias || !\in_array($commandName, $commands)) {
continue;
}

unset($commands[$k]);
}

$commands = array_unique($commands);
}

if (\count($commands) > 1) {
Expand Down
25 changes: 25 additions & 0 deletions src/Symfony/Component/Console/Tests/ApplicationTest.php
Expand Up @@ -1706,6 +1706,31 @@ public function testAllExcludesDisabledLazyCommand()
$this->assertArrayNotHasKey('disabled', $application->all());
}

public function testFindAlternativesDoesNotLoadSameNamespaceCommandsOnExactMatch()
{
$application = new Application();
$application->setAutoExit(false);

$loaded = [];

$application->setCommandLoader(new FactoryCommandLoader([
'foo:bar' => function () use (&$loaded) {
$loaded['foo:bar'] = true;

return (new Command('foo:bar'))->setCode(function () {});
},
'foo' => function () use (&$loaded) {
$loaded['foo'] = true;

return (new Command('foo'))->setCode(function () {});
},
]));

$application->run(new ArrayInput(['command' => 'foo']), new NullOutput());

$this->assertSame(['foo' => true], $loaded);
}

protected function getDispatcher($skipCommand = false)
{
$dispatcher = new EventDispatcher();
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/Finder/Finder.php
Expand Up @@ -797,6 +797,10 @@ private function searchInDirectory(string $dir): \Iterator
*/
private function normalizeDir(string $dir): string
{
if ('/' === $dir) {
return $dir;
}

$dir = rtrim($dir, '/'.\DIRECTORY_SEPARATOR);

if (preg_match('#^(ssh2\.)?s?ftp://#', $dir)) {
Expand Down
Expand Up @@ -70,7 +70,11 @@ public function current()
}
$subPathname .= $this->getFilename();

return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
if ('/' !== $basePath = $this->rootPath) {
$basePath .= $this->directorySeparator;
}

return new SplFileInfo($basePath.$subPathname, $this->subPath, $subPathname);
}

/**
Expand Down
Expand Up @@ -366,6 +366,10 @@
<source>This value should be between {{ min }} and {{ max }}.</source>
<target>Dieser Wert sollte zwischen {{ min }} und {{ max }} sein.</target>
</trans-unit>
<trans-unit id="95">
<source>This value is not a valid hostname.</source>
<target>Dieser Wert ist kein gültiger Hostname.</target>
</trans-unit>
</body>
</file>
</xliff>
Expand Up @@ -366,6 +366,10 @@
<source>This value should be between {{ min }} and {{ max }}.</source>
<target>This value should be between {{ min }} and {{ max }}.</target>
</trans-unit>
<trans-unit id="95">
<source>This value is not a valid hostname.</source>
<target>This value is not a valid hostname.</target>
</trans-unit>
</body>
</file>
</xliff>
Expand Up @@ -366,6 +366,10 @@
<source>This value should be between {{ min }} and {{ max }}.</source>
<target>Cette valeur doit être comprise entre {{ min }} et {{ max }}.</target>
</trans-unit>
<trans-unit id="95">
<source>This value is not a valid hostname.</source>
<target>Cette valeur n'est pas un nom d'hôte valide.</target>
</trans-unit>
</body>
</file>
</xliff>
Expand Up @@ -366,6 +366,10 @@
<source>This value should be between {{ min }} and {{ max }}.</source>
<target>Значение должно быть между {{ min }} и {{ max }}.</target>
</trans-unit>
<trans-unit id="95">
<source>This value is not a valid hostname.</source>
<target>Значение не является корректным именем хоста.</target>
</trans-unit>
</body>
</file>
</xliff>

0 comments on commit 7a6e3c0

Please sign in to comment.