upgraded dependencies
This commit is contained in:
@@ -18,7 +18,7 @@ namespace Symfony\Component\HttpKernel\CacheWarmer;
|
||||
*/
|
||||
abstract class CacheWarmer implements CacheWarmerInterface
|
||||
{
|
||||
protected function writeCacheFile($file, $content)
|
||||
protected function writeCacheFile(string $file, $content)
|
||||
{
|
||||
$tmpFile = @tempnam(\dirname($file), basename($file));
|
||||
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) {
|
||||
|
@@ -26,6 +26,9 @@ class CacheWarmerAggregate implements CacheWarmerInterface
|
||||
private $optionalsEnabled = false;
|
||||
private $onlyOptionalsEnabled = false;
|
||||
|
||||
/**
|
||||
* @param iterable<mixed, CacheWarmerInterface> $warmers
|
||||
*/
|
||||
public function __construct(iterable $warmers = [], bool $debug = false, string $deprecationLogsFilepath = null)
|
||||
{
|
||||
$this->warmers = $warmers;
|
||||
@@ -44,11 +47,9 @@ class CacheWarmerAggregate implements CacheWarmerInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Warms up the cache.
|
||||
*
|
||||
* @param string $cacheDir The cache directory
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function warmUp($cacheDir)
|
||||
public function warmUp(string $cacheDir): array
|
||||
{
|
||||
if ($collectDeprecations = $this->debug && !\defined('PHPUNIT_COMPOSER_INSTALL')) {
|
||||
$collectedLogs = [];
|
||||
@@ -85,6 +86,7 @@ class CacheWarmerAggregate implements CacheWarmerInterface
|
||||
});
|
||||
}
|
||||
|
||||
$preload = [];
|
||||
try {
|
||||
foreach ($this->warmers as $warmer) {
|
||||
if (!$this->optionalsEnabled && $warmer->isOptional()) {
|
||||
@@ -94,13 +96,13 @@ class CacheWarmerAggregate implements CacheWarmerInterface
|
||||
continue;
|
||||
}
|
||||
|
||||
$warmer->warmUp($cacheDir);
|
||||
$preload[] = array_values((array) $warmer->warmUp($cacheDir));
|
||||
}
|
||||
} finally {
|
||||
if ($collectDeprecations) {
|
||||
restore_error_handler();
|
||||
|
||||
if (file_exists($this->deprecationLogsFilepath)) {
|
||||
if (is_file($this->deprecationLogsFilepath)) {
|
||||
$previousLogs = unserialize(file_get_contents($this->deprecationLogsFilepath));
|
||||
if (\is_array($previousLogs)) {
|
||||
$collectedLogs = array_merge($previousLogs, $collectedLogs);
|
||||
@@ -110,12 +112,12 @@ class CacheWarmerAggregate implements CacheWarmerInterface
|
||||
file_put_contents($this->deprecationLogsFilepath, serialize(array_values($collectedLogs)));
|
||||
}
|
||||
}
|
||||
|
||||
return array_values(array_unique(array_merge([], ...$preload)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this warmer is optional or not.
|
||||
*
|
||||
* @return bool always false
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isOptional(): bool
|
||||
{
|
||||
|
@@ -26,7 +26,7 @@ interface CacheWarmerInterface extends WarmableInterface
|
||||
* A warmer should return true if the cache can be
|
||||
* generated incrementally and on-demand.
|
||||
*
|
||||
* @return bool true if the warmer is optional, false otherwise
|
||||
* @return bool
|
||||
*/
|
||||
public function isOptional();
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ interface WarmableInterface
|
||||
/**
|
||||
* Warms up the cache.
|
||||
*
|
||||
* @param string $cacheDir The cache directory
|
||||
* @return string[] A list of classes or files to preload on PHP 7.4+
|
||||
*/
|
||||
public function warmUp($cacheDir);
|
||||
public function warmUp(string $cacheDir);
|
||||
}
|
||||
|
Reference in New Issue
Block a user