Skip to content

Commit 5823a77

Browse files
Merge branch '6.4' into 7.0
* 6.4: (47 commits) Sync .github/expected-missing-return-types.diff [FrameworkBundle] Add void return-type to ErrorLoggerCompilerPass [DoctrineBridge] Fix cross-versions compat [HttpKernel] Handle nullable callback of StreamedResponse [Mailer] Capitalize sender header for Mailgun [FrameworkBundle] Configure `logger` as error logger if the Monolog Bundle is not registered DX: PHP CS Fixer - drop explicit nullable_type_declaration_for_default_null_value config, as it's part of ruleset anyway DX: PHP CS Fixer - drop explicit no_superfluous_phpdoc_tags config, as it's part of ruleset already [DI] Simplify using DI attributes with `ServiceLocator/Iterator`'s [FrameworkBundle] Fix registering workflow.registry Revert "Add keyword `dev` to leverage composer hint" [Validator] Add missing Ukrainian translations #51960 [Validator] Add missing translations for Indonesian (id) [Validator] Add missing translations for Vietnamese (VI) Add missing Validator translations - Croatian (hr) [HttpFoundation]  Improve PHPDoc of Cache attribute [Validator] Add missing Spanish (es) translations #51956 [Serializer] Add `XmlEncoder::CDATA_WRAPPING` context option [Finder] Add early directory prunning filter support Add missing dutch translations ...
2 parents 657f5a9 + b7abd18 commit 5823a77

29 files changed

+248
-32
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ CHANGELOG
5353
* Add support for relative URLs in BrowserKit's redirect assertion
5454
* Change BrowserKitAssertionsTrait::getClient() to be protected
5555
* Deprecate the `framework.asset_mapper.provider` config option
56+
* Add `--exclude` option to the `cache:pool:clear` command
57+
* Add parameters deprecations to the output of `debug:container` command
5658

5759
6.3
5860
---

