8000 Merge branch '5.0' · symfony/symfony@4c1ca32 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4c1ca32

Browse files
committed
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
2 parents c09128c + 05f71d3 commit 4c1ca32

File tree

7 files changed

+54
-7
lines changed

7 files changed

+54
-7
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
Replace this notice by a short README for your feature/bugfix. This will help people
1212
understand your PR and can be used as a start for the documentation.
1313
14-
Additionally (see https://symfony.com/roadmap):
14+
Additionally (see https://symfony.com/releases):
1515
- Always add tests and ensure they pass.
1616
- Never break backward compatibility (see https://symfony.com/bc).
1717
- Bug fixes must be submitted against the lowest maintained branch where they apply

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153
<td class="font-normal">{{ collector.symfonyeom }}</td>
154154
<td class="font-normal">{{ collector.symfonyeol }}</td>
155155
<td class="font-normal">
156-
<a href="https://symfony.com/roadmap?version={{ collector.symfonyminorversion }}#checker">View roadmap</a>
156+
<a href="https://symfony.com/releases/{{ collector.symfonyminorversion }}#release-checker">View roadmap</a>
157157
</td>
158158
</tr>
159159
</tbody>

src/Symfony/Component/Console/Application.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,15 @@ public function find(string $name)
647647
// filter out aliases for commands which are already on the list
648648
if (\count($commands) > 1) {
649649
$commandList = $this->commandLoader ? array_merge(array_flip($this->commandLoader->getNames()), $this->commands) : $this->commands;
650-
$commands = array_unique(array_filter($commands, function ($nameOrAlias) use (&$commandList, $commands, &$aliases) {
650+
651+
if (isset($commandList[$name])) {
652+
return $this->get($name);
653+
}
654+
655+
foreach ($commands as $k => $nameOrAlias) {
656+
if ($nameOrAlias === $name) {
657+
return $this->get($nameOrAlias);
658+
}
651659
if (!$commandList[$nameOrAlias] instanceof Command) {
652660
$commandList[$nameOrAlias] = $this->commandLoader->get($nameOrAlias);
653661
}
@@ -656,8 +664,14 @@ public function find(string $name)
656664

657665
$aliases[$nameOrAlias] = $commandName;
658666

659-
return $commandName === $nameOrAlias || !\in_array($commandName, $commands);
660-
}));
667+
if ($commandName === $nameOrAlias || !\in_array($commandName, $commands)) {
668+
continue;
669+
}
670+
671+
unset($commands[$k]);
672+
}
673+
674+
$commands = array_unique($commands);
661675
}
662676

663677
if (\count($commands) > 1) {

src/Symfony/Component/Console/Tests/ApplicationTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,6 +1692,31 @@ public function testAllExcludesDisabledLazyCommand()
16921692
$this->assertArrayNotHasKey('disabled', $application->all());
16931693
}
16941694

1695+
public function testFindAlternativesDoesNotLoadSameNamespaceCommandsOnExactMatch()
1696+
{
1697+
$application = new Application();
1698+
$application->setAutoExit(false);
1699+
1700+
$loaded = [];
1701+
1702+
$application->setCommandLoader(new FactoryCommandLoader([
1703+
'foo:bar' => function () use (&$loaded) {
1704+
$loaded['foo:bar'] = true;
1705+
1706+
return (new Command('foo:bar'))->setCode(function () {});
1707+
},
1708+
'foo' => function () use (&$loaded) {
1709+
$loaded['foo'] = true;
1710+
1711+
return (new Command('foo'))->setCode(function () {});
1712+
},
1713+
]));
1714+
1715+
$application->run(new ArrayInput(['command' => 'foo']), new NullOutput());
1716+
1717+
$this->assertSame(['foo' => true], $loaded);
1718+
}
1719+
16951720
protected function getDispatcher($skipCommand = false)
16961721
{
16971722
$dispatcher = new EventDispatcher();

src/Symfony/Component/Finder/Finder.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,10 @@ private function searchInDirectory(string $dir): \Iterator
782782
*/
783783
private function normalizeDir(string $dir): string
784784
{
785+
if ('/' === $dir) {
786+
return $dir;
787+
}
788+
785789
$dir = rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
786790

787791
if (preg_match('#^(ssh2\.)?s?ftp://#', $dir)) {

src/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ public function current()
7070
}
7171
$subPathname .= $this->getFilename();
7272

73-
return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
73+
if ('/' !== $basePath = $this->rootPath) {
74+
$basePath .= $this->directorySeparator;
75+
}
76+
77+
return new SplFileInfo($basePath.$subPathname, $this->subPath, $subPathname);
7478
}
7579

7680
/**

src/Symfony/Component/HttpKernel/Event/ExceptionEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* current request. The propagation of this event is stopped as soon as a
2222
* response is set.
2323
*
24-
* You can also call setException() to replace the thrown exception. This
24+
* You can also call setThrowable() to replace the thrown exception. This
2525
* exception will be thrown if no response is set during processing of this
2626
* event.
2727
*

0 commit comments

Comments
 (0)
0