%command.name% command counts the messages for all the transports:
@@ -51,8 +52,7 @@ protected function configure(): void
php %command.full_name%
-The --format option specifies the format of command output,
-these are "{$outputFormats}".
+The --format option specifies the format of the command output:
php %command.full_name% --format=json
EOF
@@ -65,6 +65,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$io = new SymfonyStyle($input, $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output);
$format = $input->getOption('format');
+ if ('text' === $format) {
+ trigger_deprecation('symfony/messenger', '7.2', 'The "text" format is deprecated, use "txt" instead.');
+
+ $format = 'txt';
+ }
if (!\in_array($format, $this->getAvailableFormatOptions(), true)) {
throw new InvalidArgumentException('Invalid output format.');
}
@@ -94,7 +99,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}
match ($format) {
- 'text' => $this->outputText($io, $outputTable, $uncountableTransports),
+ 'txt' => $this->outputText($io, $outputTable, $uncountableTransports),
'json' => $this->outputJson($io, $outputTable, $uncountableTransports),
};
@@ -127,14 +132,21 @@ private function outputJson(SymfonyStyle $io, array $outputTable, array $uncount
private function formatSupportsWarnings(string $format): bool
{
return match ($format) {
- 'text' => true,
+ 'txt' => true,
'json' => false,
};
}
+ public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
+ {
+ if ($input->mustSuggestOptionValuesFor('format')) {
+ $suggestions->suggestValues($this->getAvailableFormatOptions());
+ }
+ }
+
/** @return string[] */
private function getAvailableFormatOptions(): array
{
- return ['text', 'json'];
+ return ['txt', 'json'];
}
}
diff --git a/src/Symfony/Component/Messenger/composer.json b/src/Symfony/Component/Messenger/composer.json
index c51fdbfb58161..3fdfe4a55ee26 100644
--- a/src/Symfony/Component/Messenger/composer.json
+++ b/src/Symfony/Component/Messenger/composer.json
@@ -18,7 +18,8 @@
"require": {
"php": ">=8.2",
"psr/log": "^1|^2|^3",
- "symfony/clock": "^6.4|^7.0"
+ "symfony/clock": "^6.4|^7.0",
+ "symfony/deprecation-contracts": "^2.5|^3"
},
"require-dev": {
"psr/cache": "^1.0|^2.0|^3.0",
diff --git a/src/Symfony/Component/Translation/Command/XliffLintCommand.php b/src/Symfony/Component/Translation/Command/XliffLintCommand.php
index 26bda4c608d2b..82a9571ce8c21 100644
--- a/src/Symfony/Component/Translation/Command/XliffLintCommand.php
+++ b/src/Symfony/Component/Translation/Command/XliffLintCommand.php
@@ -72,6 +72,9 @@ protected function configure(): void
Or of a whole directory:
php %command.full_name% dirname
+
+The --format option specifies the format of the command output:
+
php %command.full_name% dirname --format=json
EOF
@@ -277,6 +280,7 @@ public function complete(CompletionInput $input, CompletionSuggestions $suggesti
}
}
+ /** @return string[] */
private function getAvailableFormatOptions(): array
{
return ['txt', 'json', 'github'];
diff --git a/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php b/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php
index 948a367f610fe..19374f69eb88f 100644
--- a/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php
+++ b/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php
@@ -136,8 +136,10 @@ public function testGetHelp()
Or of a whole directory:
php %command.full_name% dirname
- php %command.full_name% dirname --format=json
+The --format option specifies the format of the command output:
+
+ php %command.full_name% dirname --format=json
EOF;
$this->assertStringContainsString($expected, $command->getHelp());
diff --git a/src/Symfony/Component/Uid/Command/GenerateUlidCommand.php b/src/Symfony/Component/Uid/Command/GenerateUlidCommand.php
index c7cac11c572ad..da46bc5c1d05e 100644
--- a/src/Symfony/Component/Uid/Command/GenerateUlidCommand.php
+++ b/src/Symfony/Component/Uid/Command/GenerateUlidCommand.php
@@ -105,6 +105,7 @@ public function complete(CompletionInput $input, CompletionSuggestions $suggesti
}
}
+ /** @return string[] */
private function getAvailableFormatOptions(): array
{
return [
diff --git a/src/Symfony/Component/Uid/Command/GenerateUuidCommand.php b/src/Symfony/Component/Uid/Command/GenerateUuidCommand.php
index 14df7f5206aa4..2117eb753e30c 100644
--- a/src/Symfony/Component/Uid/Command/GenerateUuidCommand.php
+++ b/src/Symfony/Component/Uid/Command/GenerateUuidCommand.php
@@ -194,6 +194,7 @@ public function complete(CompletionInput $input, CompletionSuggestions $suggesti
}
}
+ /** @return string[] */
private function getAvailableFormatOptions(): array
{
return [
diff --git a/src/Symfony/Component/Yaml/Command/LintCommand.php b/src/Symfony/Component/Yaml/Command/LintCommand.php
index 0a8dbc1c4ad65..0fab77c569b67 100644
--- a/src/Symfony/Component/Yaml/Command/LintCommand.php
+++ b/src/Symfony/Component/Yaml/Command/LintCommand.php
@@ -72,6 +72,9 @@ protected function configure(): void
Or of a whole directory:
php %command.full_name% dirname
+
+The --format option specifies the format of the command output:
+
php %command.full_name% dirname --format=json
You can also exclude one or more specific files:
@@ -266,6 +269,7 @@ public function complete(CompletionInput $input, CompletionSuggestions $suggesti
}
}
+ /** @return string[] */
private function getAvailableFormatOptions(): array
{
return ['txt', 'json', 'github'];
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy