diff --git a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
index 5204de4980c48..3ba4fa7165926 100644
--- a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
+++ b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
@@ -30,6 +30,7 @@ CHANGELOG
* Change BrowserKitAssertionsTrait::getClient() to be protected
* Deprecate the `framework.asset_mapper.provider` config option
* Add `--exclude` option to the `cache:pool:clear` command
+ * Add parameters deprecations to the output of `debug:container` command
6.3
---
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php
index cd1af0d5d43c0..df6aef5dd6b3e 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php
@@ -129,10 +129,16 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$options['filter'] = $this->filterToServiceTypes(...);
} elseif ($input->getOption('parameters')) {
$parameters = [];
- foreach ($object->getParameterBag()->all() as $k => $v) {
+ $parameterBag = $object->getParameterBag();
+ foreach ($parameterBag->all() as $k => $v) {
$parameters[$k] = $object->resolveEnvPlaceholders($v);
}
$object = new ParameterBag($parameters);
+ if ($parameterBag instanceof ParameterBag) {
+ foreach ($parameterBag->allDeprecated() as $k => $deprecation) {
+ $object->deprecate($k, ...$deprecation);
+ }
+ }
$options = [];
} elseif ($parameter = $input->getOption('parameter')) {
$options = ['parameter' => $parameter];
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php
index 54a66a1b93e12..ba500adb2bbca 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php
@@ -43,6 +43,11 @@ public function describe(OutputInterface $output, mixed $object, array $options
(new AnalyzeServiceReferencesPass(false, false))->process($object);
}
+ $deprecatedParameters = [];
+ if ($object instanceof ContainerBuilder && isset($options['parameter']) && ($parameterBag = $object->getParameterBag()) instanceof ParameterBag) {
+ $deprecatedParameters = $parameterBag->allDeprecated();
+ }
+
match (true) {
$object instanceof RouteCollection => $this->describeRouteCollection($object, $options),
$object instanceof Route => $this->describeRoute($object, $options),
@@ -50,7 +55,7 @@ public function describe(OutputInterface $output, mixed $object, array $options
$object instanceof ContainerBuilder && !empty($options['env-vars']) => $this->describeContainerEnvVars($this->getContainerEnvVars($object), $options),
$object instanceof ContainerBuilder && isset($options['group_by']) && 'tags' === $options['group_by'] => $this->describeContainerTags($object, $options),
$object instanceof ContainerBuilder && isset($options['id']) => $this->describeContainerService($this->resolveServiceDefinition($object, $options['id']), $options, $object),
- $object instanceof ContainerBuilder && isset($options['parameter']) => $this->describeContainerParameter($object->resolveEnvPlaceholders($object->getParameter($options['parameter'])), $options),
+ $object instanceof ContainerBuilder && isset($options['parameter']) => $this->describeContainerParameter($object->resolveEnvPlaceholders($object->getParameter($options['parameter'])), $deprecatedParameters[$options['parameter']] ?? null, $options),
$object instanceof ContainerBuilder && isset($options['deprecations']) => $this->describeContainerDeprecations($object, $options),
$object instanceof ContainerBuilder => $this->describeContainerServices($object, $options),
$object instanceof Definition => $this->describeContainerDefinition($object, $options),
@@ -107,7 +112,7 @@ abstract protected function describeContainerDefinition(Definition $definition,
abstract protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $container = null): void;
- abstract protected function describeContainerParameter(mixed $parameter, array $options = []): void;
+ abstract protected function describeContainerParameter(mixed $parameter, ?array $deprecation, array $options = []): void;
abstract protected function describeContainerEnvVars(array $envs, array $options = []): void;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
index 8b109de5219e5..1dc567a3fd345 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
@@ -150,11 +150,16 @@ protected function describeCallable(mixed $callable, array $options = []): void
$this->writeData($this->getCallableData($callable), $options);
}
- protected function describeContainerParameter(mixed $parameter, array $options = []): void
+ protected function describeContainerParameter(mixed $parameter, ?array $deprecation, array $options = []): void
{
$key = $options['parameter'] ?? '';
+ $data = [$key => $parameter];
- $this->writeData([$key => $parameter], $options);
+ if ($deprecation) {
+ $data['_deprecation'] = sprintf('Since %s %s: %s', $deprecation[0], $deprecation[1], sprintf(...\array_slice($deprecation, 2)));
+ }
+
+ $this->writeData($data, $options);
}
protected function describeContainerEnvVars(array $envs, array $options = []): void
@@ -223,6 +228,23 @@ protected function getRouteData(Route $route): array
return $data;
}
+ protected function sortParameters(ParameterBag $parameters): array
+ {
+ $sortedParameters = parent::sortParameters($parameters);
+
+ if ($deprecated = $parameters->allDeprecated()) {
+ $deprecations = [];
+
+ foreach ($deprecated as $parameter => $deprecation) {
+ $deprecations[$parameter] = sprintf('Since %s %s: %s', $deprecation[0], $deprecation[1], sprintf(...\array_slice($deprecation, 2)));
+ }
+
+ $sortedParameters['_deprecations'] = $deprecations;
+ }
+
+ return $sortedParameters;
+ }
+
private function getContainerDefinitionData(Definition $definition, bool $omitTags = false, bool $showArguments = false, ContainerBuilder $container = null, string $id = null): array
{
$data = [
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php
index 2a5f62cfdcb54..275294d7e2ac6 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php
@@ -71,9 +71,16 @@ protected function describeRoute(Route $route, array $options = []): void
protected function describeContainerParameters(ParameterBag $parameters, array $options = []): void
{
+ $deprecatedParameters = $parameters->allDeprecated();
+
$this->write("Container parameters\n====================\n");
foreach ($this->sortParameters($parameters) as $key => $value) {
- $this->write(sprintf("\n- `%s`: `%s`", $key, $this->formatParameter($value)));
+ $this->write(sprintf(
+ "\n- `%s`: `%s`%s",
+ $key,
+ $this->formatParameter($value),
+ isset($deprecatedParameters[$key]) ? sprintf(' *Since %s %s: %s*', $deprecatedParameters[$key][0], $deprecatedParameters[$key][1], sprintf(...\array_slice($deprecatedParameters[$key], 2))) : ''
+ ));
}
}
@@ -290,9 +297,13 @@ protected function describeContainerAlias(Alias $alias, array $options = [], Con
$this->describeContainerDefinition($container->getDefinition((string) $alias), array_merge($options, ['id' => (string) $alias]), $container);
}
- protected function describeContainerParameter(mixed $parameter, array $options = []): void
+ protected function describeContainerParameter(mixed $parameter, ?array $deprecation, array $options = []): void
{
- $this->write(isset($options['parameter']) ? sprintf("%s\n%s\n\n%s", $options['parameter'], str_repeat('=', \strlen($options['parameter'])), $this->formatParameter($parameter)) : $parameter);
+ if (isset($options['parameter'])) {
+ $this->write(sprintf("%s\n%s\n\n%s%s", $options['parameter'], str_repeat('=', \strlen($options['parameter'])), $this->formatParameter($parameter), $deprecation ? sprintf("\n\n*Since %s %s: %s*", $deprecation[0], $deprecation[1], sprintf(...\array_slice($deprecation, 2))) : ''));
+ } else {
+ $this->write($parameter);
+ }
}
protected function describeContainerEnvVars(array $envs, array $options = []): void
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
index c1b82ac826366..8a4f812deeb04 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
@@ -14,6 +14,7 @@
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Helper\Dumper;
use Symfony\Component\Console\Helper\Table;
+use Symfony\Component\Console\Helper\TableCell;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\Argument\AbstractArgument;
@@ -124,9 +125,18 @@ protected function describeContainerParameters(ParameterBag $parameters, array $
{
$tableHeaders = ['Parameter', 'Value'];
+ $deprecatedParameters = $parameters->allDeprecated();
+
$tableRows = [];
foreach ($this->sortParameters($parameters) as $parameter => $value) {
$tableRows[] = [$parameter, $this->formatParameter($value)];
+
+ if (isset($deprecatedParameters[$parameter])) {
+ $tableRows[] = [new TableCell(
+ sprintf('
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: