mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-26 03:58:45 +02:00
migration symfony 5 4 (#300)
* symfony 5.4 (diff dev) * symfony 5.4 (working) * symfony 5.4 (update autoload) * symfony 5.4 (remove swiftmailer mailer implementation) * symfony 5.4 (php doc and split Global accessor class) ### Impacted packages: composer require php:">=7.2.5 <8.0.0" symfony/console:5.4.* symfony/dotenv:5.4.* symfony/framework-bundle:5.4.* symfony/twig-bundle:5.4.* symfony/yaml:5.4.* --update-with-dependencies composer require symfony/stopwatch:5.4.* symfony/web-profiler-bundle:5.4.* --dev --update-with-dependencies
This commit is contained in:
@@ -12,11 +12,10 @@
|
||||
namespace Symfony\Bundle\FrameworkBundle\CacheWarmer;
|
||||
|
||||
use Doctrine\Common\Annotations\AnnotationException;
|
||||
use Doctrine\Common\Annotations\CachedReader;
|
||||
use Doctrine\Common\Annotations\PsrCachedReader;
|
||||
use Doctrine\Common\Annotations\Reader;
|
||||
use Psr\Cache\CacheItemPoolInterface;
|
||||
use Symfony\Component\Cache\Adapter\ArrayAdapter;
|
||||
use Symfony\Component\Cache\DoctrineProvider;
|
||||
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
|
||||
|
||||
/**
|
||||
* Warms up annotation caches for classes found in composer's autoload class map
|
||||
@@ -31,13 +30,11 @@ class AnnotationsCacheWarmer extends AbstractPhpFileCacheWarmer
|
||||
private $debug;
|
||||
|
||||
/**
|
||||
* @param string $phpArrayFile The PHP file where annotations are cached
|
||||
* @param CacheItemPoolInterface $fallbackPool The pool where runtime-discovered annotations are cached
|
||||
* @param bool $debug Run in debug mode
|
||||
* @param string $phpArrayFile The PHP file where annotations are cached
|
||||
*/
|
||||
public function __construct(Reader $annotationReader, $phpArrayFile, CacheItemPoolInterface $fallbackPool, $excludeRegexp = null, $debug = false)
|
||||
public function __construct(Reader $annotationReader, string $phpArrayFile, string $excludeRegexp = null, bool $debug = false)
|
||||
{
|
||||
parent::__construct($phpArrayFile, $fallbackPool);
|
||||
parent::__construct($phpArrayFile);
|
||||
$this->annotationReader = $annotationReader;
|
||||
$this->excludeRegexp = $excludeRegexp;
|
||||
$this->debug = $debug;
|
||||
@@ -46,7 +43,7 @@ class AnnotationsCacheWarmer extends AbstractPhpFileCacheWarmer
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doWarmUp($cacheDir, ArrayAdapter $arrayAdapter)
|
||||
protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter)
|
||||
{
|
||||
$annotatedClassPatterns = $cacheDir.'/annotations.map';
|
||||
|
||||
@@ -55,7 +52,7 @@ class AnnotationsCacheWarmer extends AbstractPhpFileCacheWarmer
|
||||
}
|
||||
|
||||
$annotatedClasses = include $annotatedClassPatterns;
|
||||
$reader = new CachedReader($this->annotationReader, new DoctrineProvider($arrayAdapter), $this->debug);
|
||||
$reader = new PsrCachedReader($this->annotationReader, $arrayAdapter, $this->debug);
|
||||
|
||||
foreach ($annotatedClasses as $class) {
|
||||
if (null !== $this->excludeRegexp && preg_match($this->excludeRegexp, $class)) {
|
||||
@@ -71,7 +68,18 @@ class AnnotationsCacheWarmer extends AbstractPhpFileCacheWarmer
|
||||
return true;
|
||||
}
|
||||
|
||||
private function readAllComponents(Reader $reader, $class)
|
||||
/**
|
||||
* @return string[] A list of classes to preload on PHP 7.4+
|
||||
*/
|
||||
protected function warmUpPhpArrayAdapter(PhpArrayAdapter $phpArrayAdapter, array $values)
|
||||
{
|
||||
// make sure we don't cache null values
|
||||
$values = array_filter($values, function ($val) { return null !== $val; });
|
||||
|
||||
return parent::warmUpPhpArrayAdapter($phpArrayAdapter, $values);
|
||||
}
|
||||
|
||||
private function readAllComponents(Reader $reader, string $class)
|
||||
{
|
||||
$reflectionClass = new \ReflectionClass($class);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user