Updated Rector to commit 6c8197667db0cb463eeda93b14b4c6f36e4aab05

6c8197667d [Scoped] Exclude symfony/console/Debug/CliRequest.php from parallel-lint PHP 7.2 syntax check (#5304)
This commit is contained in:
Tomas Votruba 2023-11-30 18:02:55 +00:00
parent 35f86a2fad
commit a1e301f6e8
32 changed files with 973 additions and 69 deletions

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '91f9f3057c2d51018228ed89273a76da991d3f45';
public const PACKAGE_VERSION = '6c8197667db0cb463eeda93b14b4c6f36e4aab05';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-11-30 17:03:56';
public const RELEASE_DATE = '2023-11-30 18:00:19';
/**
* @var int
*/

2
vendor/autoload.php vendored
View File

@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit6ee5b17c87a6bea7c9006b4ba8060b02::getLoader();
return ComposerAutoloaderInita55c41c7fa52abd86138c6f32df1d185::getLoader();

View File

@ -772,6 +772,7 @@ return array(
'RectorPrefix202311\\Symfony\\Component\\Console\\Command\\ListCommand' => $vendorDir . '/symfony/console/Command/ListCommand.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Command\\LockableTrait' => $vendorDir . '/symfony/console/Command/LockableTrait.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Command\\SignalableCommandInterface' => $vendorDir . '/symfony/console/Command/SignalableCommandInterface.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Command\\TraceableCommand' => $vendorDir . '/symfony/console/Command/TraceableCommand.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Completion\\CompletionInput' => $vendorDir . '/symfony/console/Completion/CompletionInput.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Completion\\CompletionSuggestions' => $vendorDir . '/symfony/console/Completion/CompletionSuggestions.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Completion\\Output\\BashCompletionOutput' => $vendorDir . '/symfony/console/Completion/Output/BashCompletionOutput.php',
@ -781,6 +782,8 @@ return array(
'RectorPrefix202311\\Symfony\\Component\\Console\\Completion\\Suggestion' => $vendorDir . '/symfony/console/Completion/Suggestion.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\ConsoleEvents' => $vendorDir . '/symfony/console/ConsoleEvents.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Cursor' => $vendorDir . '/symfony/console/Cursor.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\DataCollector\\CommandDataCollector' => $vendorDir . '/symfony/console/DataCollector/CommandDataCollector.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Debug\\CliRequest' => $vendorDir . '/symfony/console/Debug/CliRequest.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\DependencyInjection\\AddConsoleCommandPass' => $vendorDir . '/symfony/console/DependencyInjection/AddConsoleCommandPass.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Descriptor\\ApplicationDescription' => $vendorDir . '/symfony/console/Descriptor/ApplicationDescription.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Descriptor\\Descriptor' => $vendorDir . '/symfony/console/Descriptor/Descriptor.php',
@ -797,6 +800,7 @@ return array(
'RectorPrefix202311\\Symfony\\Component\\Console\\Exception\\LogicException' => $vendorDir . '/symfony/console/Exception/LogicException.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Exception\\MissingInputException' => $vendorDir . '/symfony/console/Exception/MissingInputException.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Exception\\NamespaceNotFoundException' => $vendorDir . '/symfony/console/Exception/NamespaceNotFoundException.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Exception\\RunCommandFailedException' => $vendorDir . '/symfony/console/Exception/RunCommandFailedException.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Exception\\RuntimeException' => $vendorDir . '/symfony/console/Exception/RuntimeException.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Formatter\\NullOutputFormatter' => $vendorDir . '/symfony/console/Formatter/NullOutputFormatter.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Formatter\\NullOutputFormatterStyle' => $vendorDir . '/symfony/console/Formatter/NullOutputFormatterStyle.php',
@ -837,6 +841,9 @@ return array(
'RectorPrefix202311\\Symfony\\Component\\Console\\Input\\StreamableInputInterface' => $vendorDir . '/symfony/console/Input/StreamableInputInterface.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Input\\StringInput' => $vendorDir . '/symfony/console/Input/StringInput.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Logger\\ConsoleLogger' => $vendorDir . '/symfony/console/Logger/ConsoleLogger.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Messenger\\RunCommandContext' => $vendorDir . '/symfony/console/Messenger/RunCommandContext.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Messenger\\RunCommandMessage' => $vendorDir . '/symfony/console/Messenger/RunCommandMessage.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Messenger\\RunCommandMessageHandler' => $vendorDir . '/symfony/console/Messenger/RunCommandMessageHandler.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Output\\AnsiColorMode' => $vendorDir . '/symfony/console/Output/AnsiColorMode.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Output\\BufferedOutput' => $vendorDir . '/symfony/console/Output/BufferedOutput.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Output\\ConsoleOutput' => $vendorDir . '/symfony/console/Output/ConsoleOutput.php',
@ -850,6 +857,7 @@ return array(
'RectorPrefix202311\\Symfony\\Component\\Console\\Question\\ChoiceQuestion' => $vendorDir . '/symfony/console/Question/ChoiceQuestion.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Question\\ConfirmationQuestion' => $vendorDir . '/symfony/console/Question/ConfirmationQuestion.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Question\\Question' => $vendorDir . '/symfony/console/Question/Question.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\SignalRegistry\\SignalMap' => $vendorDir . '/symfony/console/SignalRegistry/SignalMap.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\SignalRegistry\\SignalRegistry' => $vendorDir . '/symfony/console/SignalRegistry/SignalRegistry.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\SingleCommandApplication' => $vendorDir . '/symfony/console/SingleCommandApplication.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Style\\OutputStyle' => $vendorDir . '/symfony/console/Style/OutputStyle.php',

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit6ee5b17c87a6bea7c9006b4ba8060b02
class ComposerAutoloaderInita55c41c7fa52abd86138c6f32df1d185
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit6ee5b17c87a6bea7c9006b4ba8060b02
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit6ee5b17c87a6bea7c9006b4ba8060b02', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInita55c41c7fa52abd86138c6f32df1d185', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit6ee5b17c87a6bea7c9006b4ba8060b02', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInita55c41c7fa52abd86138c6f32df1d185', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit6ee5b17c87a6bea7c9006b4ba8060b02::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInita55c41c7fa52abd86138c6f32df1d185::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit6ee5b17c87a6bea7c9006b4ba8060b02::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInita55c41c7fa52abd86138c6f32df1d185::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit6ee5b17c87a6bea7c9006b4ba8060b02
class ComposerStaticInita55c41c7fa52abd86138c6f32df1d185
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -990,6 +990,7 @@ class ComposerStaticInit6ee5b17c87a6bea7c9006b4ba8060b02
'RectorPrefix202311\\Symfony\\Component\\Console\\Command\\ListCommand' => __DIR__ . '/..' . '/symfony/console/Command/ListCommand.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Command\\LockableTrait' => __DIR__ . '/..' . '/symfony/console/Command/LockableTrait.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Command\\SignalableCommandInterface' => __DIR__ . '/..' . '/symfony/console/Command/SignalableCommandInterface.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Command\\TraceableCommand' => __DIR__ . '/..' . '/symfony/console/Command/TraceableCommand.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Completion\\CompletionInput' => __DIR__ . '/..' . '/symfony/console/Completion/CompletionInput.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Completion\\CompletionSuggestions' => __DIR__ . '/..' . '/symfony/console/Completion/CompletionSuggestions.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Completion\\Output\\BashCompletionOutput' => __DIR__ . '/..' . '/symfony/console/Completion/Output/BashCompletionOutput.php',
@ -999,6 +1000,8 @@ class ComposerStaticInit6ee5b17c87a6bea7c9006b4ba8060b02
'RectorPrefix202311\\Symfony\\Component\\Console\\Completion\\Suggestion' => __DIR__ . '/..' . '/symfony/console/Completion/Suggestion.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\ConsoleEvents' => __DIR__ . '/..' . '/symfony/console/ConsoleEvents.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Cursor' => __DIR__ . '/..' . '/symfony/console/Cursor.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\DataCollector\\CommandDataCollector' => __DIR__ . '/..' . '/symfony/console/DataCollector/CommandDataCollector.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Debug\\CliRequest' => __DIR__ . '/..' . '/symfony/console/Debug/CliRequest.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\DependencyInjection\\AddConsoleCommandPass' => __DIR__ . '/..' . '/symfony/console/DependencyInjection/AddConsoleCommandPass.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Descriptor\\ApplicationDescription' => __DIR__ . '/..' . '/symfony/console/Descriptor/ApplicationDescription.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Descriptor\\Descriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/Descriptor.php',
@ -1015,6 +1018,7 @@ class ComposerStaticInit6ee5b17c87a6bea7c9006b4ba8060b02
'RectorPrefix202311\\Symfony\\Component\\Console\\Exception\\LogicException' => __DIR__ . '/..' . '/symfony/console/Exception/LogicException.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Exception\\MissingInputException' => __DIR__ . '/..' . '/symfony/console/Exception/MissingInputException.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Exception\\NamespaceNotFoundException' => __DIR__ . '/..' . '/symfony/console/Exception/NamespaceNotFoundException.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Exception\\RunCommandFailedException' => __DIR__ . '/..' . '/symfony/console/Exception/RunCommandFailedException.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Exception\\RuntimeException' => __DIR__ . '/..' . '/symfony/console/Exception/RuntimeException.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Formatter\\NullOutputFormatter' => __DIR__ . '/..' . '/symfony/console/Formatter/NullOutputFormatter.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Formatter\\NullOutputFormatterStyle' => __DIR__ . '/..' . '/symfony/console/Formatter/NullOutputFormatterStyle.php',
@ -1055,6 +1059,9 @@ class ComposerStaticInit6ee5b17c87a6bea7c9006b4ba8060b02
'RectorPrefix202311\\Symfony\\Component\\Console\\Input\\StreamableInputInterface' => __DIR__ . '/..' . '/symfony/console/Input/StreamableInputInterface.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Input\\StringInput' => __DIR__ . '/..' . '/symfony/console/Input/StringInput.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Logger\\ConsoleLogger' => __DIR__ . '/..' . '/symfony/console/Logger/ConsoleLogger.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Messenger\\RunCommandContext' => __DIR__ . '/..' . '/symfony/console/Messenger/RunCommandContext.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Messenger\\RunCommandMessage' => __DIR__ . '/..' . '/symfony/console/Messenger/RunCommandMessage.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Messenger\\RunCommandMessageHandler' => __DIR__ . '/..' . '/symfony/console/Messenger/RunCommandMessageHandler.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Output\\AnsiColorMode' => __DIR__ . '/..' . '/symfony/console/Output/AnsiColorMode.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Output\\BufferedOutput' => __DIR__ . '/..' . '/symfony/console/Output/BufferedOutput.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Output\\ConsoleOutput' => __DIR__ . '/..' . '/symfony/console/Output/ConsoleOutput.php',
@ -1068,6 +1075,7 @@ class ComposerStaticInit6ee5b17c87a6bea7c9006b4ba8060b02
'RectorPrefix202311\\Symfony\\Component\\Console\\Question\\ChoiceQuestion' => __DIR__ . '/..' . '/symfony/console/Question/ChoiceQuestion.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Question\\ConfirmationQuestion' => __DIR__ . '/..' . '/symfony/console/Question/ConfirmationQuestion.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Question\\Question' => __DIR__ . '/..' . '/symfony/console/Question/Question.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\SignalRegistry\\SignalMap' => __DIR__ . '/..' . '/symfony/console/SignalRegistry/SignalMap.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\SignalRegistry\\SignalRegistry' => __DIR__ . '/..' . '/symfony/console/SignalRegistry/SignalRegistry.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\SingleCommandApplication' => __DIR__ . '/..' . '/symfony/console/SingleCommandApplication.php',
'RectorPrefix202311\\Symfony\\Component\\Console\\Style\\OutputStyle' => __DIR__ . '/..' . '/symfony/console/Style/OutputStyle.php',
@ -2606,9 +2614,9 @@ class ComposerStaticInit6ee5b17c87a6bea7c9006b4ba8060b02
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit6ee5b17c87a6bea7c9006b4ba8060b02::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit6ee5b17c87a6bea7c9006b4ba8060b02::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit6ee5b17c87a6bea7c9006b4ba8060b02::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInita55c41c7fa52abd86138c6f32df1d185::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInita55c41c7fa52abd86138c6f32df1d185::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInita55c41c7fa52abd86138c6f32df1d185::$classMap;
}, null, ClassLoader::class);
}

View File

@ -2015,17 +2015,17 @@
},
{
"name": "symfony\/console",
"version": "v6.3.9",
"version_normalized": "6.3.9.0",
"version": "v6.4.0",
"version_normalized": "6.4.0.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symfony\/console.git",
"reference": "0566dbd051f8648d980592c7849f5d90d2c7c60c"
"reference": "cd9864b47c367450e14ab32f78fdbf98c44c26b6"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symfony\/console\/zipball\/0566dbd051f8648d980592c7849f5d90d2c7c60c",
"reference": "0566dbd051f8648d980592c7849f5d90d2c7c60c",
"url": "https:\/\/api.github.com\/repos\/symfony\/console\/zipball\/cd9864b47c367450e14ab32f78fdbf98c44c26b6",
"reference": "cd9864b47c367450e14ab32f78fdbf98c44c26b6",
"shasum": ""
},
"require": {
@ -2033,7 +2033,7 @@
"symfony\/deprecation-contracts": "^2.5|^3",
"symfony\/polyfill-mbstring": "~1.0",
"symfony\/service-contracts": "^2.5|^3",
"symfony\/string": "^5.4|^6.0"
"symfony\/string": "^5.4|^6.0|^7.0"
},
"conflict": {
"symfony\/dependency-injection": "<5.4",
@ -2047,14 +2047,18 @@
},
"require-dev": {
"psr\/log": "^1|^2|^3",
"symfony\/config": "^5.4|^6.0",
"symfony\/dependency-injection": "^5.4|^6.0",
"symfony\/event-dispatcher": "^5.4|^6.0",
"symfony\/lock": "^5.4|^6.0",
"symfony\/process": "^5.4|^6.0",
"symfony\/var-dumper": "^5.4|^6.0"
"symfony\/config": "^5.4|^6.0|^7.0",
"symfony\/dependency-injection": "^5.4|^6.0|^7.0",
"symfony\/event-dispatcher": "^5.4|^6.0|^7.0",
"symfony\/http-foundation": "^6.4|^7.0",
"symfony\/http-kernel": "^6.4|^7.0",
"symfony\/lock": "^5.4|^6.0|^7.0",
"symfony\/messenger": "^5.4|^6.0|^7.0",
"symfony\/process": "^5.4|^6.0|^7.0",
"symfony\/stopwatch": "^5.4|^6.0|^7.0",
"symfony\/var-dumper": "^5.4|^6.0|^7.0"
},
"time": "2023-11-20T16:36:29+00:00",
"time": "2023-11-20T16:41:16+00:00",
"type": "library",
"extra": {
"patches_applied": [
@ -2093,7 +2097,7 @@
"terminal"
],
"support": {
"source": "https:\/\/github.com\/symfony\/console\/tree\/v6.3.9"
"source": "https:\/\/github.com\/symfony\/console\/tree\/v6.4.0"
},
"funding": [
{

File diff suppressed because one or more lines are too long

View File

@ -98,6 +98,10 @@ class Application implements ResetInterface
* @var bool
*/
private $catchExceptions = \true;
/**
* @var bool
*/
private $catchErrors = \false;
/**
* @var bool
*/
@ -210,8 +214,11 @@ class Application implements ResetInterface
$this->configureIO($input, $output);
try {
$exitCode = $this->doRun($input, $output);
} catch (\Exception $e) {
if (!$this->catchExceptions) {
} catch (\Throwable $e) {
if ($e instanceof \Exception && !$this->catchExceptions) {
throw $e;
}
if (!$e instanceof \Exception && !$this->catchErrors) {
throw $e;
}
$renderException($e);
@ -413,6 +420,13 @@ class Application implements ResetInterface
{
$this->catchExceptions = $boolean;
}
/**
* Sets whether to catch errors or not during commands execution.
*/
public function setCatchErrors(bool $catchErrors = \true) : void
{
$this->catchErrors = $catchErrors;
}
/**
* Gets whether to automatically exit after a command execution or not.
*/
@ -919,7 +933,9 @@ class Application implements ResetInterface
}
}
if (\false !== $exitCode) {
exit($exitCode);
$event = new ConsoleTerminateEvent($command, $event->getInput(), $event->getOutput(), $exitCode, $signal);
$this->dispatcher->dispatch($event, ConsoleEvents::TERMINATE);
exit($event->getExitCode());
}
});
}

View File

@ -1,6 +1,15 @@
CHANGELOG
=========
6.4
---
* Add `SignalMap` to map signal value to its name
* Multi-line text in vertical tables is aligned properly
* The application can also catch errors with `Application::setCatchErrors(true)`
* Add `RunCommandMessage` and `RunCommandMessageHandler`
* Dispatch `ConsoleTerminateEvent` after an exit on signal handling and add `ConsoleTerminateEvent::getInterruptingSignal()`
6.3
---

View File

@ -38,7 +38,13 @@ final class CompleteCommand extends Command
* @deprecated since Symfony 6.1
*/
protected static $defaultDescription = 'Internal command to provide shell completion suggestions';
/**
* @var mixed[]
*/
private $completionOutputs;
/**
* @var bool
*/
private $isDebug = \false;
/**
* @param array<string, class-string<CompletionOutputInterface>> $completionOutputs A list of additional completion outputs, with shell name as key and FQCN as value

View File

@ -25,6 +25,7 @@ interface SignalableCommandInterface
* The method will be called when the application is signaled.
*
* @param int|false $previousExitCode
*
* @return int|false The exit code to return or false to continue the normal execution
*/
public function handleSignal(int $signal);

View File

@ -0,0 +1,340 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace RectorPrefix202311\Symfony\Component\Console\Command;
use RectorPrefix202311\Symfony\Component\Console\Application;
use RectorPrefix202311\Symfony\Component\Console\Completion\CompletionInput;
use RectorPrefix202311\Symfony\Component\Console\Completion\CompletionSuggestions;
use RectorPrefix202311\Symfony\Component\Console\Helper\HelperInterface;
use RectorPrefix202311\Symfony\Component\Console\Helper\HelperSet;
use RectorPrefix202311\Symfony\Component\Console\Input\InputDefinition;
use RectorPrefix202311\Symfony\Component\Console\Input\InputInterface;
use RectorPrefix202311\Symfony\Component\Console\Output\ConsoleOutputInterface;
use RectorPrefix202311\Symfony\Component\Console\Output\OutputInterface;
use RectorPrefix202311\Symfony\Component\Stopwatch\Stopwatch;
/**
* @internal
*
* @author Jules Pietri <jules@heahprod.com>
*/
final class TraceableCommand extends Command implements SignalableCommandInterface
{
/**
* @readonly
* @var \Symfony\Component\Stopwatch\Stopwatch
*/
private $stopwatch;
/**
* @readonly
* @var \Symfony\Component\Console\Command\Command
*/
public $command;
/**
* @var int
*/
public $exitCode;
/**
* @var int|null
*/
public $interruptedBySignal;
/**
* @var bool
*/
public $ignoreValidation;
/**
* @var bool
*/
public $isInteractive = \false;
/**
* @var string
*/
public $duration = 'n/a';
/**
* @var string
*/
public $maxMemoryUsage = 'n/a';
/**
* @var \Symfony\Component\Console\Input\InputInterface
*/
public $input;
/**
* @var \Symfony\Component\Console\Output\OutputInterface
*/
public $output;
/** @var array<string, mixed> */
public $arguments;
/** @var array<string, mixed> */
public $options;
/** @var array<string, mixed> */
public $interactiveInputs = [];
/**
* @var mixed[]
*/
public $handledSignals = [];
public function __construct(Command $command, Stopwatch $stopwatch)
{
$this->stopwatch = $stopwatch;
if ($command instanceof LazyCommand) {
$command = $command->getCommand();
}
$this->command = $command;
// prevent call to self::getDefaultDescription()
$this->setDescription($command->getDescription());
parent::__construct($command->getName());
// init below enables calling {@see parent::run()}
[$code, $processTitle, $ignoreValidationErrors] = \Closure::bind(function () {
return [$this->code, $this->processTitle, $this->ignoreValidationErrors];
}, $command, Command::class)();
if (\is_callable($code)) {
$this->setCode($code);
}
if ($processTitle) {
parent::setProcessTitle($processTitle);
}
if ($ignoreValidationErrors) {
parent::ignoreValidationErrors();
}
$this->ignoreValidation = $ignoreValidationErrors;
}
/**
* @return mixed
*/
public function __call(string $name, array $arguments)
{
return $this->command->{$name}(...$arguments);
}
public function getSubscribedSignals() : array
{
return $this->command instanceof SignalableCommandInterface ? $this->command->getSubscribedSignals() : [];
}
/**
* @param int|false $previousExitCode
* @return int|false
*/
public function handleSignal(int $signal, $previousExitCode = 0)
{
if (!$this->command instanceof SignalableCommandInterface) {
return \false;
}
$event = $this->stopwatch->start($this->getName() . '.handle_signal');
$exit = $this->command->handleSignal($signal, $previousExitCode);
$event->stop();
if (!isset($this->handledSignals[$signal])) {
$this->handledSignals[$signal] = ['handled' => 0, 'duration' => 0, 'memory' => 0];
}
++$this->handledSignals[$signal]['handled'];
$this->handledSignals[$signal]['duration'] += $event->getDuration();
$this->handledSignals[$signal]['memory'] = \max($this->handledSignals[$signal]['memory'], $event->getMemory() >> 20);
return $exit;
}
/**
* {@inheritdoc}
*
* Calling parent method is required to be used in {@see parent::run()}.
*/
public function ignoreValidationErrors() : void
{
$this->ignoreValidation = \true;
$this->command->ignoreValidationErrors();
parent::ignoreValidationErrors();
}
public function setApplication(Application $application = null) : void
{
$this->command->setApplication($application);
}
public function getApplication() : ?Application
{
return $this->command->getApplication();
}
public function setHelperSet(HelperSet $helperSet) : void
{
$this->command->setHelperSet($helperSet);
}
public function getHelperSet() : ?HelperSet
{
return $this->command->getHelperSet();
}
public function isEnabled() : bool
{
return $this->command->isEnabled();
}
public function complete(CompletionInput $input, CompletionSuggestions $suggestions) : void
{
$this->command->complete($input, $suggestions);
}
/**
* {@inheritdoc}
*
* Calling parent method is required to be used in {@see parent::run()}.
* @return static
*/
public function setCode(callable $code)
{
$this->command->setCode($code);
return parent::setCode(function (InputInterface $input, OutputInterface $output) use($code) : int {
$event = $this->stopwatch->start($this->getName() . '.code');
$this->exitCode = $code($input, $output);
$event->stop();
return $this->exitCode;
});
}
/**
* @internal
*/
public function mergeApplicationDefinition(bool $mergeArgs = \true) : void
{
$this->command->mergeApplicationDefinition($mergeArgs);
}
/**
* @param mixed[]|\Symfony\Component\Console\Input\InputDefinition $definition
* @return static
*/
public function setDefinition($definition)
{
$this->command->setDefinition($definition);
return $this;
}
public function getDefinition() : InputDefinition
{
return $this->command->getDefinition();
}
public function getNativeDefinition() : InputDefinition
{
return $this->command->getNativeDefinition();
}
/**
* @param mixed[]|\Closure $suggestedValues
* @param mixed $default
* @return static
*/
public function addArgument(string $name, int $mode = null, string $description = '', $default = null, $suggestedValues = [])
{
$this->command->addArgument($name, $mode, $description, $default, $suggestedValues);
return $this;
}
/**
* @param string|mixed[] $shortcut
* @param mixed[]|\Closure $suggestedValues
* @param mixed $default
* @return static
*/
public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null, $suggestedValues = [])
{
$this->command->addOption($name, $shortcut, $mode, $description, $default, $suggestedValues);
return $this;
}
/**
* {@inheritdoc}
*
* Calling parent method is required to be used in {@see parent::run()}.
* @return static
*/
public function setProcessTitle(string $title)
{
$this->command->setProcessTitle($title);
return parent::setProcessTitle($title);
}
/**
* @return static
*/
public function setHelp(string $help)
{
$this->command->setHelp($help);
return $this;
}
public function getHelp() : string
{
return $this->command->getHelp();
}
public function getProcessedHelp() : string
{
return $this->command->getProcessedHelp();
}
public function getSynopsis(bool $short = \false) : string
{
return $this->command->getSynopsis($short);
}
/**
* @return static
*/
public function addUsage(string $usage)
{
$this->command->addUsage($usage);
return $this;
}
public function getUsages() : array
{
return $this->command->getUsages();
}
public function getHelper(string $name) : HelperInterface
{
return $this->command->getHelper($name);
}
public function run(InputInterface $input, OutputInterface $output) : int
{
$this->input = $input;
$this->output = $output;
$this->arguments = $input->getArguments();
$this->options = $input->getOptions();
$event = $this->stopwatch->start($this->getName(), 'command');
try {
$this->exitCode = parent::run($input, $output);
} finally {
$event->stop();
if ($output instanceof ConsoleOutputInterface && $output->isDebug()) {
$output->getErrorOutput()->writeln((string) $event);
}
$this->duration = $event->getDuration() . ' ms';
$this->maxMemoryUsage = ($event->getMemory() >> 20) . ' MiB';
if ($this->isInteractive) {
$this->extractInteractiveInputs($input->getArguments(), $input->getOptions());
}
}
return $this->exitCode;
}
protected function initialize(InputInterface $input, OutputInterface $output) : void
{
$event = $this->stopwatch->start($this->getName() . '.init', 'command');
$this->command->initialize($input, $output);
$event->stop();
}
protected function interact(InputInterface $input, OutputInterface $output) : void
{
if (!($this->isInteractive = Command::class !== (new \ReflectionMethod($this->command, 'interact'))->getDeclaringClass()->getName())) {
return;
}
$event = $this->stopwatch->start($this->getName() . '.interact', 'command');
$this->command->interact($input, $output);
$event->stop();
}
protected function execute(InputInterface $input, OutputInterface $output) : int
{
$event = $this->stopwatch->start($this->getName() . '.execute', 'command');
$exitCode = $this->command->execute($input, $output);
$event->stop();
return $exitCode;
}
private function extractInteractiveInputs(array $arguments, array $options) : void
{
foreach ($arguments as $argName => $argValue) {
if (\array_key_exists($argName, $this->arguments) && $this->arguments[$argName] === $argValue) {
continue;
}
$this->interactiveInputs[$argName] = $argValue;
}
foreach ($options as $optName => $optValue) {
if (\array_key_exists($optName, $this->options) && $this->options[$optName] === $optValue) {
continue;
}
$this->interactiveInputs['--' . $optName] = $optValue;
}
}
}

View File

@ -28,10 +28,25 @@ final class CompletionInput extends ArgvInput
public const TYPE_OPTION_VALUE = 'option_value';
public const TYPE_OPTION_NAME = 'option_name';
public const TYPE_NONE = 'none';
/**
* @var mixed[]
*/
private $tokens;
/**
* @var int
*/
private $currentIndex;
/**
* @var string
*/
private $completionType;
/**
* @var string|null
*/
private $completionName;
/**
* @var string
*/
private $completionValue = '';
/**
* Converts a terminal string into tokens.
@ -122,7 +137,9 @@ final class CompletionInput extends ArgvInput
* TYPE_OPTION_NAME when completing the name of an input option
* TYPE_NONE when nothing should be completed
*
* @return string One of self::TYPE_* constants. TYPE_OPTION_NAME and TYPE_NONE are already implemented by the Console component
* TYPE_OPTION_NAME and TYPE_NONE are already implemented by the Console component.
*
* @return self::TYPE_*
*/
public function getCompletionType() : string
{

View File

@ -18,7 +18,13 @@ use RectorPrefix202311\Symfony\Component\Console\Input\InputOption;
*/
final class CompletionSuggestions
{
/**
* @var mixed[]
*/
private $valueSuggestions = [];
/**
* @var mixed[]
*/
private $optionSuggestions = [];
/**
* Add a suggested value for an input option or argument.

View File

@ -20,6 +20,7 @@ final class Cursor
* @var \Symfony\Component\Console\Output\OutputInterface
*/
private $output;
/** @var resource */
private $input;
/**
* @param resource|null $input

View File

@ -0,0 +1,182 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace RectorPrefix202311\Symfony\Component\Console\DataCollector;
use RectorPrefix202311\Symfony\Component\Console\Command\Command;
use RectorPrefix202311\Symfony\Component\Console\Debug\CliRequest;
use RectorPrefix202311\Symfony\Component\Console\Output\OutputInterface;
use RectorPrefix202311\Symfony\Component\Console\SignalRegistry\SignalMap;
use RectorPrefix202311\Symfony\Component\HttpFoundation\Request;
use RectorPrefix202311\Symfony\Component\HttpFoundation\Response;
use RectorPrefix202311\Symfony\Component\HttpKernel\DataCollector\DataCollector;
use RectorPrefix202311\Symfony\Component\VarDumper\Cloner\Data;
/**
* @internal
*
* @author Jules Pietri <jules@heahprod.com>
*/
final class CommandDataCollector extends DataCollector
{
public function collect(Request $request, Response $response, \Throwable $exception = null) : void
{
if (!$request instanceof CliRequest) {
return;
}
$command = $request->command;
$application = $command->getApplication();
$this->data = ['command' => $this->cloneVar($command->command), 'exit_code' => $command->exitCode, 'interrupted_by_signal' => $command->interruptedBySignal, 'duration' => $command->duration, 'max_memory_usage' => $command->maxMemoryUsage, 'verbosity_level' => (function () use($command) {
switch ($command->output->getVerbosity()) {
case OutputInterface::VERBOSITY_QUIET:
return 'quiet';
case OutputInterface::VERBOSITY_NORMAL:
return 'normal';
case OutputInterface::VERBOSITY_VERBOSE:
return 'verbose';
case OutputInterface::VERBOSITY_VERY_VERBOSE:
return 'very verbose';
case OutputInterface::VERBOSITY_DEBUG:
return 'debug';
}
})(), 'interactive' => $command->isInteractive, 'validate_input' => !$command->ignoreValidation, 'enabled' => $command->isEnabled(), 'visible' => !$command->isHidden(), 'input' => $this->cloneVar($command->input), 'output' => $this->cloneVar($command->output), 'interactive_inputs' => \array_map(\Closure::fromCallable([$this, 'cloneVar']), $command->interactiveInputs), 'signalable' => $command->getSubscribedSignals(), 'handled_signals' => $command->handledSignals, 'helper_set' => \array_map(\Closure::fromCallable([$this, 'cloneVar']), \iterator_to_array($command->getHelperSet()))];
$baseDefinition = $application->getDefinition();
foreach ($command->arguments as $argName => $argValue) {
if ($baseDefinition->hasArgument($argName)) {
$this->data['application_inputs'][$argName] = $this->cloneVar($argValue);
} else {
$this->data['arguments'][$argName] = $this->cloneVar($argValue);
}
}
foreach ($command->options as $optName => $optValue) {
if ($baseDefinition->hasOption($optName)) {
$this->data['application_inputs']['--' . $optName] = $this->cloneVar($optValue);
} else {
$this->data['options'][$optName] = $this->cloneVar($optValue);
}
}
}
public function getName() : string
{
return 'command';
}
/**
* @return array{
* class?: class-string,
* executor?: string,
* file: string,
* line: int,
* }
*/
public function getCommand() : array
{
$class = $this->data['command']->getType();
$r = new \ReflectionMethod($class, 'execute');
if (Command::class !== $r->getDeclaringClass()) {
return ['executor' => $class . '::' . $r->name, 'file' => $r->getFileName(), 'line' => $r->getStartLine()];
}
$r = new \ReflectionClass($class);
return ['class' => $class, 'file' => $r->getFileName(), 'line' => $r->getStartLine()];
}
public function getInterruptedBySignal() : ?string
{
if (isset($this->data['interrupted_by_signal'])) {
return \sprintf('%s (%d)', SignalMap::getSignalName($this->data['interrupted_by_signal']), $this->data['interrupted_by_signal']);
}
return null;
}
public function getDuration() : string
{
return $this->data['duration'];
}
public function getMaxMemoryUsage() : string
{
return $this->data['max_memory_usage'];
}
public function getVerbosityLevel() : string
{
return $this->data['verbosity_level'];
}
public function getInteractive() : bool
{
return $this->data['interactive'];
}
public function getValidateInput() : bool
{
return $this->data['validate_input'];
}
public function getEnabled() : bool
{
return $this->data['enabled'];
}
public function getVisible() : bool
{
return $this->data['visible'];
}
public function getInput() : Data
{
return $this->data['input'];
}
public function getOutput() : Data
{
return $this->data['output'];
}
/**
* @return Data[]
*/
public function getArguments() : array
{
return $this->data['arguments'] ?? [];
}
/**
* @return Data[]
*/
public function getOptions() : array
{
return $this->data['options'] ?? [];
}
/**
* @return Data[]
*/
public function getApplicationInputs() : array
{
return $this->data['application_inputs'] ?? [];
}
/**
* @return Data[]
*/
public function getInteractiveInputs() : array
{
return $this->data['interactive_inputs'] ?? [];
}
public function getSignalable() : array
{
return \array_map(static function (int $signal) : string {
return \sprintf('%s (%d)', SignalMap::getSignalName($signal), $signal);
}, $this->data['signalable']);
}
public function getHandledSignals() : array
{
$keys = \array_map(static function (int $signal) : string {
return \sprintf('%s (%d)', SignalMap::getSignalName($signal), $signal);
}, \array_keys($this->data['handled_signals']));
return \array_combine($keys, \array_values($this->data['handled_signals']));
}
/**
* @return Data[]
*/
public function getHelperSet() : array
{
return $this->data['helper_set'] ?? [];
}
public function reset() : void
{
$this->data = [];
}
}

View File

@ -0,0 +1,70 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace RectorPrefix202311\Symfony\Component\Console\Debug;
use RectorPrefix202311\Symfony\Component\Console\Command\TraceableCommand;
use RectorPrefix202311\Symfony\Component\HttpFoundation\Request;
use RectorPrefix202311\Symfony\Component\HttpFoundation\Response;
/**
* @internal
*/
final class CliRequest extends Request
{
/**
* @readonly
* @var \Symfony\Component\Console\Command\TraceableCommand
*/
public $command;
public function __construct(TraceableCommand $command)
{
$this->command = $command;
parent::__construct(attributes: ['_controller' => \get_class($command->command), '_virtual_type' => 'command'], server: $_SERVER);
}
// Methods below allow to populate a profile, thus enable search and filtering
public function getUri() : string
{
if ($this->server->has('SYMFONY_CLI_BINARY_NAME')) {
$binary = $this->server->get('SYMFONY_CLI_BINARY_NAME') . ' console';
} else {
$binary = $this->server->get('argv')[0];
}
return $binary . ' ' . $this->command->input;
}
public function getMethod() : string
{
return $this->command->isInteractive ? 'INTERACTIVE' : 'BATCH';
}
public function getResponse() : Response
{
return new class($this->command->exitCode) extends Response
{
/**
* @readonly
* @var int
*/
private $exitCode;
public function __construct(int $exitCode)
{
$this->exitCode = $exitCode;
parent::__construct();
}
public function getStatusCode() : int
{
return $this->exitCode;
}
};
}
public function getClientIp() : string
{
$application = $this->command->getApplication();
return $application->getName() . ' ' . $application->getVersion();
}
}

View File

@ -0,0 +1,32 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace RectorPrefix202311\Symfony\Component\Console\Exception;
use RectorPrefix202311\Symfony\Component\Console\Messenger\RunCommandContext;
/**
* @author Kevin Bond <kevinbond@gmail.com>
*/
final class RunCommandFailedException extends RuntimeException
{
/**
* @readonly
* @var \Symfony\Component\Console\Messenger\RunCommandContext
*/
public $context;
/**
* @param \Throwable|string $exception
*/
public function __construct($exception, RunCommandContext $context)
{
$this->context = $context;
parent::__construct($exception instanceof \Throwable ? $exception->getMessage() : $exception, $exception instanceof \Throwable ? $exception->getCode() : 0, $exception instanceof \Throwable ? $exception : null);
}
}

View File

@ -81,19 +81,30 @@ abstract class Helper implements HelperInterface
* @return string
* @param int|float $secs
*/
public static function formatTime($secs)
public static function formatTime($secs, int $precision = 1)
{
static $timeFormats = [[0, '< 1 sec'], [1, '1 sec'], [2, 'secs', 1], [60, '1 min'], [120, 'mins', 60], [3600, '1 hr'], [7200, 'hrs', 3600], [86400, '1 day'], [172800, 'days', 86400]];
foreach ($timeFormats as $index => $format) {
if ($secs >= $format[0]) {
if (isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0] || $index == \count($timeFormats) - 1) {
if (2 == \count($format)) {
return $format[1];
}
return \floor($secs / $format[2]) . ' ' . $format[1];
}
}
$secs = (int) \floor($secs);
if (0 === $secs) {
return '< 1 sec';
}
static $timeFormats = [[1, '1 sec', 'secs'], [60, '1 min', 'mins'], [3600, '1 hr', 'hrs'], [86400, '1 day', 'days']];
$times = [];
foreach ($timeFormats as $index => $format) {
$seconds = isset($timeFormats[$index + 1]) ? $secs % $timeFormats[$index + 1][0] : $secs;
if (isset($times[$index - $precision])) {
unset($times[$index - $precision]);
}
if (0 === $seconds) {
continue;
}
$unitCount = $seconds / $format[0];
$times[$index] = 1 === $unitCount ? $format[1] : $unitCount . ' ' . $format[2];
if ($secs === $seconds) {
break;
}
$secs -= $seconds;
}
return \implode(', ', \array_reverse($times));
}
/**
* @return string

View File

@ -337,7 +337,13 @@ final class ProgressBar
/**
* Returns an iterator that will automatically update the progress bar when iterated.
*
* @param int|null $max Number of steps to complete the bar (0 if indeterminate), if null it will be inferred from $iterable
* @template TKey
* @template TValue
*
* @param iterable<TKey, TValue> $iterable
* @param int|null $max Number of steps to complete the bar (0 if indeterminate), if null it will be inferred from $iterable
*
* @return iterable<TKey, TValue>
*/
public function iterate(iterable $iterable, int $max = null) : iterable
{
@ -533,17 +539,17 @@ final class ProgressBar
}
return $display;
}, 'elapsed' => function (self $bar) {
return Helper::formatTime(\time() - $bar->getStartTime());
return Helper::formatTime(\time() - $bar->getStartTime(), 2);
}, 'remaining' => function (self $bar) {
if (!$bar->getMaxSteps()) {
throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.');
}
return Helper::formatTime($bar->getRemaining());
return Helper::formatTime($bar->getRemaining(), 2);
}, 'estimated' => function (self $bar) {
if (!$bar->getMaxSteps()) {
throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.');
}
return Helper::formatTime($bar->getEstimated());
return Helper::formatTime($bar->getEstimated(), 2);
}, 'memory' => function (self $bar) {
return Helper::formatMemory(\memory_get_usage(\true));
}, 'current' => function (self $bar) {

View File

@ -217,7 +217,7 @@ class ProgressIndicator
}, 'message' => function (self $indicator) {
return $indicator->message;
}, 'elapsed' => function (self $indicator) {
return Helper::formatTime(\time() - $indicator->startTime);
return Helper::formatTime(\time() - $indicator->startTime, 2);
}, 'memory' => function () {
return Helper::formatMemory(\memory_get_usage(\true));
}];

View File

@ -361,10 +361,17 @@ class Table
$maxRows = \max(\count($headers), \count($row));
for ($i = 0; $i < $maxRows; ++$i) {
$cell = (string) ($row[$i] ?? '');
if ($headers && !$containsColspan) {
$rows[] = [\sprintf('<comment>%s</>: %s', \str_pad($headers[$i] ?? '', $maxHeaderLength, ' ', \STR_PAD_LEFT), $cell)];
} elseif ('' !== $cell) {
$rows[] = [$cell];
$parts = \explode("\n", $cell);
foreach ($parts as $idx => $part) {
if ($headers && !$containsColspan) {
if (0 === $idx) {
$rows[] = [\sprintf('<comment>%s</>: %s', \str_pad($headers[$i] ?? '', $maxHeaderLength, ' ', \STR_PAD_LEFT), $part)];
} else {
$rows[] = [\sprintf('%s %s', \str_pad('', $maxHeaderLength, ' ', \STR_PAD_LEFT), $part)];
}
} elseif ('' !== $cell) {
$rows[] = [$part];
}
}
}
}

View File

@ -26,6 +26,7 @@ use RectorPrefix202311\Symfony\Component\Console\Exception\RuntimeException;
abstract class Input implements InputInterface, StreamableInputInterface
{
protected $definition;
/** @var resource */
protected $stream;
protected $options = [];
protected $arguments = [];

View File

@ -0,0 +1,39 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace RectorPrefix202311\Symfony\Component\Console\Messenger;
/**
* @author Kevin Bond <kevinbond@gmail.com>
*/
final class RunCommandContext
{
/**
* @readonly
* @var \Symfony\Component\Console\Messenger\RunCommandMessage
*/
public $message;
/**
* @readonly
* @var int
*/
public $exitCode;
/**
* @readonly
* @var string
*/
public $output;
public function __construct(RunCommandMessage $message, int $exitCode, string $output)
{
$this->message = $message;
$this->exitCode = $exitCode;
$this->output = $output;
}
}

View File

@ -0,0 +1,48 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace RectorPrefix202311\Symfony\Component\Console\Messenger;
use RectorPrefix202311\Symfony\Component\Console\Exception\RunCommandFailedException;
/**
* @author Kevin Bond <kevinbond@gmail.com>
*/
class RunCommandMessage
{
/**
* @readonly
* @var string
*/
public $input;
/**
* @var bool
* @readonly
*/
public $throwOnFailure = \true;
/**
* @var bool
* @readonly
*/
public $catchExceptions = \false;
/**
* @param bool $throwOnFailure If the command has a non-zero exit code, throw {@see RunCommandFailedException}
* @param bool $catchExceptions @see Application::setCatchExceptions()
*/
public function __construct(string $input, bool $throwOnFailure = \true, bool $catchExceptions = \false)
{
$this->input = $input;
$this->throwOnFailure = $throwOnFailure;
$this->catchExceptions = $catchExceptions;
}
public function __toString() : string
{
return $this->input;
}
}

View File

@ -0,0 +1,47 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace RectorPrefix202311\Symfony\Component\Console\Messenger;
use RectorPrefix202311\Symfony\Component\Console\Application;
use RectorPrefix202311\Symfony\Component\Console\Command\Command;
use RectorPrefix202311\Symfony\Component\Console\Exception\RunCommandFailedException;
use RectorPrefix202311\Symfony\Component\Console\Input\StringInput;
use RectorPrefix202311\Symfony\Component\Console\Output\BufferedOutput;
/**
* @author Kevin Bond <kevinbond@gmail.com>
*/
final class RunCommandMessageHandler
{
/**
* @readonly
* @var \Symfony\Component\Console\Application
*/
private $application;
public function __construct(Application $application)
{
$this->application = $application;
}
public function __invoke(RunCommandMessage $message) : RunCommandContext
{
$input = new StringInput($message->input);
$output = new BufferedOutput();
$this->application->setCatchExceptions($message->catchExceptions);
try {
$exitCode = $this->application->run($input, $output);
} catch (\Throwable $e) {
throw new RunCommandFailedException($e, new RunCommandContext($message, Command::FAILURE, $output->fetch()));
}
if ($message->throwOnFailure && Command::SUCCESS !== $exitCode) {
throw new RunCommandFailedException(\sprintf('Command "%s" exited with code "%s".', $message->input, $exitCode), new RunCommandContext($message, $exitCode, $output->fetch()));
}
return new RunCommandContext($message, $exitCode, $output->fetch());
}
}

View File

@ -50,11 +50,15 @@ interface OutputInterface
/**
* Sets the verbosity of the output.
*
* @param self::VERBOSITY_* $level
*
* @return void
*/
public function setVerbosity(int $level);
/**
* Gets the current verbosity of the output.
*
* @return self::VERBOSITY_*
*/
public function getVerbosity() : int;
/**

View File

@ -27,6 +27,7 @@ use RectorPrefix202311\Symfony\Component\Console\Formatter\OutputFormatterInterf
*/
class StreamOutput extends Output
{
/** @var resource */
private $stream;
/**
* @param resource $stream A stream resource

View File

@ -7,14 +7,7 @@ interfaces.
Sponsor
-------
The Console component for Symfony 6.3 is [backed][1] by [Les-Tilleuls.coop][2].
Les-Tilleuls.coop is a team of 70+ Symfony experts who can help you design, develop and
fix your projects. They provide a wide range of professional services including development,
consulting, coaching, training and audits. They also are highly skilled in JS, Go and DevOps.
They are a worker cooperative!
Help Symfony by [sponsoring][3] its development!
Help Symfony by [sponsoring][1] its development!
Resources
---------
@ -31,6 +24,4 @@ Credits
`Resources/bin/hiddeninput.exe` is a third party binary provided within this
component. Find sources and license at https://github.com/Seldaek/hidden-input.
[1]: https://symfony.com/backers
[2]: https://les-tilleuls.coop
[3]: https://symfony.com/sponsor
[1]: https://symfony.com/sponsor

View File

@ -0,0 +1,37 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace RectorPrefix202311\Symfony\Component\Console\SignalRegistry;
/**
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*/
class SignalMap
{
/**
* @var mixed[]
*/
private static $map;
public static function getSignalName(int $signal) : ?string
{
if (!\extension_loaded('pcntl')) {
return null;
}
if (!isset(self::$map)) {
$r = new \ReflectionExtension('pcntl');
$c = $r->getConstants();
$map = \array_filter($c, function ($k) {
return \strncmp($k, 'SIG', \strlen('SIG')) === 0 && \strncmp($k, 'SIG_', \strlen('SIG_')) !== 0;
}, \ARRAY_FILTER_USE_KEY);
self::$map = \array_flip($map);
}
return self::$map[$signal] ?? null;
}
}

View File

@ -312,6 +312,14 @@ class SymfonyStyle extends OutputStyle
}
/**
* @see ProgressBar::iterate()
*
* @template TKey
* @template TValue
*
* @param iterable<TKey, TValue> $iterable
* @param int|null $max Number of steps to complete the bar (0 if indeterminate), if null it will be inferred from $iterable
*
* @return iterable<TKey, TValue>
*/
public function progressIterate(iterable $iterable, int $max = null) : iterable
{

View File

@ -25,15 +25,19 @@
"symfony\/deprecation-contracts": "^2.5|^3",
"symfony\/polyfill-mbstring": "~1.0",
"symfony\/service-contracts": "^2.5|^3",
"symfony\/string": "^5.4|^6.0"
"symfony\/string": "^5.4|^6.0|^7.0"
},
"require-dev": {
"symfony\/config": "^5.4|^6.0",
"symfony\/event-dispatcher": "^5.4|^6.0",
"symfony\/dependency-injection": "^5.4|^6.0",
"symfony\/lock": "^5.4|^6.0",
"symfony\/process": "^5.4|^6.0",
"symfony\/var-dumper": "^5.4|^6.0",
"symfony\/config": "^5.4|^6.0|^7.0",
"symfony\/event-dispatcher": "^5.4|^6.0|^7.0",
"symfony\/dependency-injection": "^5.4|^6.0|^7.0",
"symfony\/http-foundation": "^6.4|^7.0",
"symfony\/http-kernel": "^6.4|^7.0",
"symfony\/lock": "^5.4|^6.0|^7.0",
"symfony\/messenger": "^5.4|^6.0|^7.0",
"symfony\/process": "^5.4|^6.0|^7.0",
"symfony\/stopwatch": "^5.4|^6.0|^7.0",
"symfony\/var-dumper": "^5.4|^6.0|^7.0",
"psr\/log": "^1|^2|^3"
},
"provide": {