Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 931cc08

Browse files
committed
Update warmup signature on all WarmableInterface implementations
Signed-off-by: Quentin Devos <[email protected]>
1 parent 36fe555 commit 931cc08

File tree

14 files changed

+37
-13
lines changed

14 files changed

+37
-13
lines changed

src/Symfony/Bridge/Doctrine/CacheWarmer/ProxyCacheWarmer.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ public function isOptional(): bool
4040
}
4141

4242
/**
43+
* @param string|null $buildDir directory to put generated source code that can be marked as read-only at runtime.
44+
* The directory is not provided when only cache_dir should be warmed up.
4345
* @return string[] A list of files to preload on PHP 7.4+
4446
*/
45-
public function warmUp(string $cacheDir): array
47+
public function warmUp(string $cacheDir /* , string $buildDir = null */): array
4648
{
4749
$files = [];
4850
foreach ($this->registry->getManagers() as $em) {

src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AbstractPhpFileCacheWarmer.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ public function isOptional(): bool
3535
}
3636

3737
/**
38+
* @param string|null $buildDir directory to put generated source code that can be marked as read-only at runtime.
39+
* The directory is not provided when only cache_dir should be warmed up.
3840
* @return string[] A list of classes to preload on PHP 7.4+
3941
*/
40-
public function warmUp(string $cacheDir): array
42+
public function warmUp(string $cacheDir /* , string $buildDir = null */): array
4143
{
4244
$arrayAdapter = new ArrayAdapter();
4345

src/Symfony/Bundle/FrameworkBundle/CacheWarmer/CachePoolClearerCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(Psr6CacheClearer $poolClearer, array $pools = [])
4040
/**
4141
* @return string[]
4242
*/
43-
public function warmUp(string $cacheDirectory): array
43+
public function warmUp(string $cacheDirectory, string $buildDir = null): array
4444
{
4545
foreach ($this->pools as $pool) {
4646
if ($this->poolClearer->hasPool($pool)) {

src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ public function __construct(ContainerInterface $container)
3434
$this->container = $container;
3535
}
3636

37-
public function warmUp(string $cacheDir): array
37+
/**
38+
* @param string|null $buildDir directory to put generated source code that can be marked as read-only at runtime.
39+
* The directory is not provided when only cache_dir should be warmed up.
40+
*/
41+
public function warmUp(string $cacheDir /* , string $buildDir = null */): array
3842
{
3943
$router = $this->container->get('router');
4044

src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TranslationsCacheWarmer.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ public function __construct(ContainerInterface $container)
3434
}
3535

3636
/**
37+
* @param string|null $buildDir directory to put generated source code that can be marked as read-only at runtime.
38+
* The directory is not provided when only cache_dir should be warmed up.
3739
* @return string[]
3840
*/
39-
public function warmUp(string $cacheDir): array
41+
public function warmUp(string $cacheDir /* , string $buildDir = null */): array
4042
{
4143
$this->translator ??= $this->container->get('translator');
4244

src/Symfony/Bundle/FrameworkBundle/Routing/Router.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,11 @@ public function getRouteCollection(): RouteCollection
8181
}
8282

8383
/**
84+
* @param string|null $buildDir directory to put generated source code that can be marked as read-only at runtime.
85+
* The directory is not provided when only cache_dir should be warmed up.
8486
* @return string[] A list of classes to preload on PHP 7.4+
8587
*/
86-
public function warmUp(string $cacheDir): array
88+
public function warmUp(string $cacheDir /* , string $buildDir = null */): array
8789
{
8890
$currentDir = $this->getOption('cache_dir');
8991

src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ public function testCacheIsWarmedWhenCalledTwice()
111111
$application->doRun($input, new NullOutput());
112112

113113
$this->assertTrue(is_file($this->kernel->getCacheDir().'/dummy.txt'));
114+
$this->assertTrue(is_file($this->kernel->getBuildDir().'/build-dummy.txt'));
114115
}
115116

116117
public function testCacheIsWarmedWithOldContainer()

src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/Fixture/TestAppKernel.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,12 @@ public function isOptional(): bool
5252
return false;
5353
}
5454

55-
public function warmUp(string $cacheDir): array
55+
public function warmUp(string $cacheDir, string $buildDir = null): array
5656
{
5757
file_put_contents($cacheDir.'/dummy.txt', 'Hello');
58+
if (null !== $buildDir) {
59+
file_put_contents($buildDir . '/build-dummy.txt', 'Hello');
60+
}
5861

5962
return [];
6063
}

src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,11 @@ public function __construct(ContainerInterface $container, MessageFormatterInter
9595
}
9696

9797
/**
98+
* @param string|null $buildDir directory to put generated source code that can be marked as read-only at runtime.
99+
* The directory is not provided when only cache_dir should be warmed up.
98100
* @return string[]
99101
*/
100-
public function warmUp(string $cacheDir): array
102+
public function warmUp(string $cacheDir /* , string $buildDir = null */): array
101103
{
102104
// skip warmUp when translator doesn't use cache
103105
if (null === $this->options['cache_dir']) {

src/Symfony/Bundle/SecurityBundle/CacheWarmer/ExpressionCacheWarmer.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ public function isOptional(): bool
3535
}
3636

3737
/**
38+
* @param string|null $buildDir directory to put generated source code that can be marked as read-only at runtime.
39+
* The directory is not provided when only cache_dir should be warmed up.
3840
* @return string[]
3941
*/
40-
public function warmUp(string $cacheDir): array
42+
public function warmUp(string $cacheDir /* , string $buildDir = null */): array
4143
{
4244
foreach ($this->expressions as $expression) {
4345
$this->expressionLanguage->parse($expression, ['token', 'user', 'object', 'subject', 'role_names', 'request', 'trust_resolver']);

0 commit comments

Comments
 (0)