From 6cc1fffa8236816c19e2460faadfd3d3e7b74e0c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 3 Feb 2024 03:34:15 +0000 Subject: [PATCH] chore(deps): Bump symfony/console from 5.4.24 to 5.4.35 Bumps [symfony/console](https://github.com/symfony/console) from 5.4.24 to 5.4.35. - [Release notes](https://github.com/symfony/console/releases) - [Changelog](https://github.com/symfony/console/blob/7.0/CHANGELOG.md) - [Commits](https://github.com/symfony/console/compare/v5.4.24...v5.4.35) --- updated-dependencies: - dependency-name: symfony/console dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 57 +++++++++-------- composer/installed.json | 63 ++++++++++--------- composer/installed.php | 22 +++---- symfony/console/Application.php | 6 +- symfony/console/CI/GithubActionReporter.php | 8 +-- symfony/console/Command/Command.php | 8 +-- symfony/console/Command/LazyCommand.php | 6 +- symfony/console/Command/LockableTrait.php | 2 +- .../Descriptor/ApplicationDescription.php | 2 +- symfony/console/Descriptor/XmlDescriptor.php | 2 +- symfony/console/Event/ConsoleCommandEvent.php | 5 +- symfony/console/Event/ConsoleErrorEvent.php | 2 +- .../console/EventListener/ErrorListener.php | 2 +- .../Exception/CommandNotFoundException.php | 2 +- .../Formatter/NullOutputFormatterStyle.php | 4 +- symfony/console/Formatter/OutputFormatter.php | 11 +++- .../Formatter/OutputFormatterStyle.php | 6 +- .../OutputFormatterStyleInterface.php | 4 +- .../Formatter/OutputFormatterStyleStack.php | 4 +- symfony/console/Helper/Dumper.php | 2 +- symfony/console/Helper/Helper.php | 4 +- symfony/console/Helper/HelperInterface.php | 2 +- symfony/console/Helper/HelperSet.php | 4 +- symfony/console/Helper/ProcessHelper.php | 6 +- symfony/console/Helper/ProgressBar.php | 4 +- symfony/console/Helper/ProgressIndicator.php | 4 +- symfony/console/Helper/Table.php | 4 +- symfony/console/Helper/TableStyle.php | 6 +- symfony/console/Input/ArgvInput.php | 2 +- symfony/console/Input/ArrayInput.php | 2 +- symfony/console/Input/Input.php | 2 +- symfony/console/Input/InputArgument.php | 2 +- symfony/console/Input/InputOption.php | 8 +-- symfony/console/Output/ConsoleOutput.php | 2 +- .../console/Output/ConsoleSectionOutput.php | 2 +- symfony/console/Output/Output.php | 2 +- symfony/console/Output/StreamOutput.php | 53 ++++++++++++---- .../console/Output/TrimmedBufferOutput.php | 2 +- symfony/console/Question/Question.php | 4 +- symfony/console/SingleCommandApplication.php | 2 +- symfony/console/Style/StyleInterface.php | 4 +- symfony/console/Style/SymfonyStyle.php | 10 +-- symfony/polyfill-ctype/Ctype.php | 53 +++++++++------- symfony/polyfill-ctype/LICENSE | 2 +- symfony/polyfill-php73/LICENSE | 2 +- .../Resources/stubs/JsonException.php | 6 +- 46 files changed, 232 insertions(+), 180 deletions(-) diff --git a/composer.lock b/composer.lock index a93ffacfb..b9ca556dd 100644 --- a/composer.lock +++ b/composer.lock @@ -4456,16 +4456,16 @@ }, { "name": "symfony/console", - "version": "v5.4.24", + "version": "v5.4.35", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8" + "reference": "dbdf6adcb88d5f83790e1efb57ef4074309d3931" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8", - "reference": "560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8", + "url": "https://api.github.com/repos/symfony/console/zipball/dbdf6adcb88d5f83790e1efb57ef4074309d3931", + "reference": "dbdf6adcb88d5f83790e1efb57ef4074309d3931", "shasum": "" }, "require": { @@ -4535,7 +4535,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.24" + "source": "https://github.com/symfony/console/tree/v5.4.35" }, "funding": [ { @@ -4551,7 +4551,7 @@ "type": "tidelift" } ], - "time": "2023-05-26T05:13:16+00:00" + "time": "2024-01-23T14:28:09+00:00" }, { "name": "symfony/css-selector", @@ -5163,28 +5163,31 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.23.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-ctype": "*" + }, "suggest": { "ext-ctype": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5192,12 +5195,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -5222,7 +5225,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" }, "funding": [ { @@ -5238,7 +5241,7 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-intl-grapheme", @@ -5653,16 +5656,16 @@ }, { "name": "symfony/polyfill-php73", - "version": "v1.23.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" + "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fe2f306d1d9d346a7fee353d0d5012e401e984b5", + "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5", "shasum": "" }, "require": { @@ -5671,7 +5674,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5679,12 +5682,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -5712,7 +5715,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.28.0" }, "funding": [ { @@ -5728,7 +5731,7 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-php80", diff --git a/composer/installed.json b/composer/installed.json index b2fd12967..4ff34b2e3 100644 --- a/composer/installed.json +++ b/composer/installed.json @@ -4651,17 +4651,17 @@ }, { "name": "symfony/console", - "version": "v5.4.24", - "version_normalized": "5.4.24.0", + "version": "v5.4.35", + "version_normalized": "5.4.35.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8" + "reference": "dbdf6adcb88d5f83790e1efb57ef4074309d3931" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8", - "reference": "560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8", + "url": "https://api.github.com/repos/symfony/console/zipball/dbdf6adcb88d5f83790e1efb57ef4074309d3931", + "reference": "dbdf6adcb88d5f83790e1efb57ef4074309d3931", "shasum": "" }, "require": { @@ -4699,7 +4699,7 @@ "symfony/lock": "", "symfony/process": "" }, - "time": "2023-05-26T05:13:16+00:00", + "time": "2024-01-23T14:28:09+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -4733,7 +4733,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.24" + "source": "https://github.com/symfony/console/tree/v5.4.35" }, "funding": [ { @@ -5385,30 +5385,33 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.23.0", - "version_normalized": "1.23.0.0", + "version": "v1.28.0", + "version_normalized": "1.28.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-ctype": "*" + }, "suggest": { "ext-ctype": "For best performance" }, - "time": "2021-02-19T12:13:01+00:00", + "time": "2023-01-26T09:26:14+00:00", "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5417,12 +5420,12 @@ }, "installation-source": "dist", "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -5447,7 +5450,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" }, "funding": [ { @@ -5893,27 +5896,27 @@ }, { "name": "symfony/polyfill-php73", - "version": "v1.23.0", - "version_normalized": "1.23.0.0", + "version": "v1.28.0", + "version_normalized": "1.28.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" + "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fe2f306d1d9d346a7fee353d0d5012e401e984b5", + "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5", "shasum": "" }, "require": { "php": ">=7.1" }, - "time": "2021-02-19T12:13:01+00:00", + "time": "2023-01-26T09:26:14+00:00", "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5922,12 +5925,12 @@ }, "installation-source": "dist", "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -5955,7 +5958,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.28.0" }, "funding": [ { diff --git a/composer/installed.php b/composer/installed.php index 09f4302ab..81448daba 100644 --- a/composer/installed.php +++ b/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'nextcloud/3rdparty', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '4563c55bf7abac69a9e16d43400fcddff2a98c4f', + 'reference' => 'd3ba5617189292ace65a2920a61b3ac5e456d37d', 'type' => 'library', 'install_path' => __DIR__ . '/../', 'aliases' => array(), @@ -319,7 +319,7 @@ 'nextcloud/3rdparty' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '4563c55bf7abac69a9e16d43400fcddff2a98c4f', + 'reference' => 'd3ba5617189292ace65a2920a61b3ac5e456d37d', 'type' => 'library', 'install_path' => __DIR__ . '/../', 'aliases' => array(), @@ -689,9 +689,9 @@ 'dev_requirement' => false, ), 'symfony/console' => array( - 'pretty_version' => 'v5.4.24', - 'version' => '5.4.24.0', - 'reference' => '560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8', + 'pretty_version' => 'v5.4.35', + 'version' => '5.4.35.0', + 'reference' => 'dbdf6adcb88d5f83790e1efb57ef4074309d3931', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/console', 'aliases' => array(), @@ -776,9 +776,9 @@ 'dev_requirement' => false, ), 'symfony/polyfill-ctype' => array( - 'pretty_version' => 'v1.23.0', - 'version' => '1.23.0.0', - 'reference' => '46cd95797e9df938fdd2b03693b5fca5e64b01ce', + 'pretty_version' => 'v1.28.0', + 'version' => '1.28.0.0', + 'reference' => 'ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-ctype', 'aliases' => array(), @@ -830,9 +830,9 @@ 'dev_requirement' => false, ), 'symfony/polyfill-php73' => array( - 'pretty_version' => 'v1.23.0', - 'version' => '1.23.0.0', - 'reference' => 'fba8933c384d6476ab14fb7b8526e5287ca7e010', + 'pretty_version' => 'v1.28.0', + 'version' => '1.28.0.0', + 'reference' => 'fe2f306d1d9d346a7fee353d0d5012e401e984b5', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-php73', 'aliases' => array(), diff --git a/symfony/console/Application.php b/symfony/console/Application.php index 29951e9c1..bb5341882 100644 --- a/symfony/console/Application.php +++ b/symfony/console/Application.php @@ -134,7 +134,7 @@ public function setSignalsToDispatchEvent(int ...$signalsToDispatchEvent) * * @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()); @@ -778,7 +778,7 @@ public function find(string $name) * * @return Command[] */ - public function all(string $namespace = null) + public function all(?string $namespace = null) { $this->init(); @@ -1147,7 +1147,7 @@ private function getAbbreviationSuggestions(array $abbrevs): string * * @return string */ - public function extractNamespace(string $name, int $limit = null) + public function extractNamespace(string $name, ?int $limit = null) { $parts = explode(':', $name, -1); diff --git a/symfony/console/CI/GithubActionReporter.php b/symfony/console/CI/GithubActionReporter.php index a15c1ff18..065717854 100644 --- a/symfony/console/CI/GithubActionReporter.php +++ b/symfony/console/CI/GithubActionReporter.php @@ -57,7 +57,7 @@ public static function isGithubActionEnvironment(): bool * * @see https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-error-message */ - public function error(string $message, string $file = null, int $line = null, int $col = null): void + public function error(string $message, ?string $file = null, ?int $line = null, ?int $col = null): void { $this->log('error', $message, $file, $line, $col); } @@ -67,7 +67,7 @@ public function error(string $message, string $file = null, int $line = null, in * * @see https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-a-warning-message */ - public function warning(string $message, string $file = null, int $line = null, int $col = null): void + public function warning(string $message, ?string $file = null, ?int $line = null, ?int $col = null): void { $this->log('warning', $message, $file, $line, $col); } @@ -77,12 +77,12 @@ public function warning(string $message, string $file = null, int $line = null, * * @see https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-a-debug-message */ - public function debug(string $message, string $file = null, int $line = null, int $col = null): void + public function debug(string $message, ?string $file = null, ?int $line = null, ?int $col = null): void { $this->log('debug', $message, $file, $line, $col); } - private function log(string $type, string $message, string $file = null, int $line = null, int $col = null): void + private function log(string $type, string $message, ?string $file = null, ?int $line = null, ?int $col = null): void { // Some values must be encoded. $message = strtr($message, self::ESCAPED_DATA); diff --git a/symfony/console/Command/Command.php b/symfony/console/Command/Command.php index cfa18361e..d18103670 100644 --- a/symfony/console/Command/Command.php +++ b/symfony/console/Command/Command.php @@ -96,7 +96,7 @@ public static function getDefaultDescription(): ?string * * @throws LogicException When the command name is empty */ - public function __construct(string $name = null) + public function __construct(?string $name = null) { $this->definition = new InputDefinition(); @@ -132,7 +132,7 @@ public function ignoreValidationErrors() $this->ignoreValidationErrors = true; } - public function setApplication(Application $application = null) + public function setApplication(?Application $application = null) { $this->application = $application; if ($application) { @@ -433,7 +433,7 @@ public function getNativeDefinition() * * @throws InvalidArgumentException When argument mode is not valid */ - public function addArgument(string $name, int $mode = null, string $description = '', $default = null) + public function addArgument(string $name, ?int $mode = null, string $description = '', $default = null) { $this->definition->addArgument(new InputArgument($name, $mode, $description, $default)); if (null !== $this->fullDefinition) { @@ -454,7 +454,7 @@ public function addArgument(string $name, int $mode = null, string $description * * @throws InvalidArgumentException If option mode is invalid or incompatible */ - public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null) + public function addOption(string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null) { $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default)); if (null !== $this->fullDefinition) { diff --git a/symfony/console/Command/LazyCommand.php b/symfony/console/Command/LazyCommand.php index e576ad03f..302a0809e 100644 --- a/symfony/console/Command/LazyCommand.php +++ b/symfony/console/Command/LazyCommand.php @@ -43,7 +43,7 @@ public function ignoreValidationErrors(): void $this->getCommand()->ignoreValidationErrors(); } - public function setApplication(Application $application = null): void + public function setApplication(?Application $application = null): void { if ($this->command instanceof parent) { $this->command->setApplication($application); @@ -117,7 +117,7 @@ public function getNativeDefinition(): InputDefinition /** * @return $this */ - public function addArgument(string $name, int $mode = null, string $description = '', $default = null): self + public function addArgument(string $name, ?int $mode = null, string $description = '', $default = null): self { $this->getCommand()->addArgument($name, $mode, $description, $default); @@ -127,7 +127,7 @@ public function addArgument(string $name, int $mode = null, string $description /** * @return $this */ - public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null): self + public function addOption(string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null): self { $this->getCommand()->addOption($name, $shortcut, $mode, $description, $default); diff --git a/symfony/console/Command/LockableTrait.php b/symfony/console/Command/LockableTrait.php index b1856dca7..d21edc2c0 100644 --- a/symfony/console/Command/LockableTrait.php +++ b/symfony/console/Command/LockableTrait.php @@ -30,7 +30,7 @@ trait LockableTrait /** * Locks a command. */ - private function lock(string $name = null, bool $blocking = false): bool + private function lock(?string $name = null, bool $blocking = false): bool { if (!class_exists(SemaphoreStore::class)) { throw new LogicException('To enable the locking feature you must install the symfony/lock component.'); diff --git a/symfony/console/Descriptor/ApplicationDescription.php b/symfony/console/Descriptor/ApplicationDescription.php index 2a3acc99b..eb11b4f91 100644 --- a/symfony/console/Descriptor/ApplicationDescription.php +++ b/symfony/console/Descriptor/ApplicationDescription.php @@ -43,7 +43,7 @@ class ApplicationDescription */ private $aliases; - public function __construct(Application $application, string $namespace = null, bool $showHidden = false) + public function __construct(Application $application, ?string $namespace = null, bool $showHidden = false) { $this->application = $application; $this->namespace = $namespace; diff --git a/symfony/console/Descriptor/XmlDescriptor.php b/symfony/console/Descriptor/XmlDescriptor.php index 4f7cd8b3e..f17e5f1f2 100644 --- a/symfony/console/Descriptor/XmlDescriptor.php +++ b/symfony/console/Descriptor/XmlDescriptor.php @@ -79,7 +79,7 @@ public function getCommandDocument(Command $command, bool $short = false): \DOMD return $dom; } - public function getApplicationDocument(Application $application, string $namespace = null, bool $short = false): \DOMDocument + public function getApplicationDocument(Application $application, ?string $namespace = null, bool $short = false): \DOMDocument { $dom = new \DOMDocument('1.0', 'UTF-8'); $dom->appendChild($rootXml = $dom->createElement('symfony')); diff --git a/symfony/console/Event/ConsoleCommandEvent.php b/symfony/console/Event/ConsoleCommandEvent.php index 08bd18fd1..1b4f9f9b1 100644 --- a/symfony/console/Event/ConsoleCommandEvent.php +++ b/symfony/console/Event/ConsoleCommandEvent.php @@ -12,7 +12,10 @@ namespace Symfony\Component\Console\Event; /** - * Allows to do things before the command is executed, like skipping the command or changing the input. + * Allows to do things before the command is executed, like skipping the command or executing code before the command is + * going to be executed. + * + * Changing the input arguments will have no effect. * * @author Fabien Potencier */ diff --git a/symfony/console/Event/ConsoleErrorEvent.php b/symfony/console/Event/ConsoleErrorEvent.php index 57d9b38ba..d4c26493f 100644 --- a/symfony/console/Event/ConsoleErrorEvent.php +++ b/symfony/console/Event/ConsoleErrorEvent.php @@ -25,7 +25,7 @@ final class ConsoleErrorEvent extends ConsoleEvent private $error; private $exitCode; - public function __construct(InputInterface $input, OutputInterface $output, \Throwable $error, Command $command = null) + public function __construct(InputInterface $input, OutputInterface $output, \Throwable $error, ?Command $command = null) { parent::__construct($command, $input, $output); diff --git a/symfony/console/EventListener/ErrorListener.php b/symfony/console/EventListener/ErrorListener.php index 897d9853f..e9c9e3ea4 100644 --- a/symfony/console/EventListener/ErrorListener.php +++ b/symfony/console/EventListener/ErrorListener.php @@ -26,7 +26,7 @@ class ErrorListener implements EventSubscriberInterface { private $logger; - public function __construct(LoggerInterface $logger = null) + public function __construct(?LoggerInterface $logger = null) { $this->logger = $logger; } diff --git a/symfony/console/Exception/CommandNotFoundException.php b/symfony/console/Exception/CommandNotFoundException.php index 910ae1928..81ec318ab 100644 --- a/symfony/console/Exception/CommandNotFoundException.php +++ b/symfony/console/Exception/CommandNotFoundException.php @@ -26,7 +26,7 @@ class CommandNotFoundException extends \InvalidArgumentException implements Exce * @param int $code Exception code * @param \Throwable|null $previous Previous exception used for the exception chaining */ - public function __construct(string $message, array $alternatives = [], int $code = 0, \Throwable $previous = null) + public function __construct(string $message, array $alternatives = [], int $code = 0, ?\Throwable $previous = null) { parent::__construct($message, $code, $previous); diff --git a/symfony/console/Formatter/NullOutputFormatterStyle.php b/symfony/console/Formatter/NullOutputFormatterStyle.php index 9232510f4..afd3d0043 100644 --- a/symfony/console/Formatter/NullOutputFormatterStyle.php +++ b/symfony/console/Formatter/NullOutputFormatterStyle.php @@ -27,7 +27,7 @@ public function apply(string $text): string /** * {@inheritdoc} */ - public function setBackground(string $color = null): void + public function setBackground(?string $color = null): void { // do nothing } @@ -35,7 +35,7 @@ public function setBackground(string $color = null): void /** * {@inheritdoc} */ - public function setForeground(string $color = null): void + public function setForeground(?string $color = null): void { // do nothing } diff --git a/symfony/console/Formatter/OutputFormatter.php b/symfony/console/Formatter/OutputFormatter.php index 603e5dca0..4ec600244 100644 --- a/symfony/console/Formatter/OutputFormatter.php +++ b/symfony/console/Formatter/OutputFormatter.php @@ -13,6 +13,8 @@ use Symfony\Component\Console\Exception\InvalidArgumentException; +use function Symfony\Component\String\b; + /** * Formatter class for console output. * @@ -258,7 +260,7 @@ private function applyCurrentStyle(string $text, string $current, int $width, in } preg_match('~(\\n)$~', $text, $matches); - $text = $prefix.preg_replace('~([^\\n]{'.$width.'})\\ *~', "\$1\n", $text); + $text = $prefix.$this->addLineBreaks($text, $width); $text = rtrim($text, "\n").($matches[1] ?? ''); if (!$currentLineLength && '' !== $current && "\n" !== substr($current, -1)) { @@ -282,4 +284,11 @@ private function applyCurrentStyle(string $text, string $current, int $width, in return implode("\n", $lines); } + + private function addLineBreaks(string $text, int $width): string + { + $encoding = mb_detect_encoding($text, null, true) ?: 'UTF-8'; + + return b($text)->toCodePointString($encoding)->wordwrap($width, "\n", true)->toByteString($encoding); + } } diff --git a/symfony/console/Formatter/OutputFormatterStyle.php b/symfony/console/Formatter/OutputFormatterStyle.php index 8370ba058..d7ae66494 100644 --- a/symfony/console/Formatter/OutputFormatterStyle.php +++ b/symfony/console/Formatter/OutputFormatterStyle.php @@ -33,7 +33,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface * @param string|null $foreground The style foreground color name * @param string|null $background The style background color name */ - public function __construct(string $foreground = null, string $background = null, array $options = []) + public function __construct(?string $foreground = null, ?string $background = null, array $options = []) { $this->color = new Color($this->foreground = $foreground ?: '', $this->background = $background ?: '', $this->options = $options); } @@ -41,7 +41,7 @@ public function __construct(string $foreground = null, string $background = null /** * {@inheritdoc} */ - public function setForeground(string $color = null) + public function setForeground(?string $color = null) { $this->color = new Color($this->foreground = $color ?: '', $this->background, $this->options); } @@ -49,7 +49,7 @@ public function setForeground(string $color = null) /** * {@inheritdoc} */ - public function setBackground(string $color = null) + public function setBackground(?string $color = null) { $this->color = new Color($this->foreground, $this->background = $color ?: '', $this->options); } diff --git a/symfony/console/Formatter/OutputFormatterStyleInterface.php b/symfony/console/Formatter/OutputFormatterStyleInterface.php index b30560d22..89e4d2438 100644 --- a/symfony/console/Formatter/OutputFormatterStyleInterface.php +++ b/symfony/console/Formatter/OutputFormatterStyleInterface.php @@ -21,12 +21,12 @@ interface OutputFormatterStyleInterface /** * Sets style foreground color. */ - public function setForeground(string $color = null); + public function setForeground(?string $color = null); /** * Sets style background color. */ - public function setBackground(string $color = null); + public function setBackground(?string $color = null); /** * Sets some specific style option. diff --git a/symfony/console/Formatter/OutputFormatterStyleStack.php b/symfony/console/Formatter/OutputFormatterStyleStack.php index fc48dc0e1..1b9356301 100644 --- a/symfony/console/Formatter/OutputFormatterStyleStack.php +++ b/symfony/console/Formatter/OutputFormatterStyleStack.php @@ -26,7 +26,7 @@ class OutputFormatterStyleStack implements ResetInterface private $emptyStyle; - public function __construct(OutputFormatterStyleInterface $emptyStyle = null) + public function __construct(?OutputFormatterStyleInterface $emptyStyle = null) { $this->emptyStyle = $emptyStyle ?? new OutputFormatterStyle(); $this->reset(); @@ -55,7 +55,7 @@ public function push(OutputFormatterStyleInterface $style) * * @throws InvalidArgumentException When style tags incorrectly nested */ - public function pop(OutputFormatterStyleInterface $style = null) + public function pop(?OutputFormatterStyleInterface $style = null) { if (empty($this->styles)) { return $this->emptyStyle; diff --git a/symfony/console/Helper/Dumper.php b/symfony/console/Helper/Dumper.php index b013b6c52..605e4d70b 100644 --- a/symfony/console/Helper/Dumper.php +++ b/symfony/console/Helper/Dumper.php @@ -26,7 +26,7 @@ final class Dumper private $cloner; private $handler; - public function __construct(OutputInterface $output, CliDumper $dumper = null, ClonerInterface $cloner = null) + public function __construct(OutputInterface $output, ?CliDumper $dumper = null, ?ClonerInterface $cloner = null) { $this->output = $output; $this->dumper = $dumper; diff --git a/symfony/console/Helper/Helper.php b/symfony/console/Helper/Helper.php index c7d3e25d0..6b3f7f43a 100644 --- a/symfony/console/Helper/Helper.php +++ b/symfony/console/Helper/Helper.php @@ -26,7 +26,7 @@ abstract class Helper implements HelperInterface /** * {@inheritdoc} */ - public function setHelperSet(HelperSet $helperSet = null) + public function setHelperSet(?HelperSet $helperSet = null) { $this->helperSet = $helperSet; } @@ -96,7 +96,7 @@ public static function length(?string $string): int * * @return string */ - public static function substr(?string $string, int $from, int $length = null) + public static function substr(?string $string, int $from, ?int $length = null) { $string ?? $string = ''; diff --git a/symfony/console/Helper/HelperInterface.php b/symfony/console/Helper/HelperInterface.php index fc952b486..5bf4d6327 100644 --- a/symfony/console/Helper/HelperInterface.php +++ b/symfony/console/Helper/HelperInterface.php @@ -21,7 +21,7 @@ interface HelperInterface /** * Sets the helper set associated with this helper. */ - public function setHelperSet(HelperSet $helperSet = null); + public function setHelperSet(?HelperSet $helperSet = null); /** * Gets the helper set associated with this helper. diff --git a/symfony/console/Helper/HelperSet.php b/symfony/console/Helper/HelperSet.php index 719762d24..c870ab997 100644 --- a/symfony/console/Helper/HelperSet.php +++ b/symfony/console/Helper/HelperSet.php @@ -37,7 +37,7 @@ public function __construct(array $helpers = []) } } - public function set(HelperInterface $helper, string $alias = null) + public function set(HelperInterface $helper, ?string $alias = null) { $this->helpers[$helper->getName()] = $helper; if (null !== $alias) { @@ -76,7 +76,7 @@ public function get(string $name) /** * @deprecated since Symfony 5.4 */ - public function setCommand(Command $command = null) + public function setCommand(?Command $command = null) { trigger_deprecation('symfony/console', '5.4', 'Method "%s()" is deprecated.', __METHOD__); diff --git a/symfony/console/Helper/ProcessHelper.php b/symfony/console/Helper/ProcessHelper.php index 4ea3d724d..86a250b27 100644 --- a/symfony/console/Helper/ProcessHelper.php +++ b/symfony/console/Helper/ProcessHelper.php @@ -32,7 +32,7 @@ class ProcessHelper extends Helper * @param callable|null $callback A PHP callback to run whenever there is some * output available on STDOUT or STDERR */ - public function run(OutputInterface $output, $cmd, string $error = null, callable $callback = null, int $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE): Process + public function run(OutputInterface $output, $cmd, ?string $error = null, ?callable $callback = null, int $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE): Process { if (!class_exists(Process::class)) { throw new \LogicException('The ProcessHelper cannot be run as the Process component is not installed. Try running "compose require symfony/process".'); @@ -98,7 +98,7 @@ public function run(OutputInterface $output, $cmd, string $error = null, callabl * * @see run() */ - public function mustRun(OutputInterface $output, $cmd, string $error = null, callable $callback = null): Process + public function mustRun(OutputInterface $output, $cmd, ?string $error = null, ?callable $callback = null): Process { $process = $this->run($output, $cmd, $error, $callback); @@ -112,7 +112,7 @@ public function mustRun(OutputInterface $output, $cmd, string $error = null, cal /** * Wraps a Process callback to add debugging output. */ - public function wrapCallback(OutputInterface $output, Process $process, callable $callback = null): callable + public function wrapCallback(OutputInterface $output, Process $process, ?callable $callback = null): callable { if ($output instanceof ConsoleOutputInterface) { $output = $output->getErrorOutput(); diff --git a/symfony/console/Helper/ProgressBar.php b/symfony/console/Helper/ProgressBar.php index eb6aacb1a..1d7b8d456 100644 --- a/symfony/console/Helper/ProgressBar.php +++ b/symfony/console/Helper/ProgressBar.php @@ -293,7 +293,7 @@ public function maxSecondsBetweenRedraws(float $seconds): void * * @param int|null $max Number of steps to complete the bar (0 if indeterminate), if null it will be inferred from $iterable */ - public function iterate(iterable $iterable, int $max = null): iterable + public function iterate(iterable $iterable, ?int $max = null): iterable { $this->start($max ?? (is_countable($iterable) ? \count($iterable) : 0)); @@ -311,7 +311,7 @@ public function iterate(iterable $iterable, int $max = null): iterable * * @param int|null $max Number of steps to complete the bar (0 if indeterminate), null to leave unchanged */ - public function start(int $max = null) + public function start(?int $max = null) { $this->startTime = time(); $this->step = 0; diff --git a/symfony/console/Helper/ProgressIndicator.php b/symfony/console/Helper/ProgressIndicator.php index 3482343fc..3cc0e1451 100644 --- a/symfony/console/Helper/ProgressIndicator.php +++ b/symfony/console/Helper/ProgressIndicator.php @@ -50,7 +50,7 @@ class ProgressIndicator * @param int $indicatorChangeInterval Change interval in milliseconds * @param array|null $indicatorValues Animated indicator characters */ - public function __construct(OutputInterface $output, string $format = null, int $indicatorChangeInterval = 100, array $indicatorValues = null) + public function __construct(OutputInterface $output, ?string $format = null, int $indicatorChangeInterval = 100, ?array $indicatorValues = null) { $this->output = $output; @@ -129,8 +129,6 @@ public function advance() /** * Finish the indicator with message. - * - * @param $message */ public function finish(string $message) { diff --git a/symfony/console/Helper/Table.php b/symfony/console/Helper/Table.php index 5c3447ab3..408a76d67 100644 --- a/symfony/console/Helper/Table.php +++ b/symfony/console/Helper/Table.php @@ -451,7 +451,7 @@ public function render() * * +-----+-----------+-------+ */ - private function renderRowSeparator(int $type = self::SEPARATOR_MID, string $title = null, string $titleFormat = null) + private function renderRowSeparator(int $type = self::SEPARATOR_MID, ?string $title = null, ?string $titleFormat = null) { if (0 === $count = $this->numberOfColumns) { return; @@ -516,7 +516,7 @@ private function renderColumnSeparator(int $type = self::BORDER_OUTSIDE): string * * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | */ - private function renderRow(array $row, string $cellFormat, string $firstCellFormat = null) + private function renderRow(array $row, string $cellFormat, ?string $firstCellFormat = null) { $rowContent = $this->renderColumnSeparator(self::BORDER_OUTSIDE); $columns = $this->getRowColumns($row); diff --git a/symfony/console/Helper/TableStyle.php b/symfony/console/Helper/TableStyle.php index dfc41e6a4..0643c79eb 100644 --- a/symfony/console/Helper/TableStyle.php +++ b/symfony/console/Helper/TableStyle.php @@ -90,7 +90,7 @@ public function getPaddingChar() * * @return $this */ - public function setHorizontalBorderChars(string $outside, string $inside = null): self + public function setHorizontalBorderChars(string $outside, ?string $inside = null): self { $this->horizontalOutsideBorderChar = $outside; $this->horizontalInsideBorderChar = $inside ?? $outside; @@ -115,7 +115,7 @@ public function setHorizontalBorderChars(string $outside, string $inside = null) * * @return $this */ - public function setVerticalBorderChars(string $outside, string $inside = null): self + public function setVerticalBorderChars(string $outside, ?string $inside = null): self { $this->verticalOutsideBorderChar = $outside; $this->verticalInsideBorderChar = $inside ?? $outside; @@ -169,7 +169,7 @@ public function getBorderChars(): array * * @return $this */ - public function setCrossingChars(string $cross, string $topLeft, string $topMid, string $topRight, string $midRight, string $bottomRight, string $bottomMid, string $bottomLeft, string $midLeft, string $topLeftBottom = null, string $topMidBottom = null, string $topRightBottom = null): self + public function setCrossingChars(string $cross, string $topLeft, string $topMid, string $topRight, string $midRight, string $bottomRight, string $bottomMid, string $bottomLeft, string $midLeft, ?string $topLeftBottom = null, ?string $topMidBottom = null, ?string $topRightBottom = null): self { $this->crossingChar = $cross; $this->crossingTopLeftChar = $topLeft; diff --git a/symfony/console/Input/ArgvInput.php b/symfony/console/Input/ArgvInput.php index 675b9ef58..0c4b2d25b 100644 --- a/symfony/console/Input/ArgvInput.php +++ b/symfony/console/Input/ArgvInput.php @@ -43,7 +43,7 @@ class ArgvInput extends Input private $tokens; private $parsed; - public function __construct(array $argv = null, InputDefinition $definition = null) + public function __construct(?array $argv = null, ?InputDefinition $definition = null) { $argv = $argv ?? $_SERVER['argv'] ?? []; diff --git a/symfony/console/Input/ArrayInput.php b/symfony/console/Input/ArrayInput.php index c65161484..21a517cfb 100644 --- a/symfony/console/Input/ArrayInput.php +++ b/symfony/console/Input/ArrayInput.php @@ -27,7 +27,7 @@ class ArrayInput extends Input { private $parameters; - public function __construct(array $parameters, InputDefinition $definition = null) + public function __construct(array $parameters, ?InputDefinition $definition = null) { $this->parameters = $parameters; diff --git a/symfony/console/Input/Input.php b/symfony/console/Input/Input.php index d37460ed3..0faab2cf1 100644 --- a/symfony/console/Input/Input.php +++ b/symfony/console/Input/Input.php @@ -33,7 +33,7 @@ abstract class Input implements InputInterface, StreamableInputInterface protected $arguments = []; protected $interactive = true; - public function __construct(InputDefinition $definition = null) + public function __construct(?InputDefinition $definition = null) { if (null === $definition) { $this->definition = new InputDefinition(); diff --git a/symfony/console/Input/InputArgument.php b/symfony/console/Input/InputArgument.php index 8a64f7ac8..1a8bf44b7 100644 --- a/symfony/console/Input/InputArgument.php +++ b/symfony/console/Input/InputArgument.php @@ -38,7 +38,7 @@ class InputArgument * * @throws InvalidArgumentException When argument mode is not valid */ - public function __construct(string $name, int $mode = null, string $description = '', $default = null) + public function __construct(string $name, ?int $mode = null, string $description = '', $default = null) { if (null === $mode) { $mode = self::OPTIONAL; diff --git a/symfony/console/Input/InputOption.php b/symfony/console/Input/InputOption.php index 2bec34fe1..1d8dbca31 100644 --- a/symfony/console/Input/InputOption.php +++ b/symfony/console/Input/InputOption.php @@ -59,7 +59,7 @@ class InputOption * * @throws InvalidArgumentException If option mode is invalid or incompatible */ - public function __construct(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null) + public function __construct(string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null) { if (str_starts_with($name, '--')) { $name = substr($name, 2); @@ -69,7 +69,7 @@ public function __construct(string $name, $shortcut = null, int $mode = null, st throw new InvalidArgumentException('An option name cannot be empty.'); } - if (empty($shortcut)) { + if ('' === $shortcut || [] === $shortcut) { $shortcut = null; } @@ -78,10 +78,10 @@ public function __construct(string $name, $shortcut = null, int $mode = null, st $shortcut = implode('|', $shortcut); } $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-')); - $shortcuts = array_filter($shortcuts); + $shortcuts = array_filter($shortcuts, 'strlen'); $shortcut = implode('|', $shortcuts); - if (empty($shortcut)) { + if ('' === $shortcut) { throw new InvalidArgumentException('An option shortcut cannot be empty.'); } } diff --git a/symfony/console/Output/ConsoleOutput.php b/symfony/console/Output/ConsoleOutput.php index f19f9ebf4..560aeb581 100644 --- a/symfony/console/Output/ConsoleOutput.php +++ b/symfony/console/Output/ConsoleOutput.php @@ -37,7 +37,7 @@ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface * @param bool|null $decorated Whether to decorate messages (null for auto-guessing) * @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter) */ - public function __construct(int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null) + public function __construct(int $verbosity = self::VERBOSITY_NORMAL, ?bool $decorated = null, ?OutputFormatterInterface $formatter = null) { parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter); diff --git a/symfony/console/Output/ConsoleSectionOutput.php b/symfony/console/Output/ConsoleSectionOutput.php index 8f1649758..70d70c50b 100644 --- a/symfony/console/Output/ConsoleSectionOutput.php +++ b/symfony/console/Output/ConsoleSectionOutput.php @@ -43,7 +43,7 @@ public function __construct($stream, array &$sections, int $verbosity, bool $dec * * @param int $lines Number of lines to clear. If null, then the entire output of this section is cleared */ - public function clear(int $lines = null) + public function clear(?int $lines = null) { if (empty($this->content) || !$this->isDecorated()) { return; diff --git a/symfony/console/Output/Output.php b/symfony/console/Output/Output.php index d7c5fb2d1..28c40bb3e 100644 --- a/symfony/console/Output/Output.php +++ b/symfony/console/Output/Output.php @@ -37,7 +37,7 @@ abstract class Output implements OutputInterface * @param bool $decorated Whether to decorate messages * @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter) */ - public function __construct(?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null) + public function __construct(?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, ?OutputFormatterInterface $formatter = null) { $this->verbosity = $verbosity ?? self::VERBOSITY_NORMAL; $this->formatter = $formatter ?? new OutputFormatter(); diff --git a/symfony/console/Output/StreamOutput.php b/symfony/console/Output/StreamOutput.php index 7f5551827..0ef15cf31 100644 --- a/symfony/console/Output/StreamOutput.php +++ b/symfony/console/Output/StreamOutput.php @@ -39,7 +39,7 @@ class StreamOutput extends Output * * @throws InvalidArgumentException When first argument is not a real stream */ - public function __construct($stream, int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null) + public function __construct($stream, int $verbosity = self::VERBOSITY_NORMAL, ?bool $decorated = null, ?OutputFormatterInterface $formatter = null) { if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) { throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.'); @@ -64,9 +64,6 @@ public function getStream() return $this->stream; } - /** - * {@inheritdoc} - */ protected function doWrite(string $message, bool $newline) { if ($newline) { @@ -98,18 +95,50 @@ protected function hasColorSupport() return false; } - if ('Hyper' === getenv('TERM_PROGRAM')) { + if (!$this->isTty()) { + return false; + } + + if (\DIRECTORY_SEPARATOR === '\\' + && \function_exists('sapi_windows_vt100_support') + && @sapi_windows_vt100_support($this->stream) + ) { + return true; + } + + return 'Hyper' === getenv('TERM_PROGRAM') + || false !== getenv('ANSICON') + || 'ON' === getenv('ConEmuANSI') + || str_starts_with((string) getenv('TERM'), 'xterm'); + } + + /** + * Checks if the stream is a TTY, i.e; whether the output stream is connected to a terminal. + * + * Reference: Composer\Util\Platform::isTty + * https://github.com/composer/composer + */ + private function isTty(): bool + { + // Detect msysgit/mingw and assume this is a tty because detection + // does not work correctly, see https://github.com/composer/composer/issues/9690 + if (\in_array(strtoupper((string) getenv('MSYSTEM')), ['MINGW32', 'MINGW64'], true)) { return true; } - if (\DIRECTORY_SEPARATOR === '\\') { - return (\function_exists('sapi_windows_vt100_support') - && @sapi_windows_vt100_support($this->stream)) - || false !== getenv('ANSICON') - || 'ON' === getenv('ConEmuANSI') - || 'xterm' === getenv('TERM'); + // Modern cross-platform function, includes the fstat fallback so if it is present we trust it + if (\function_exists('stream_isatty')) { + return stream_isatty($this->stream); } - return stream_isatty($this->stream); + // Only trusting this if it is positive, otherwise prefer fstat fallback. + if (\function_exists('posix_isatty') && posix_isatty($this->stream)) { + return true; + } + + $stat = @fstat($this->stream); + + // Check if formatted mode is S_IFCHR + return $stat ? 0020000 === ($stat['mode'] & 0170000) : false; } } diff --git a/symfony/console/Output/TrimmedBufferOutput.php b/symfony/console/Output/TrimmedBufferOutput.php index 3f4d375f4..b08503b3a 100644 --- a/symfony/console/Output/TrimmedBufferOutput.php +++ b/symfony/console/Output/TrimmedBufferOutput.php @@ -24,7 +24,7 @@ class TrimmedBufferOutput extends Output private $maxLength; private $buffer = ''; - public function __construct(int $maxLength, ?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null) + public function __construct(int $maxLength, ?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, ?OutputFormatterInterface $formatter = null) { if ($maxLength <= 0) { throw new InvalidArgumentException(sprintf('"%s()" expects a strictly positive maxLength. Got %d.', __METHOD__, $maxLength)); diff --git a/symfony/console/Question/Question.php b/symfony/console/Question/Question.php index 3a73f04b2..ba5744283 100644 --- a/symfony/console/Question/Question.php +++ b/symfony/console/Question/Question.php @@ -186,7 +186,7 @@ public function getAutocompleterCallback(): ?callable * * @return $this */ - public function setAutocompleterCallback(callable $callback = null): self + public function setAutocompleterCallback(?callable $callback = null): self { if ($this->hidden && null !== $callback) { throw new LogicException('A hidden question cannot use the autocompleter.'); @@ -202,7 +202,7 @@ public function setAutocompleterCallback(callable $callback = null): self * * @return $this */ - public function setValidator(callable $validator = null) + public function setValidator(?callable $validator = null) { $this->validator = $validator; diff --git a/symfony/console/SingleCommandApplication.php b/symfony/console/SingleCommandApplication.php index e93c1821b..774e5d8c4 100644 --- a/symfony/console/SingleCommandApplication.php +++ b/symfony/console/SingleCommandApplication.php @@ -46,7 +46,7 @@ public function setAutoExit(bool $autoExit): self return $this; } - public function run(InputInterface $input = null, OutputInterface $output = null): int + public function run(?InputInterface $input = null, ?OutputInterface $output = null): int { if ($this->running) { return parent::run($input, $output); diff --git a/symfony/console/Style/StyleInterface.php b/symfony/console/Style/StyleInterface.php index 38d23b77e..9f25a43f6 100644 --- a/symfony/console/Style/StyleInterface.php +++ b/symfony/console/Style/StyleInterface.php @@ -85,14 +85,14 @@ public function table(array $headers, array $rows); * * @return mixed */ - public function ask(string $question, string $default = null, callable $validator = null); + public function ask(string $question, ?string $default = null, ?callable $validator = null); /** * Asks a question with the user input hidden. * * @return mixed */ - public function askHidden(string $question, callable $validator = null); + public function askHidden(string $question, ?callable $validator = null); /** * Asks for confirmation. diff --git a/symfony/console/Style/SymfonyStyle.php b/symfony/console/Style/SymfonyStyle.php index e3c5ac8e7..00edf3882 100644 --- a/symfony/console/Style/SymfonyStyle.php +++ b/symfony/console/Style/SymfonyStyle.php @@ -61,7 +61,7 @@ public function __construct(InputInterface $input, OutputInterface $output) * * @param string|array $messages The message to write in the block */ - public function block($messages, string $type = null, string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = true) + public function block($messages, ?string $type = null, ?string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = true) { $messages = \is_array($messages) ? array_values($messages) : [$messages]; @@ -250,7 +250,7 @@ public function definitionList(...$list) /** * {@inheritdoc} */ - public function ask(string $question, string $default = null, callable $validator = null) + public function ask(string $question, ?string $default = null, ?callable $validator = null) { $question = new Question($question, $default); $question->setValidator($validator); @@ -261,7 +261,7 @@ public function ask(string $question, string $default = null, callable $validato /** * {@inheritdoc} */ - public function askHidden(string $question, callable $validator = null) + public function askHidden(string $question, ?callable $validator = null) { $question = new Question($question); @@ -338,7 +338,7 @@ public function createProgressBar(int $max = 0) /** * @see ProgressBar::iterate() */ - public function progressIterate(iterable $iterable, int $max = null): iterable + public function progressIterate(iterable $iterable, ?int $max = null): iterable { yield from $this->createProgressBar()->iterate($iterable, $max); @@ -463,7 +463,7 @@ private function writeBuffer(string $message, bool $newLine, int $type): void $this->bufferedOutput->write($message, $newLine, $type); } - private function createBlock(iterable $messages, string $type = null, string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = false): array + private function createBlock(iterable $messages, ?string $type = null, ?string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = false): array { $indentLength = 0; $prefixLength = Helper::width(Helper::removeDecoration($this->getFormatter(), $prefix)); diff --git a/symfony/polyfill-ctype/Ctype.php b/symfony/polyfill-ctype/Ctype.php index 58414dc73..ba75a2c95 100644 --- a/symfony/polyfill-ctype/Ctype.php +++ b/symfony/polyfill-ctype/Ctype.php @@ -25,13 +25,13 @@ final class Ctype * * @see https://php.net/ctype-alnum * - * @param string|int $text + * @param mixed $text * * @return bool */ public static function ctype_alnum($text) { - $text = self::convert_int_to_char_for_ctype($text); + $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text); } @@ -41,13 +41,13 @@ public static function ctype_alnum($text) * * @see https://php.net/ctype-alpha * - * @param string|int $text + * @param mixed $text * * @return bool */ public static function ctype_alpha($text) { - $text = self::convert_int_to_char_for_ctype($text); + $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text); } @@ -57,13 +57,13 @@ public static function ctype_alpha($text) * * @see https://php.net/ctype-cntrl * - * @param string|int $text + * @param mixed $text * * @return bool */ public static function ctype_cntrl($text) { - $text = self::convert_int_to_char_for_ctype($text); + $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text); } @@ -73,13 +73,13 @@ public static function ctype_cntrl($text) * * @see https://php.net/ctype-digit * - * @param string|int $text + * @param mixed $text * * @return bool */ public static function ctype_digit($text) { - $text = self::convert_int_to_char_for_ctype($text); + $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text); } @@ -89,13 +89,13 @@ public static function ctype_digit($text) * * @see https://php.net/ctype-graph * - * @param string|int $text + * @param mixed $text * * @return bool */ public static function ctype_graph($text) { - $text = self::convert_int_to_char_for_ctype($text); + $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text); } @@ -105,13 +105,13 @@ public static function ctype_graph($text) * * @see https://php.net/ctype-lower * - * @param string|int $text + * @param mixed $text * * @return bool */ public static function ctype_lower($text) { - $text = self::convert_int_to_char_for_ctype($text); + $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text); } @@ -121,13 +121,13 @@ public static function ctype_lower($text) * * @see https://php.net/ctype-print * - * @param string|int $text + * @param mixed $text * * @return bool */ public static function ctype_print($text) { - $text = self::convert_int_to_char_for_ctype($text); + $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text); } @@ -137,13 +137,13 @@ public static function ctype_print($text) * * @see https://php.net/ctype-punct * - * @param string|int $text + * @param mixed $text * * @return bool */ public static function ctype_punct($text) { - $text = self::convert_int_to_char_for_ctype($text); + $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text); } @@ -153,13 +153,13 @@ public static function ctype_punct($text) * * @see https://php.net/ctype-space * - * @param string|int $text + * @param mixed $text * * @return bool */ public static function ctype_space($text) { - $text = self::convert_int_to_char_for_ctype($text); + $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text); } @@ -169,13 +169,13 @@ public static function ctype_space($text) * * @see https://php.net/ctype-upper * - * @param string|int $text + * @param mixed $text * * @return bool */ public static function ctype_upper($text) { - $text = self::convert_int_to_char_for_ctype($text); + $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text); } @@ -185,13 +185,13 @@ public static function ctype_upper($text) * * @see https://php.net/ctype-xdigit * - * @param string|int $text + * @param mixed $text * * @return bool */ public static function ctype_xdigit($text) { - $text = self::convert_int_to_char_for_ctype($text); + $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text); } @@ -204,11 +204,12 @@ public static function ctype_xdigit($text) * (negative values have 256 added in order to allow characters in the Extended ASCII range). * Any other integer is interpreted as a string containing the decimal digits of the integer. * - * @param string|int $int + * @param mixed $int + * @param string $function * * @return mixed */ - private static function convert_int_to_char_for_ctype($int) + private static function convert_int_to_char_for_ctype($int, $function) { if (!\is_int($int)) { return $int; @@ -218,6 +219,10 @@ private static function convert_int_to_char_for_ctype($int) return (string) $int; } + if (\PHP_VERSION_ID >= 80100) { + @trigger_error($function.'(): Argument of type int will be interpreted as string in the future', \E_USER_DEPRECATED); + } + if ($int < 0) { $int += 256; } diff --git a/symfony/polyfill-ctype/LICENSE b/symfony/polyfill-ctype/LICENSE index 3f853aaf3..7536caeae 100644 --- a/symfony/polyfill-ctype/LICENSE +++ b/symfony/polyfill-ctype/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2018-2019 Fabien Potencier +Copyright (c) 2018-present Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/symfony/polyfill-php73/LICENSE b/symfony/polyfill-php73/LICENSE index 3f853aaf3..7536caeae 100644 --- a/symfony/polyfill-php73/LICENSE +++ b/symfony/polyfill-php73/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2018-2019 Fabien Potencier +Copyright (c) 2018-present Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/symfony/polyfill-php73/Resources/stubs/JsonException.php b/symfony/polyfill-php73/Resources/stubs/JsonException.php index 673d10022..f06d6c269 100644 --- a/symfony/polyfill-php73/Resources/stubs/JsonException.php +++ b/symfony/polyfill-php73/Resources/stubs/JsonException.php @@ -9,6 +9,8 @@ * file that was distributed with this source code. */ -class JsonException extends Exception -{ +if (\PHP_VERSION_ID < 70300) { + class JsonException extends Exception + { + } }