Aggiornato Composer
This commit is contained in:
73
vendor/symfony/console/Application.php
vendored
73
vendor/symfony/console/Application.php
vendored
@@ -134,7 +134,7 @@ class Application implements ResetInterface
|
||||
*
|
||||
* @throws \Exception When running fails. Bypass this when {@link setCatchExceptions()}.
|
||||
*/
|
||||
public function run(InputInterface $input = null, OutputInterface $output = null)
|
||||
public function run(?InputInterface $input = null, ?OutputInterface $output = null)
|
||||
{
|
||||
if (\function_exists('putenv')) {
|
||||
@putenv('LINES='.$this->terminal->getHeight());
|
||||
@@ -276,7 +276,9 @@ class Application implements ResetInterface
|
||||
$alternative = $alternatives[0];
|
||||
|
||||
$style = new SymfonyStyle($input, $output);
|
||||
$style->block(sprintf("\nCommand \"%s\" is not defined.\n", $name), null, 'error');
|
||||
$output->writeln('');
|
||||
$formattedBlock = (new FormatterHelper())->formatBlock(sprintf('Command "%s" is not defined.', $name), 'error', true);
|
||||
$output->writeln($formattedBlock);
|
||||
if (!$style->confirm(sprintf('Do you want to run "%s" instead? ', $alternative), false)) {
|
||||
if (null !== $this->dispatcher) {
|
||||
$event = new ConsoleErrorEvent($input, $output, $e);
|
||||
@@ -363,9 +365,18 @@ class Application implements ResetInterface
|
||||
CompletionInput::TYPE_ARGUMENT_VALUE === $input->getCompletionType()
|
||||
&& 'command' === $input->getCompletionName()
|
||||
) {
|
||||
$suggestions->suggestValues(array_filter(array_map(function (Command $command) {
|
||||
return $command->isHidden() ? null : $command->getName();
|
||||
}, $this->all())));
|
||||
$commandNames = [];
|
||||
foreach ($this->all() as $name => $command) {
|
||||
// skip hidden commands and aliased commands as they already get added below
|
||||
if ($command->isHidden() || $command->getName() !== $name) {
|
||||
continue;
|
||||
}
|
||||
$commandNames[] = $command->getName();
|
||||
foreach ($command->getAliases() as $name) {
|
||||
$commandNames[] = $name;
|
||||
}
|
||||
}
|
||||
$suggestions->suggestValues(array_filter($commandNames));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -767,7 +778,7 @@ class Application implements ResetInterface
|
||||
*
|
||||
* @return Command[]
|
||||
*/
|
||||
public function all(string $namespace = null)
|
||||
public function all(?string $namespace = null)
|
||||
{
|
||||
$this->init();
|
||||
|
||||
@@ -924,11 +935,21 @@ class Application implements ResetInterface
|
||||
}
|
||||
|
||||
switch ($shellVerbosity = (int) getenv('SHELL_VERBOSITY')) {
|
||||
case -1: $output->setVerbosity(OutputInterface::VERBOSITY_QUIET); break;
|
||||
case 1: $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE); break;
|
||||
case 2: $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE); break;
|
||||
case 3: $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG); break;
|
||||
default: $shellVerbosity = 0; break;
|
||||
case -1:
|
||||
$output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
|
||||
break;
|
||||
case 1:
|
||||
$output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
|
||||
break;
|
||||
case 2:
|
||||
$output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
|
||||
break;
|
||||
case 3:
|
||||
$output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
|
||||
break;
|
||||
default:
|
||||
$shellVerbosity = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (true === $input->hasParameterOption(['--quiet', '-q'], true)) {
|
||||
@@ -974,22 +995,26 @@ class Application implements ResetInterface
|
||||
}
|
||||
}
|
||||
|
||||
if ($command instanceof SignalableCommandInterface && ($this->signalsToDispatchEvent || $command->getSubscribedSignals())) {
|
||||
if (!$this->signalRegistry) {
|
||||
throw new RuntimeException('Unable to subscribe to signal events. Make sure that the `pcntl` extension is installed and that "pcntl_*" functions are not disabled by your php.ini\'s "disable_functions" directive.');
|
||||
}
|
||||
if ($this->signalsToDispatchEvent) {
|
||||
$commandSignals = $command instanceof SignalableCommandInterface ? $command->getSubscribedSignals() : [];
|
||||
|
||||
if (Terminal::hasSttyAvailable()) {
|
||||
$sttyMode = shell_exec('stty -g');
|
||||
if ($commandSignals || null !== $this->dispatcher) {
|
||||
if (!$this->signalRegistry) {
|
||||
throw new RuntimeException('Unable to subscribe to signal events. Make sure that the `pcntl` extension is installed and that "pcntl_*" functions are not disabled by your php.ini\'s "disable_functions" directive.');
|
||||
}
|
||||
|
||||
foreach ([\SIGINT, \SIGTERM] as $signal) {
|
||||
$this->signalRegistry->register($signal, static function () use ($sttyMode) {
|
||||
shell_exec('stty '.$sttyMode);
|
||||
});
|
||||
if (Terminal::hasSttyAvailable()) {
|
||||
$sttyMode = shell_exec('stty -g');
|
||||
|
||||
foreach ([\SIGINT, \SIGTERM] as $signal) {
|
||||
$this->signalRegistry->register($signal, static function () use ($sttyMode) {
|
||||
shell_exec('stty '.$sttyMode);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->dispatcher) {
|
||||
if (null !== $this->dispatcher) {
|
||||
foreach ($this->signalsToDispatchEvent as $signal) {
|
||||
$event = new ConsoleSignalEvent($command, $input, $output, $signal);
|
||||
|
||||
@@ -1006,7 +1031,7 @@ class Application implements ResetInterface
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($command->getSubscribedSignals() as $signal) {
|
||||
foreach ($commandSignals as $signal) {
|
||||
$this->signalRegistry->register($signal, [$command, 'handleSignal']);
|
||||
}
|
||||
}
|
||||
@@ -1122,7 +1147,7 @@ class Application implements ResetInterface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function extractNamespace(string $name, int $limit = null)
|
||||
public function extractNamespace(string $name, ?int $limit = null)
|
||||
{
|
||||
$parts = explode(':', $name, -1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user