Merge branch '5.0'
* 5.0: 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 [HttpKernel] Fix method name in doc comments
This commit is contained in:
commit
4c1ca329a4
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -647,7 +647,15 @@ class Application implements ResetInterface
|
|||
// 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);
|
||||
}
|
||||
|
@ -656,8 +664,14 @@ class Application implements ResetInterface
|
|||
|
||||
$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) {
|
||||
|
|
|
@ -1692,6 +1692,31 @@ class ApplicationTest extends TestCase
|
|||
$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();
|
||||
|
|
|
@ -782,6 +782,10 @@ class Finder implements \IteratorAggregate, \Countable
|
|||
*/
|
||||
private function normalizeDir(string $dir): string
|
||||
{
|
||||
if ('/' === $dir) {
|
||||
return $dir;
|
||||
}
|
||||
|
||||
$dir = rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
|
||||
|
||||
if (preg_match('#^(ssh2\.)?s?ftp://#', $dir)) {
|
||||
|
|
|
@ -70,7 +70,11 @@ class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
|
|||
}
|
||||
$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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -21,7 +21,7 @@ use Symfony\Component\HttpKernel\HttpKernelInterface;
|
|||
* current request. The propagation of this event is stopped as soon as a
|
||||
* response is set.
|
||||
*
|
||||
* You can also call setException() to replace the thrown exception. This
|
||||
* You can also call setThrowable() to replace the thrown exception. This
|
||||
* exception will be thrown if no response is set during processing of this
|
||||
* event.
|
||||
*
|
||||
|
|
Reference in New Issue