Skip to content

Commit 44ae97e

Browse files
Merge branch '7.4' into 8.0
* 7.4: [Security] Set OIDC JWKS cache TTL from provider headers [DependencyInjection] Call default index method when index is not provided by tag [Console] Remove a redundant local variable in the console Application class. [Cache] Recognize commit events as writes in `CacheDataCollector` [Routing] Align routing.schema.json with YamlFileLoader behavior Bump Symfony version to 7.4.0 Update VERSION for 7.4.0-RC1 Update CHANGELOG for 7.4.0-RC1
2 parents b8dfdb6 + 87ad3ca commit 44ae97e

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

Application.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,7 @@ public function getDefinition(): InputDefinition
389389
$this->definition ??= $this->getDefaultInputDefinition();
390390

391391
if ($this->singleCommand) {
392-
$inputDefinition = $this->definition;
393-
$inputDefinition->setArguments();
394-
395-
return $inputDefinition;
392+
$this->definition->setArguments();
396393
}
397394

398395
return $this->definition;

Tests/ApplicationTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,6 +1480,31 @@ public function testSettingCustomInputDefinitionOverwritesDefaultValues()
14801480
$this->assertTrue($inputDefinition->hasOption('custom'));
14811481
}
14821482

1483+
public function testItRemovesArgumentsFromInputDefinitionOnSingleCommandApplication()
1484+
{
1485+
$application = new Application();
1486+
$application->setAutoExit(false);
1487+
$application->setCatchExceptions(false);
1488+
1489+
$application->setDefaultCommand('list', true); // It's a single command application.
1490+
1491+
$inputDefinition = $application->getDefinition();
1492+
1493+
// $inputDefinition->setArguments() is called to remove default arguments.
1494+
$this->assertSame(0, $inputDefinition->getArgumentCount());
1495+
$this->assertFalse($inputDefinition->hasArgument('command'));
1496+
1497+
// $inputDefinition->setOptions() is not called to leave default options as they are.
1498+
$this->assertTrue($inputDefinition->hasOption('help'));
1499+
$this->assertTrue($inputDefinition->hasOption('quiet'));
1500+
$this->assertTrue($inputDefinition->hasOption('verbose'));
1501+
$this->assertTrue($inputDefinition->hasOption('version'));
1502+
$this->assertTrue($inputDefinition->hasOption('ansi'));
1503+
$this->assertTrue($inputDefinition->hasNegation('no-ansi'));
1504+
$this->assertFalse($inputDefinition->hasOption('no-ansi'));
1505+
$this->assertTrue($inputDefinition->hasOption('no-interaction'));
1506+
}
1507+
14831508
public function testRunWithDispatcher()
14841509
{
14851510
$application = new Application();

0 commit comments

Comments
 (0)