mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
N°6934 - Symfony 6.4 - upgrade Symfony bundles to 6.4 (#580)
* Update Symfony lib to version ~6.4.0 * Update code missing return type * Add an iTop general configuration entry to store application secret (Symfony mandatory parameter) * Use dependency injection in ExceptionListener & UserProvider classes
This commit is contained in:
@@ -22,28 +22,32 @@ use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
|
||||
* and declared in DI bundle extensions using the addAnnotatedClassesToCache method.
|
||||
*
|
||||
* @author Titouan Galopin <galopintitouan@gmail.com>
|
||||
*
|
||||
* @deprecated since Symfony 6.4 without replacement
|
||||
*/
|
||||
class AnnotationsCacheWarmer extends AbstractPhpFileCacheWarmer
|
||||
{
|
||||
private $annotationReader;
|
||||
private $excludeRegexp;
|
||||
private $debug;
|
||||
|
||||
/**
|
||||
* @param string $phpArrayFile The PHP file where annotations are cached
|
||||
*/
|
||||
public function __construct(Reader $annotationReader, string $phpArrayFile, string $excludeRegexp = null, bool $debug = false)
|
||||
{
|
||||
public function __construct(
|
||||
private readonly Reader $annotationReader,
|
||||
string $phpArrayFile,
|
||||
private readonly ?string $excludeRegexp = null,
|
||||
private readonly bool $debug = false,
|
||||
/* bool $triggerDeprecation = true, */
|
||||
) {
|
||||
if (\func_num_args() < 5 || func_get_arg(4)) {
|
||||
trigger_deprecation('symfony/framework-bundle', '6.4', 'The "%s" class is deprecated without replacement.', __CLASS__);
|
||||
}
|
||||
|
||||
parent::__construct($phpArrayFile);
|
||||
$this->annotationReader = $annotationReader;
|
||||
$this->excludeRegexp = $excludeRegexp;
|
||||
$this->debug = $debug;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @param string|null $buildDir
|
||||
*/
|
||||
protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter)
|
||||
protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter /* , string $buildDir = null */): bool
|
||||
{
|
||||
$annotatedClassPatterns = $cacheDir.'/annotations.map';
|
||||
|
||||
@@ -71,21 +75,21 @@ class AnnotationsCacheWarmer extends AbstractPhpFileCacheWarmer
|
||||
/**
|
||||
* @return string[] A list of classes to preload on PHP 7.4+
|
||||
*/
|
||||
protected function warmUpPhpArrayAdapter(PhpArrayAdapter $phpArrayAdapter, array $values)
|
||||
protected function warmUpPhpArrayAdapter(PhpArrayAdapter $phpArrayAdapter, array $values): array
|
||||
{
|
||||
// make sure we don't cache null values
|
||||
$values = array_filter($values, function ($val) { return null !== $val; });
|
||||
$values = array_filter($values, fn ($val) => null !== $val);
|
||||
|
||||
return parent::warmUpPhpArrayAdapter($phpArrayAdapter, $values);
|
||||
}
|
||||
|
||||
private function readAllComponents(Reader $reader, string $class)
|
||||
private function readAllComponents(Reader $reader, string $class): void
|
||||
{
|
||||
$reflectionClass = new \ReflectionClass($class);
|
||||
|
||||
try {
|
||||
$reader->getClassAnnotations($reflectionClass);
|
||||
} catch (AnnotationException $e) {
|
||||
} catch (AnnotationException) {
|
||||
/*
|
||||
* Ignore any AnnotationException to not break the cache warming process if an Annotation is badly
|
||||
* configured or could not be found / read / etc.
|
||||
@@ -99,14 +103,14 @@ class AnnotationsCacheWarmer extends AbstractPhpFileCacheWarmer
|
||||
foreach ($reflectionClass->getMethods() as $reflectionMethod) {
|
||||
try {
|
||||
$reader->getMethodAnnotations($reflectionMethod);
|
||||
} catch (AnnotationException $e) {
|
||||
} catch (AnnotationException) {
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($reflectionClass->getProperties() as $reflectionProperty) {
|
||||
try {
|
||||
$reader->getPropertyAnnotations($reflectionProperty);
|
||||
} catch (AnnotationException $e) {
|
||||
} catch (AnnotationException) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user