mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 11:38:44 +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:
@@ -13,18 +13,15 @@ namespace Symfony\Bundle\FrameworkBundle;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddAnnotationsCachedReaderPass;
|
||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddDebugLogProcessorPass;
|
||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddExpressionLanguageProvidersPass;
|
||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AssetsContextPass;
|
||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ContainerBuilderDebugDumpPass;
|
||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\DataCollectorTranslatorPass;
|
||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\LoggingTranslatorPass;
|
||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ErrorLoggerCompilerPass;
|
||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ProfilerPass;
|
||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\RemoveUnusedSessionMarshallingHandlerPass;
|
||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\SessionPass;
|
||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TestServiceContainerRealRefPass;
|
||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TestServiceContainerWeakRefPass;
|
||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\UnusedTagsPass;
|
||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\WorkflowGuardListenerPass;
|
||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\VirtualRequestStackPass;
|
||||
use Symfony\Component\Cache\Adapter\ApcuAdapter;
|
||||
use Symfony\Component\Cache\Adapter\ArrayAdapter;
|
||||
use Symfony\Component\Cache\Adapter\ChainAdapter;
|
||||
@@ -45,6 +42,7 @@ use Symfony\Component\ErrorHandler\ErrorHandler;
|
||||
use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass;
|
||||
use Symfony\Component\Form\DependencyInjection\FormPass;
|
||||
use Symfony\Component\HttpClient\DependencyInjection\HttpClientPass;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\ControllerArgumentValueResolverPass;
|
||||
@@ -58,8 +56,12 @@ use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\Messenger\DependencyInjection\MessengerPass;
|
||||
use Symfony\Component\Mime\DependencyInjection\AddMimeTypeGuesserPass;
|
||||
use Symfony\Component\PropertyInfo\DependencyInjection\PropertyInfoPass;
|
||||
use Symfony\Component\Routing\DependencyInjection\AddExpressionLanguageProvidersPass;
|
||||
use Symfony\Component\Routing\DependencyInjection\RoutingResolverPass;
|
||||
use Symfony\Component\Scheduler\DependencyInjection\AddScheduleMessengerPass;
|
||||
use Symfony\Component\Serializer\DependencyInjection\SerializerPass;
|
||||
use Symfony\Component\Translation\DependencyInjection\DataCollectorTranslatorPass;
|
||||
use Symfony\Component\Translation\DependencyInjection\LoggingTranslatorPass;
|
||||
use Symfony\Component\Translation\DependencyInjection\TranslationDumperPass;
|
||||
use Symfony\Component\Translation\DependencyInjection\TranslationExtractorPass;
|
||||
use Symfony\Component\Translation\DependencyInjection\TranslatorPass;
|
||||
@@ -69,6 +71,8 @@ use Symfony\Component\Validator\DependencyInjection\AddConstraintValidatorsPass;
|
||||
use Symfony\Component\Validator\DependencyInjection\AddValidatorInitializersPass;
|
||||
use Symfony\Component\VarExporter\Internal\Hydrator;
|
||||
use Symfony\Component\VarExporter\Internal\Registry;
|
||||
use Symfony\Component\Workflow\DependencyInjection\WorkflowDebugPass;
|
||||
use Symfony\Component\Workflow\DependencyInjection\WorkflowGuardListenerPass;
|
||||
|
||||
// Help opcache.preload discover always-needed symbols
|
||||
class_exists(ApcuAdapter::class);
|
||||
@@ -88,15 +92,34 @@ class_exists(Registry::class);
|
||||
*/
|
||||
class FrameworkBundle extends Bundle
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
ErrorHandler::register(null, false)->throwAt($this->container->getParameter('debug.error_handler.throw_at'), true);
|
||||
$_ENV['DOCTRINE_DEPRECATIONS'] = $_SERVER['DOCTRINE_DEPRECATIONS'] ??= 'trigger';
|
||||
|
||||
$handler = ErrorHandler::register(null, false);
|
||||
|
||||
// When upgrading an existing Symfony application from 6.2 to 6.3, and
|
||||
// the cache is warmed up, the service is not available yet, so we need
|
||||
// to check if it exists.
|
||||
if ($this->container->has('debug.error_handler_configurator')) {
|
||||
$this->container->get('debug.error_handler_configurator')->configure($handler);
|
||||
}
|
||||
|
||||
if ($this->container->getParameter('kernel.http_method_override')) {
|
||||
Request::enableHttpMethodParameterOverride();
|
||||
}
|
||||
|
||||
if ($this->container->hasParameter('kernel.trust_x_sendfile_type_header') && $this->container->getParameter('kernel.trust_x_sendfile_type_header')) {
|
||||
BinaryFileResponse::trustXSendfileTypeHeader();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function build(ContainerBuilder $container)
|
||||
{
|
||||
parent::build($container);
|
||||
@@ -122,7 +145,7 @@ class FrameworkBundle extends Bundle
|
||||
$container->addCompilerPass(new RegisterControllerArgumentLocatorsPass());
|
||||
$container->addCompilerPass(new RemoveEmptyControllerArgumentLocatorsPass(), PassConfig::TYPE_BEFORE_REMOVING);
|
||||
$container->addCompilerPass(new RoutingResolverPass());
|
||||
$container->addCompilerPass(new DataCollectorTranslatorPass());
|
||||
$this->addCompilerPassIfExists($container, DataCollectorTranslatorPass::class);
|
||||
$container->addCompilerPass(new ProfilerPass());
|
||||
// must be registered before removing private services as some might be listeners/subscribers
|
||||
// but as late as possible to get resolved parameters
|
||||
@@ -135,8 +158,8 @@ class FrameworkBundle extends Bundle
|
||||
// twig.template_iterator definition
|
||||
$this->addCompilerPassIfExists($container, TranslatorPass::class, PassConfig::TYPE_BEFORE_OPTIMIZATION, -32);
|
||||
$this->addCompilerPassIfExists($container, TranslatorPathsPass::class, PassConfig::TYPE_AFTER_REMOVING);
|
||||
$container->addCompilerPass(new LoggingTranslatorPass());
|
||||
$container->addCompilerPass(new AddExpressionLanguageProvidersPass(false));
|
||||
$this->addCompilerPassIfExists($container, LoggingTranslatorPass::class);
|
||||
$container->addCompilerPass(new AddExpressionLanguageProvidersPass());
|
||||
$this->addCompilerPassIfExists($container, TranslationExtractorPass::class);
|
||||
$this->addCompilerPassIfExists($container, TranslationDumperPass::class);
|
||||
$container->addCompilerPass(new FragmentRendererPass());
|
||||
@@ -147,29 +170,33 @@ class FrameworkBundle extends Bundle
|
||||
$container->addCompilerPass(new CachePoolClearerPass(), PassConfig::TYPE_AFTER_REMOVING);
|
||||
$container->addCompilerPass(new CachePoolPrunerPass(), PassConfig::TYPE_AFTER_REMOVING);
|
||||
$this->addCompilerPassIfExists($container, FormPass::class);
|
||||
$container->addCompilerPass(new WorkflowGuardListenerPass());
|
||||
$this->addCompilerPassIfExists($container, WorkflowGuardListenerPass::class);
|
||||
$container->addCompilerPass(new ResettableServicePass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -32);
|
||||
$container->addCompilerPass(new RegisterLocaleAwareServicesPass());
|
||||
$container->addCompilerPass(new TestServiceContainerWeakRefPass(), PassConfig::TYPE_BEFORE_REMOVING, -32);
|
||||
$container->addCompilerPass(new TestServiceContainerRealRefPass(), PassConfig::TYPE_AFTER_REMOVING);
|
||||
$this->addCompilerPassIfExists($container, AddMimeTypeGuesserPass::class);
|
||||
$this->addCompilerPassIfExists($container, AddScheduleMessengerPass::class);
|
||||
$this->addCompilerPassIfExists($container, MessengerPass::class);
|
||||
$this->addCompilerPassIfExists($container, HttpClientPass::class);
|
||||
$this->addCompilerPassIfExists($container, AddAutoMappingConfigurationPass::class);
|
||||
$container->addCompilerPass(new RegisterReverseContainerPass(true));
|
||||
$container->addCompilerPass(new RegisterReverseContainerPass(false), PassConfig::TYPE_AFTER_REMOVING);
|
||||
$container->addCompilerPass(new RemoveUnusedSessionMarshallingHandlerPass());
|
||||
$container->addCompilerPass(new SessionPass());
|
||||
// must be registered after MonologBundle's LoggerChannelPass
|
||||
$container->addCompilerPass(new ErrorLoggerCompilerPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -32);
|
||||
$container->addCompilerPass(new VirtualRequestStackPass());
|
||||
|
||||
if ($container->getParameter('kernel.debug')) {
|
||||
$container->addCompilerPass(new AddDebugLogProcessorPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 2);
|
||||
$container->addCompilerPass(new UnusedTagsPass(), PassConfig::TYPE_AFTER_REMOVING);
|
||||
$container->addCompilerPass(new ContainerBuilderDebugDumpPass(), PassConfig::TYPE_BEFORE_REMOVING, -255);
|
||||
$container->addCompilerPass(new CacheCollectorPass(), PassConfig::TYPE_BEFORE_REMOVING);
|
||||
$this->addCompilerPassIfExists($container, WorkflowDebugPass::class);
|
||||
}
|
||||
}
|
||||
|
||||
private function addCompilerPassIfExists(ContainerBuilder $container, string $class, string $type = PassConfig::TYPE_BEFORE_OPTIMIZATION, int $priority = 0)
|
||||
private function addCompilerPassIfExists(ContainerBuilder $container, string $class, string $type = PassConfig::TYPE_BEFORE_OPTIMIZATION, int $priority = 0): void
|
||||
{
|
||||
$container->addResource(new ClassExistenceResource($class));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user