Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 74de6ec

Browse filesBrowse files
bug #41675 [Runtime] fix overriding --env|-e with single-command apps (nicolas-grekas)
This PR was merged into the 5.3 branch. Discussion ---------- [Runtime] fix overriding --env|-e with single-command apps | Q | A | ------------- | --- | Branch? | 5.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #41658 | License | MIT | Doc PR | - Commits ------- 25fb2f7 [Runtime] fix overriding --env|-e with single-command apps
2 parents 57e1952 + 25fb2f7 commit 74de6ec
Copy full SHA for 74de6ec

File tree

2 files changed

+6
-4
lines changed
Filter options

2 files changed

+6
-4
lines changed

‎src/Symfony/Component/Runtime/SymfonyRuntime.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Runtime/SymfonyRuntime.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ public function getRunner(?object $application): RunnerInterface
131131
}
132132

133133
$console->setDefaultCommand($application->getName(), true);
134+
$console->getDefinition()->addOptions($application->getDefinition()->getOptions());
134135

135136
return $this->getRunner($console);
136137
}

‎src/Symfony/Component/Runtime/Tests/phpt/command.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Runtime/Tests/phpt/command.php
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
use Symfony\Component\Console\Command\Command;
44
use Symfony\Component\Console\Input\InputInterface;
5+
use Symfony\Component\Console\Input\InputOption;
56
use Symfony\Component\Console\Output\OutputInterface;
67

78
require __DIR__.'/autoload.php';
89

910
return function (Command $command, InputInterface $input, OutputInterface $output, array $context) {
10-
$command->setCode(function () use ($output, $context) {
11-
$output->write('OK Command '.$context['SOME_VAR']);
12-
});
11+
$command->addOption('hello', 'e', InputOption::VALUE_REQUIRED, 'How should I greet?', 'OK');
1312

14-
return $command;
13+
return $command->setCode(function () use ($input, $output, $context) {
14+
$output->write($input->getOption('hello').' Command '.$context['SOME_VAR']);
15+
});
1516
};

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.