Skip to content

Commit 738a925

Browse files
Merge branch '7.4' into 8.0
* 7.4: [Config][FrameworkBundle] Allow using ParamConfigurator with every configurable value [HttpFoundation] Improve doc blocks in `ParameterBag` [HttpClient] Fix ever growing $maxHostConnections Fix typo [DependencyInjection] Fix referencing build-time array parameters cs fix [FrameworkBundle] Fix cache:pool:prune exit code on failure [Form] Add type hint for FormTypeInterface in FormBuilderInterface [Form] Always normalize CRLF and CR to LF in `TextareaType` [Cache] Fix stampede protection when forcing item recomputation [DoctrineBridge] Fix checking for the session table when using PDO fix(messenger): allow signing message without routing definition [Console] Fix EofShortcut instruction when using a modern terminal on Windows [Console] Do not call non-static method via class-name [Console] Fix choice autocomplete issue when string has spaces Update SameOriginCsrfTokenManager.php [Serializer] Fix inconsistent field naming from accessors when using groups [Finder] Fix converting unanchored glob patterns to regex
2 parents 6aa9dd0 + 035eb25 commit 738a925

File tree

5 files changed

+59
-10
lines changed

5 files changed

+59
-10
lines changed

Command/CachePoolPruneCommand.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,21 @@ protected function configure(): void
5050
protected function execute(InputInterface $input, OutputInterface $output): int
5151
{
5252
$io = new SymfonyStyle($input, $output);
53+
$exitCode = Command::SUCCESS;
5354

5455
foreach ($this->pools as $name => $pool) {
5556
$io->comment(\sprintf('Pruning cache pool: <info>%s</info>', $name));
56-
$pool->prune();
57+
58+
if (!$pool->prune()) {
59+
$io->error(\sprintf('Cache pool "%s" could not be pruned.', $name));
60+
$exitCode = Command::FAILURE;
61+
}
5762
}
5863

59-
$io->success('Successfully pruned cache pool(s).');
64+
if (Command::SUCCESS === $exitCode) {
65+
$io->success('Successfully pruned cache pool(s).');
66+
}
6067

61-
return 0;
68+
return $exitCode;
6269
}
6370
}

DependencyInjection/Compiler/PhpConfigReferenceDumpPass.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class PhpConfigReferenceDumpPass implements CompilerPassInterface
3434
3535
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
3636
37+
use Symfony\Component\Config\Loader\ParamConfigurator as Param;
38+
3739
{APP_TYPES}
3840
final class App
3941
{

Tests/Command/CachePruneCommandTest.php

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,44 @@ public function testCommandWithNoPools()
3535
$tester->execute([]);
3636
}
3737

38+
public function testCommandFailsOnPruneError()
39+
{
40+
$failedPool = $this->createMock(PruneableInterface::class);
41+
$failedPool->expects($this->once())->method('prune')->willReturn(false);
42+
43+
$generator = new RewindableGenerator(static function () use ($failedPool) {
44+
yield 'failed_pool' => $failedPool;
45+
}, 1);
46+
47+
$tester = $this->getCommandTester($this->getKernel(), $generator);
48+
$tester->execute([]);
49+
50+
$this->assertSame(1, $tester->getStatusCode());
51+
$this->assertStringContainsString('[ERROR] Cache pool "failed_pool" could not be pruned.', $tester->getDisplay());
52+
}
53+
54+
public function testCommandContinuesOnFailure()
55+
{
56+
$failedPool = $this->createMock(PruneableInterface::class);
57+
$failedPool->expects($this->once())->method('prune')->willReturn(false);
58+
59+
$successPool = $this->createMock(PruneableInterface::class);
60+
$successPool->expects($this->once())->method('prune')->willReturn(true);
61+
62+
$generator = new RewindableGenerator(static function () use ($failedPool, $successPool) {
63+
yield 'failed_pool' => $failedPool;
64+
yield 'success_pool' => $successPool;
65+
}, 2);
66+
67+
$tester = $this->getCommandTester($this->getKernel(), $generator);
68+
$tester->execute([]);
69+
70+
$this->assertSame(1, $tester->getStatusCode());
71+
$display = $tester->getDisplay();
72+
$this->assertStringContainsString('[ERROR] Cache pool "failed_pool" could not be pruned.', $display);
73+
$this->assertStringContainsString('Pruning cache pool: success_pool', $display);
74+
}
75+
3876
private function getRewindableGenerator(): RewindableGenerator
3977
{
4078
return new RewindableGenerator(function () {
@@ -45,7 +83,7 @@ private function getRewindableGenerator(): RewindableGenerator
4583

4684
private function getEmptyRewindableGenerator(): RewindableGenerator
4785
{
48-
return new RewindableGenerator(fn () => new \ArrayIterator([]), 0);
86+
return new RewindableGenerator(static fn () => new \ArrayIterator([]), 0);
4987
}
5088

5189
private function getKernel(): MockObject&KernelInterface

Tests/Fixtures/reference.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
66

7+
use Symfony\Component\Config\Loader\ParamConfigurator as Param;
8+
79
/**
810
* This class provides array-shapes for configuring the services and bundles of an application.
911
*
@@ -124,14 +126,14 @@
124126
* }
125127
* @psalm-type ExtensionType = array<string, mixed>
126128
* @psalm-type TestConfig = array{
127-
* enabled?: scalar|null, // Default: false
129+
* enabled?: scalar|null|Param, // Default: false
128130
* options?: array{
129-
* name?: scalar|null,
130-
* count?: int,
131+
* name?: scalar|null|Param,
132+
* count?: int|Param,
131133
* },
132-
* fromBundle?: bool, // Default: false
134+
* fromBundle?: bool|Param, // Default: false
133135
* }
134-
* @psalm-type AppConfig = bool
136+
* @psalm-type AppConfig = bool|Param
135137
* @psalm-type ConfigType = array{
136138
* imports?: ImportsConfig,
137139
* parameters?: ParametersConfig,

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"composer-runtime-api": ">=2.1",
2121
"ext-xml": "*",
2222
"symfony/cache": "^7.4|^8.0",
23-
"symfony/config": "^7.4|^8.0",
23+
"symfony/config": "^7.4.3|^8.0.3",
2424
"symfony/dependency-injection": "^7.4|^8.0",
2525
"symfony/deprecation-contracts": "^2.5|^3",
2626
"symfony/error-handler": "^7.4|^8.0",

0 commit comments

Comments
 (0)