Command/CachePoolClearCommand.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ protected function configure(): void
5353
new InputArgument('pools', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'A list of cache pools or cache pool clearers'),
5454
])
5555
->addOption('all', null, InputOption::VALUE_NONE, 'Clear all cache pools')
56+
->addOption('exclude', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'A list of cache pools or cache pool clearers to exclude')
5657
->setHelp(<<<'EOF'
5758
The <info>%command.name%</info> command clears the given cache pools or cache pool clearers.
5859
@@ -70,17 +71,23 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7071
$clearers = [];
7172

7273
$poolNames = $input->getArgument('pools');
74+
$excludedPoolNames = $input->getOption('exclude');
7375
if ($input->getOption('all')) {
7476
if (!$this->poolNames) {
7577
throw new InvalidArgumentException('Could not clear all cache pools, try specifying a specific pool or cache clearer.');
7678
}
7779

78-
$io->comment('Clearing all cache pools...');
80+
if (!$excludedPoolNames) {
81+
$io->comment('Clearing all cache pools...');
82+
}
83+
7984
$poolNames = $this->poolNames;
8085
} elseif (!$poolNames) {
8186
throw new InvalidArgumentException('Either specify at least one pool name, or provide the --all option to clear all pools.');
8287
}
8388

89+
$poolNames = array_diff($poolNames, $excludedPoolNames);
90+
8491
foreach ($poolNames as $id) {
8592
if ($this->poolClearer->hasPool($id)) {
8693
$pools[$id] = $id;

Command/CacheWarmupCommand.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Symfony\Component\Console\Style\SymfonyStyle;
2020
use Symfony\Component\DependencyInjection\Dumper\Preloader;
2121
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate;
22+
use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface;
2223

2324
/**
2425
* Warmup the cache.
@@ -65,8 +66,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6566
if (!$input->getOption('no-optional-warmers')) {
6667
$this->cacheWarmer->enableOptionalWarmers();
6768
}
69+
$cacheDir = $kernel->getContainer()->getParameter('kernel.cache_dir');
6870

69-
$preload = $this->cacheWarmer->warmUp($cacheDir = $kernel->getContainer()->getParameter('kernel.cache_dir'));
71+
if ($kernel instanceof WarmableInterface) {
72+
$kernel->warmUp($cacheDir);
73+
}
74+
75+
$preload = $this->cacheWarmer->warmUp($cacheDir);
7076

7177
if ($preload && file_exists($preloadFile = $cacheDir.'/'.$kernel->getContainer()->getParameter('kernel.container_class').'.preload.php')) {
7278
Preloader::append($preloadFile, $preload);

Command/ContainerDebugCommand.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,16 @@ protected function execute(InputInterface $input, OutputInterface $output): int
129129
$options['filter'] = $this->filterToServiceTypes(...);
130130
} elseif ($input->getOption('parameters')) {
131131
$parameters = [];
132-
foreach ($object->getParameterBag()->all() as $k => $v) {
132+
$parameterBag = $object->getParameterBag();
133+
foreach ($parameterBag->all() as $k => $v) {
133134
$parameters[$k] = $object->resolveEnvPlaceholders($v);
134135
}
135136
$object = new ParameterBag($parameters);
137+
if ($parameterBag instanceof ParameterBag) {
138+
foreach ($parameterBag->allDeprecated() as $k => $deprecation) {
139+
$object->deprecate($k, ...$deprecation);
140+
}
141+
}
136142
$options = [];
137143
} elseif ($parameter = $input->getOption('parameter')) {
138144
$options = ['parameter' => $parameter];

Command/TranslationUpdateCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
*
4040
* @final
4141
*/
42-
#[AsCommand(name: 'translation:extract', description: 'Extract missing translations keys from code to translation files.')]
42+
#[AsCommand(name: 'translation:extract', description: 'Extract missing translations keys from code to translation files')]
4343
class TranslationUpdateCommand extends Command
4444
{
4545
private const ASC = 'asc';

Command/XliffLintCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
* @final
2525
*/
26-
#[AsCommand(name: 'lint:xliff', description: 'Lints an XLIFF file and outputs encountered errors')]
26+
#[AsCommand(name: 'lint:xliff', description: 'Lint an XLIFF file and outputs encountered errors')]
2727
class XliffLintCommand extends BaseLintCommand
2828
{
2929
public function __construct()

Console/Descriptor/Descriptor.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,19 @@ public function describe(OutputInterface $output, mixed $object, array $options
4343
(new AnalyzeServiceReferencesPass(false, false))->process($object);
4444
}
4545

46+
$deprecatedParameters = [];
47+
if ($object instanceof ContainerBuilder && isset($options['parameter']) && ($parameterBag = $object->getParameterBag()) instanceof ParameterBag) {
48+
$deprecatedParameters = $parameterBag->allDeprecated();
49+
}
50+
4651
match (true) {
4752
$object instanceof RouteCollection => $this->describeRouteCollection($object, $options),
4853
$object instanceof Route => $this->describeRoute($object, $options),
4954
$object instanceof ParameterBag => $this->describeContainerParameters($object, $options),
5055
$object instanceof ContainerBuilder && !empty($options['env-vars']) => $this->describeContainerEnvVars($this->getContainerEnvVars($object), $options),
5156
$object instanceof ContainerBuilder && isset($options['group_by']) && 'tags' === $options['group_by'] => $this->describeContainerTags($object, $options),
5257
$object instanceof ContainerBuilder && isset($options['id']) => $this->describeContainerService($this->resolveServiceDefinition($object, $options['id']), $options, $object),
53-
$object instanceof ContainerBuilder && isset($options['parameter']) => $this->describeContainerParameter($object->resolveEnvPlaceholders($object->getParameter($options['parameter'])), $options),
58+
$object instanceof ContainerBuilder && isset($options['parameter']) => $this->describeContainerParameter($object->resolveEnvPlaceholders($object->getParameter($options['parameter'])), $deprecatedParameters[$options['parameter']] ?? null, $options),
5459
$object instanceof ContainerBuilder && isset($options['deprecations']) => $this->describeContainerDeprecations($object, $options),
5560
$object instanceof ContainerBuilder => $this->describeContainerServices($object, $options),
5661
$object instanceof Definition => $this->describeContainerDefinition($object, $options),
@@ -107,7 +112,7 @@ abstract protected function describeContainerDefinition(Definition $definition,
107112

108113
abstract protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $container = null): void;
109114

110-
abstract protected function describeContainerParameter(mixed $parameter, array $options = []): void;
115+
abstract protected function describeContainerParameter(mixed $parameter, ?array $deprecation, array $options = []): void;
111116

112117
abstract protected function describeContainerEnvVars(array $envs, array $options = []): void;
113118

Console/Descriptor/JsonDescriptor.php

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,16 @@ protected function describeCallable(mixed $callable, array $options = []): void
150150
$this->writeData($this->getCallableData($callable), $options);
151151
}
152152

153-
protected function describeContainerParameter(mixed $parameter, array $options = []): void
153+
protected function describeContainerParameter(mixed $parameter, ?array $deprecation, array $options = []): void
154154
{
155155
$key = $options['parameter'] ?? '';
156+
$data = [$key => $parameter];
156157

157-
$this->writeData([$key => $parameter], $options);
158+
if ($deprecation) {
159+
$data['_deprecation'] = sprintf('Since %s %s: %s', $deprecation[0], $deprecation[1], sprintf(...\array_slice($deprecation, 2)));
160+
}
161+
162+
$this->writeData($data, $options);
158163
}
159164

160165
protected function describeContainerEnvVars(array $envs, array $options = []): void
@@ -223,6 +228,23 @@ protected function getRouteData(Route $route): array
223228
return $data;
224229
}
225230

231+
protected function sortParameters(ParameterBag $parameters): array
232+
{
233+
$sortedParameters = parent::sortParameters($parameters);
234+
235+
if ($deprecated = $parameters->allDeprecated()) {
236+
$deprecations = [];
237+
238+
foreach ($deprecated as $parameter => $deprecation) {
239+
$deprecations[$parameter] = sprintf('Since %s %s: %s', $deprecation[0], $deprecation[1], sprintf(...\array_slice($deprecation, 2)));
240+
}
241+
242+
$sortedParameters['_deprecations'] = $deprecations;
243+
}
244+
245+
return $sortedParameters;
246+
}
247+
226248
private function getContainerDefinitionData(Definition $definition, bool $omitTags = false, bool $showArguments = false, ContainerBuilder $container = null, string $id = null): array
227249
{
228250
$data = [

Console/Descriptor/MarkdownDescriptor.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,16 @@ protected function describeRoute(Route $route, array $options = []): void
7171

7272
protected function describeContainerParameters(ParameterBag $parameters, array $options = []): void
7373
{
74+
$deprecatedParameters = $parameters->allDeprecated();
75+
7476
$this->write("Container parameters\n====================\n");
7577
foreach ($this->sortParameters($parameters) as $key => $value) {
76-
$this->write(sprintf("\n- `%s`: `%s`", $key, $this->formatParameter($value)));
78+
$this->write(sprintf(
79+
"\n- `%s`: `%s`%s",
80+
$key,
81+
$this->formatParameter($value),
82+
isset($deprecatedParameters[$key]) ? sprintf(' *Since %s %s: %s*', $deprecatedParameters[$key][0], $deprecatedParameters[$key][1], sprintf(...\array_slice($deprecatedParameters[$key], 2))) : ''
83+
));
7784
}
7885
}
7986

@@ -290,9 +297,13 @@ protected function describeContainerAlias(Alias $alias, array $options = [], Con
290297
$this->describeContainerDefinition($container->getDefinition((string) $alias), array_merge($options, ['id' => (string) $alias]), $container);
291298
}
292299

293-
protected function describeContainerParameter(mixed $parameter, array $options = []): void
300+
protected function describeContainerParameter(mixed $parameter, ?array $deprecation, array $options = []): void
294301
{
295-
$this->write(isset($options['parameter']) ? sprintf("%s\n%s\n\n%s", $options['parameter'], str_repeat('=', \strlen($options['parameter'])), $this->formatParameter($parameter)) : $parameter);
302+
if (isset($options['parameter'])) {
303+
$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))) : ''));
304+
} else {
305+
$this->write($parameter);
306+
}
296307
}
297308

298309
protected function describeContainerEnvVars(array $envs, array $options = []): void

Console/Descriptor/TextDescriptor.php

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Console\Formatter\OutputFormatter;
1515
use Symfony\Component\Console\Helper\Dumper;
1616
use Symfony\Component\Console\Helper\Table;
17+
use Symfony\Component\Console\Helper\TableCell;
1718
use Symfony\Component\Console\Style\SymfonyStyle;
1819
use Symfony\Component\DependencyInjection\Alias;
1920
use Symfony\Component\DependencyInjection\Argument\AbstractArgument;
@@ -124,9 +125,18 @@ protected function describeContainerParameters(ParameterBag $parameters, array $
124125
{
125126
$tableHeaders = ['Parameter', 'Value'];
126127

128+
$deprecatedParameters = $parameters->allDeprecated();
129+
127130
$tableRows = [];
128131
foreach ($this->sortParameters($parameters) as $parameter => $value) {
129132
$tableRows[] = [$parameter, $this->formatParameter($value)];
133+
134+
if (isset($deprecatedParameters[$parameter])) {
135+
$tableRows[] = [new TableCell(
136+
sprintf('<comment>(Since %s %s: %s)</comment>', $deprecatedParameters[$parameter][0], $deprecatedParameters[$parameter][1], sprintf(...\array_slice($deprecatedParameters[$parameter], 2))),
137+
['colspan' => 2]
138+
)];
139+
}
130140
}
131141

132142
$options['output']->title('Symfony Container Parameters');
@@ -425,14 +435,21 @@ protected function describeContainerAlias(Alias $alias, array $options = [], Con
425435
$this->describeContainerDefinition($container->getDefinition((string) $alias), array_merge($options, ['id' => (string) $alias]), $container);
426436
}
427437

428-
protected function describeContainerParameter(mixed $parameter, array $options = []): void
438+
protected function describeContainerParameter(mixed $parameter, ?array $deprecation, array $options = []): void
429439
{
430-
$options['output']->table(
431-
['Parameter', 'Value'],
432-
[
433-
[$options['parameter'], $this->formatParameter($parameter),
434-
],
435-
]);
440+
$parameterName = $options['parameter'];
441+
$rows = [
442+
[$parameterName, $this->formatParameter($parameter)],
443+
];
444+
445+
if ($deprecation) {
446+
$rows[] = [new TableCell(
447+
sprintf('<comment>(Since %s %s: %s)</comment>', $deprecation[0], $deprecation[1], sprintf(...\array_slice($deprecation, 2))),
448+
['colspan' => 2]
449+
)];
450+
}
451+
452+
$options['output']->table(['Parameter', 'Value'], $rows);
436453
}
437454

438455
protected function describeContainerEnvVars(array $envs, array $options = []): void

0 commit comments

Comments
 (0)