From 3a5f8b0ea146bcc09e79004ff10929233d1b8f8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Machulda?= Date: Mon, 30 Nov 2020 00:58:52 +0100 Subject: [PATCH 1/6] [Console] Enable hyperlinks in Konsole/Yakuake --- Formatter/OutputFormatterStyle.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Formatter/OutputFormatterStyle.php b/Formatter/OutputFormatterStyle.php index 272c3e6a2..7cb6116b4 100644 --- a/Formatter/OutputFormatterStyle.php +++ b/Formatter/OutputFormatterStyle.php @@ -166,7 +166,8 @@ public function apply($text) $unsetCodes = []; if (null === $this->handlesHrefGracefully) { - $this->handlesHrefGracefully = 'JetBrains-JediTerm' !== getenv('TERMINAL_EMULATOR') && !getenv('KONSOLE_VERSION'); + $this->handlesHrefGracefully = 'JetBrains-JediTerm' !== getenv('TERMINAL_EMULATOR') + && (!getenv('KONSOLE_VERSION') || (int) getenv('KONSOLE_VERSION') > 201100); } if (null !== $this->foreground) { From e3d1e90fb5854db72328c6b0b2096999d5b90a4c Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 7 Dec 2020 14:43:04 +0100 Subject: [PATCH 2/6] [FrameworkBundle] acces public-deprecated services via the private container to remove false-positive deprecations --- DependencyInjection/AddConsoleCommandPass.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/DependencyInjection/AddConsoleCommandPass.php b/DependencyInjection/AddConsoleCommandPass.php index f4cd3874c..77ae6f9d4 100644 --- a/DependencyInjection/AddConsoleCommandPass.php +++ b/DependencyInjection/AddConsoleCommandPass.php @@ -29,12 +29,14 @@ class AddConsoleCommandPass implements CompilerPassInterface private $commandLoaderServiceId; private $commandTag; private $noPreloadTag; + private $privateTagName; - public function __construct(string $commandLoaderServiceId = 'console.command_loader', string $commandTag = 'console.command', string $noPreloadTag = 'container.no_preload') + public function __construct(string $commandLoaderServiceId = 'console.command_loader', string $commandTag = 'console.command', string $noPreloadTag = 'container.no_preload', string $privateTagName = 'container.private') { $this->commandLoaderServiceId = $commandLoaderServiceId; $this->commandTag = $commandTag; $this->noPreloadTag = $noPreloadTag; + $this->privateTagName = $privateTagName; } public function process(ContainerBuilder $container) @@ -62,7 +64,7 @@ public function process(ContainerBuilder $container) } if (null === $commandName) { - if (!$definition->isPublic() || $definition->isPrivate()) { + if (!$definition->isPublic() || $definition->isPrivate() || $definition->hasTag($this->privateTagName)) { $commandId = 'console.command.public_alias.'.$id; $container->setAlias($commandId, $id)->setPublic(true); $id = $commandId; From 5896f21200f780a2e374e092cc611eba1baf94ac Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 8 Dec 2020 17:59:59 +0100 Subject: [PATCH 3/6] Apply "visibility_required" CS rule to constants php-cs-fixer fix --rules='{"visibility_required": ["property", "method", "const"]}' --- ConsoleEvents.php | 6 +++--- Descriptor/ApplicationDescription.php | 2 +- Event/ConsoleCommandEvent.php | 2 +- Input/InputArgument.php | 6 +++--- Input/InputOption.php | 8 ++++---- Input/StringInput.php | 4 ++-- Logger/ConsoleLogger.php | 4 ++-- Output/OutputInterface.php | 18 +++++++++--------- Style/SymfonyStyle.php | 2 +- 9 files changed, 26 insertions(+), 26 deletions(-) diff --git a/ConsoleEvents.php b/ConsoleEvents.php index 4975643ae..f3c6cad5a 100644 --- a/ConsoleEvents.php +++ b/ConsoleEvents.php @@ -25,7 +25,7 @@ final class ConsoleEvents * * @Event("Symfony\Component\Console\Event\ConsoleCommandEvent") */ - const COMMAND = 'console.command'; + public const COMMAND = 'console.command'; /** * The TERMINATE event allows you to attach listeners after a command is @@ -33,7 +33,7 @@ final class ConsoleEvents * * @Event("Symfony\Component\Console\Event\ConsoleTerminateEvent") */ - const TERMINATE = 'console.terminate'; + public const TERMINATE = 'console.terminate'; /** * The ERROR event occurs when an uncaught exception or error appears. @@ -43,5 +43,5 @@ final class ConsoleEvents * * @Event("Symfony\Component\Console\Event\ConsoleErrorEvent") */ - const ERROR = 'console.error'; + public const ERROR = 'console.error'; } diff --git a/Descriptor/ApplicationDescription.php b/Descriptor/ApplicationDescription.php index d361b4890..3192c0f6f 100644 --- a/Descriptor/ApplicationDescription.php +++ b/Descriptor/ApplicationDescription.php @@ -22,7 +22,7 @@ */ class ApplicationDescription { - const GLOBAL_NAMESPACE = '_global'; + public const GLOBAL_NAMESPACE = '_global'; private $application; private $namespace; diff --git a/Event/ConsoleCommandEvent.php b/Event/ConsoleCommandEvent.php index 79a51906a..9691db636 100644 --- a/Event/ConsoleCommandEvent.php +++ b/Event/ConsoleCommandEvent.php @@ -23,7 +23,7 @@ class ConsoleCommandEvent extends ConsoleEvent /** * The return code for skipped commands, this will also be passed into the terminate event. */ - const RETURN_CODE_DISABLED = 113; + public const RETURN_CODE_DISABLED = 113; /** * Indicates if the command should be run or skipped. diff --git a/Input/InputArgument.php b/Input/InputArgument.php index b6aa6452a..140c86d0e 100644 --- a/Input/InputArgument.php +++ b/Input/InputArgument.php @@ -21,9 +21,9 @@ */ class InputArgument { - const REQUIRED = 1; - const OPTIONAL = 2; - const IS_ARRAY = 4; + public const REQUIRED = 1; + public const OPTIONAL = 2; + public const IS_ARRAY = 4; private $name; private $mode; diff --git a/Input/InputOption.php b/Input/InputOption.php index d62e0aea0..66f857a6c 100644 --- a/Input/InputOption.php +++ b/Input/InputOption.php @@ -21,10 +21,10 @@ */ class InputOption { - const VALUE_NONE = 1; - const VALUE_REQUIRED = 2; - const VALUE_OPTIONAL = 4; - const VALUE_IS_ARRAY = 8; + public const VALUE_NONE = 1; + public const VALUE_REQUIRED = 2; + public const VALUE_OPTIONAL = 4; + public const VALUE_IS_ARRAY = 8; private $name; private $shortcut; diff --git a/Input/StringInput.php b/Input/StringInput.php index 6fddf6488..2890b0f5f 100644 --- a/Input/StringInput.php +++ b/Input/StringInput.php @@ -24,8 +24,8 @@ */ class StringInput extends ArgvInput { - const REGEX_STRING = '([^\s]+?)(?:\s|(? Date: Thu, 10 Dec 2020 17:34:26 +0100 Subject: [PATCH 4/6] Fix CS in changelogs --- CHANGELOG.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 482c8cd36..515924455 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,9 +47,9 @@ CHANGELOG * `OutputFormatter` throws an exception when unknown options are used * removed `QuestionHelper::setInputStream()/getInputStream()` * removed `Application::getTerminalWidth()/getTerminalHeight()` and - `Application::setTerminalDimensions()/getTerminalDimensions()` -* removed `ConsoleExceptionEvent` -* removed `ConsoleEvents::EXCEPTION` + `Application::setTerminalDimensions()/getTerminalDimensions()` + * removed `ConsoleExceptionEvent` + * removed `ConsoleEvents::EXCEPTION` 3.4.0 ----- @@ -66,23 +66,23 @@ CHANGELOG 3.3.0 ----- -* added `ExceptionListener` -* added `AddConsoleCommandPass` (originally in FrameworkBundle) -* [BC BREAK] `Input::getOption()` no longer returns the default value for options - with value optional explicitly passed empty -* added console.error event to catch exceptions thrown by other listeners -* deprecated console.exception event in favor of console.error -* added ability to handle `CommandNotFoundException` through the - `console.error` event -* deprecated default validation in `SymfonyQuestionHelper::ask` + * added `ExceptionListener` + * added `AddConsoleCommandPass` (originally in FrameworkBundle) + * [BC BREAK] `Input::getOption()` no longer returns the default value for options + with value optional explicitly passed empty + * added console.error event to catch exceptions thrown by other listeners + * deprecated console.exception event in favor of console.error + * added ability to handle `CommandNotFoundException` through the + `console.error` event + * deprecated default validation in `SymfonyQuestionHelper::ask` 3.2.0 ------ -* added `setInputs()` method to CommandTester for ease testing of commands expecting inputs -* added `setStream()` and `getStream()` methods to Input (implement StreamableInputInterface) -* added StreamableInputInterface -* added LockableTrait + * added `setInputs()` method to CommandTester for ease testing of commands expecting inputs + * added `setStream()` and `getStream()` methods to Input (implement StreamableInputInterface) + * added StreamableInputInterface + * added LockableTrait 3.1.0 ----- From 4aee737c5a15ed900f2254cfb6593a3032b9a527 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Fri, 11 Dec 2020 13:47:35 +0100 Subject: [PATCH 5/6] Remove void return type from test methods --- Tests/Helper/ProgressBarTest.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Tests/Helper/ProgressBarTest.php b/Tests/Helper/ProgressBarTest.php index b5d2b5f6e..24c69789c 100644 --- a/Tests/Helper/ProgressBarTest.php +++ b/Tests/Helper/ProgressBarTest.php @@ -872,7 +872,7 @@ public function provideFormat(): array ]; } - public function testIterate(): void + public function testIterate() { $bar = new ProgressBar($output = $this->getOutputStream(), 0, 0); @@ -887,7 +887,7 @@ public function testIterate(): void ); } - public function testIterateUncountable(): void + public function testIterateUncountable() { $bar = new ProgressBar($output = $this->getOutputStream(), 0, 0); @@ -936,7 +936,7 @@ public function testBarWidthWithMultilineFormat() putenv('COLUMNS=120'); } - public function testMinAndMaxSecondsBetweenRedraws(): void + public function testMinAndMaxSecondsBetweenRedraws() { $bar = new ProgressBar($output = $this->getOutputStream()); $bar->setRedrawFrequency(1); @@ -959,7 +959,7 @@ public function testMinAndMaxSecondsBetweenRedraws(): void ); } - public function testMaxSecondsBetweenRedraws(): void + public function testMaxSecondsBetweenRedraws() { $bar = new ProgressBar($output = $this->getOutputStream(), 0, 0); $bar->setRedrawFrequency(4); // disable step based redraws @@ -1014,7 +1014,7 @@ public function testMinSecondsBetweenRedraws() ); } - public function testNoWriteWhenMessageIsSame(): void + public function testNoWriteWhenMessageIsSame() { $bar = new ProgressBar($output = $this->getOutputStream(), 2); $bar->start(); From 12e071278e396cc3e1c149857337e9e192deca0b Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 18 Dec 2020 08:41:31 +0100 Subject: [PATCH 6/6] Remove :void in test function signatures --- Tests/Helper/ProgressBarTest.php | 10 +++++----- Tests/Helper/TableTest.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Tests/Helper/ProgressBarTest.php b/Tests/Helper/ProgressBarTest.php index 5804f9cd5..d927f4dfc 100644 --- a/Tests/Helper/ProgressBarTest.php +++ b/Tests/Helper/ProgressBarTest.php @@ -872,7 +872,7 @@ public function provideFormat(): array ]; } - public function testIterate(): void + public function testIterate() { $bar = new ProgressBar($output = $this->getOutputStream(), 0, 0); @@ -887,7 +887,7 @@ public function testIterate(): void ); } - public function testIterateUncountable(): void + public function testIterateUncountable() { $bar = new ProgressBar($output = $this->getOutputStream(), 0, 0); @@ -936,7 +936,7 @@ public function testBarWidthWithMultilineFormat() putenv('COLUMNS=120'); } - public function testMinAndMaxSecondsBetweenRedraws(): void + public function testMinAndMaxSecondsBetweenRedraws() { $bar = new ProgressBar($output = $this->getOutputStream()); $bar->setRedrawFrequency(1); @@ -959,7 +959,7 @@ public function testMinAndMaxSecondsBetweenRedraws(): void ); } - public function testMaxSecondsBetweenRedraws(): void + public function testMaxSecondsBetweenRedraws() { $bar = new ProgressBar($output = $this->getOutputStream(), 0, 0); $bar->setRedrawFrequency(4); // disable step based redraws @@ -1014,7 +1014,7 @@ public function testMinSecondsBetweenRedraws() ); } - public function testNoWriteWhenMessageIsSame(): void + public function testNoWriteWhenMessageIsSame() { $bar = new ProgressBar($output = $this->getOutputStream(), 2); $bar->start(); diff --git a/Tests/Helper/TableTest.php b/Tests/Helper/TableTest.php index 3616333ec..dffaaf902 100644 --- a/Tests/Helper/TableTest.php +++ b/Tests/Helper/TableTest.php @@ -1263,7 +1263,7 @@ protected function getOutputContent(StreamOutput $output) return str_replace(\PHP_EOL, "\n", stream_get_contents($output->getStream())); } - public function testWithColspanAndMaxWith(): void + public function testWithColspanAndMaxWith() { $table = new Table($output = $this->getOutputStream());