first commit
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class AddAnnotationsCachedReaderPass implements CompilerPassInterface
|
||||
{
|
||||
public function process(ContainerBuilder $container): void
|
||||
{
|
||||
// "annotations.cached_reader" is wired late so that any passes using
|
||||
// "annotation_reader" at build time don't get any cache
|
||||
foreach ($container->findTaggedServiceIds('annotations.cached_reader') as $id => $tags) {
|
||||
$reader = $container->getDefinition($id);
|
||||
$properties = $reader->getProperties();
|
||||
|
||||
if (isset($properties['cacheProviderBackup'])) {
|
||||
$provider = $properties['cacheProviderBackup']->getValues()[0];
|
||||
unset($properties['cacheProviderBackup']);
|
||||
$reader->setProperties($properties);
|
||||
$reader->replaceArgument(1, $provider);
|
||||
} elseif (4 <= \count($arguments = $reader->getArguments()) && $arguments[3] instanceof ServiceClosureArgument) {
|
||||
$arguments[1] = $arguments[3]->getValues()[0];
|
||||
unset($arguments[3]);
|
||||
$reader->setArguments($arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
class AddDebugLogProcessorPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasDefinition('profiler')) {
|
||||
return;
|
||||
}
|
||||
if (!$container->hasDefinition('monolog.logger_prototype')) {
|
||||
return;
|
||||
}
|
||||
if (!$container->hasDefinition('debug.log_processor')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$container->getDefinition('monolog.logger_prototype')
|
||||
->setConfigurator([new Reference('debug.debug_logger_configurator'), 'pushDebugLogger']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Symfony 6.4, use HttpKernel's DebugLoggerConfigurator instead
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function configureLogger(mixed $logger)
|
||||
{
|
||||
trigger_deprecation('symfony/framework-bundle', '6.4', 'The "%s()" method is deprecated, use HttpKernel\'s DebugLoggerConfigurator instead.', __METHOD__);
|
||||
|
||||
if (\is_object($logger) && method_exists($logger, 'removeDebugLogger') && \in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) {
|
||||
$logger->removeDebugLogger();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
trigger_deprecation('symfony/framework-bundle', '6.4', 'The "%s" class is deprecated, use "%s" instead.', AddExpressionLanguageProvidersPass::class, \Symfony\Component\Routing\DependencyInjection\AddExpressionLanguageProvidersPass::class);
|
||||
|
||||
/**
|
||||
* Registers the expression language providers.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @deprecated since Symfony 6.4, use Symfony\Component\Routing\DependencyInjection\AddExpressionLanguageProvidersPass instead.
|
||||
*/
|
||||
class AddExpressionLanguageProvidersPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
// routing
|
||||
if ($container->has('router.default')) {
|
||||
$definition = $container->findDefinition('router.default');
|
||||
foreach ($container->findTaggedServiceIds('routing.expression_language_provider', true) as $id => $attributes) {
|
||||
$definition->addMethodCall('addExpressionLanguageProvider', [new Reference($id)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
class AssetsContextPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasDefinition('assets.context')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$container->hasDefinition('router.request_context')) {
|
||||
$container->setParameter('asset.request_context.base_path', $container->getParameter('asset.request_context.base_path') ?? '');
|
||||
$container->setParameter('asset.request_context.secure', $container->getParameter('asset.request_context.secure') ?? false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$context = $container->getDefinition('assets.context');
|
||||
|
||||
if (null === $container->getParameter('asset.request_context.base_path')) {
|
||||
$context->replaceArgument(1, (new Definition('string'))->setFactory([new Reference('router.request_context'), 'getBaseUrl']));
|
||||
}
|
||||
|
||||
if (null === $container->getParameter('asset.request_context.secure')) {
|
||||
$context->replaceArgument(2, (new Definition('bool'))->setFactory([new Reference('router.request_context'), 'isSecure']));
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\Config\ConfigCache;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Dumper\XmlDumper;
|
||||
|
||||
/**
|
||||
* Dumps the ContainerBuilder to a cache file so that it can be used by
|
||||
* debugging tools such as the debug:container console command.
|
||||
*
|
||||
* @author Ryan Weaver <ryan@thatsquality.com>
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class ContainerBuilderDebugDumpPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->getParameter('debug.container.dump')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$cache = new ConfigCache($container->getParameter('debug.container.dump'), true);
|
||||
if (!$cache->isFresh()) {
|
||||
$cache->write((new XmlDumper($container))->dump(), $container->getResources());
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\Translation\TranslatorBagInterface;
|
||||
|
||||
trigger_deprecation('symfony/framework-bundle', '6.4', 'The "%s" class is deprecated, use "%s" instead.', DataCollectorTranslatorPass::class, \Symfony\Component\Translation\DependencyInjection\DataCollectorTranslatorPass::class);
|
||||
|
||||
/**
|
||||
* @author Christian Flothmann <christian.flothmann@sensiolabs.de>
|
||||
*
|
||||
* @deprecated since Symfony 6.4, use Symfony\Component\Translation\DependencyInjection\DataCollectorTranslatorPass instead.
|
||||
*/
|
||||
class DataCollectorTranslatorPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->has('translator')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$translatorClass = $container->getParameterBag()->resolveValue($container->findDefinition('translator')->getClass());
|
||||
|
||||
if (!is_subclass_of($translatorClass, TranslatorBagInterface::class)) {
|
||||
$container->removeDefinition('translator.data_collector');
|
||||
$container->removeDefinition('data_collector.translation');
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
|
||||
|
||||
trigger_deprecation('symfony/framework-bundle', '6.4', 'The "%s" class is deprecated, use argument $debug of HttpKernel\'s Logger instead.', EnableLoggerDebugModePass::class);
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\HttpKernel\Log\Logger;
|
||||
|
||||
/**
|
||||
* @deprecated since Symfony 6.4, use argument $debug of HttpKernel's Logger instead
|
||||
*/
|
||||
final class EnableLoggerDebugModePass implements CompilerPassInterface
|
||||
{
|
||||
public function process(ContainerBuilder $container): void
|
||||
{
|
||||
if (!$container->hasDefinition('profiler') || !$container->hasDefinition('logger')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$loggerDefinition = $container->getDefinition('logger');
|
||||
|
||||
if (Logger::class === $loggerDefinition->getClass()) {
|
||||
$loggerDefinition->setConfigurator([__CLASS__, 'configureLogger']);
|
||||
}
|
||||
}
|
||||
|
||||
public static function configureLogger(Logger $logger): void
|
||||
{
|
||||
if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) {
|
||||
$logger->enableDebug();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class ErrorLoggerCompilerPass implements CompilerPassInterface
|
||||
{
|
||||
public function process(ContainerBuilder $container): void
|
||||
{
|
||||
if (!$container->hasDefinition('debug.error_handler_configurator')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$definition = $container->getDefinition('debug.error_handler_configurator');
|
||||
if ($container->hasDefinition('monolog.logger.php')) {
|
||||
$definition->replaceArgument(0, new Reference('monolog.logger.php'));
|
||||
}
|
||||
if ($container->hasDefinition('monolog.logger.deprecation')) {
|
||||
$definition->replaceArgument(5, new Reference('monolog.logger.deprecation'));
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Translation\TranslatorBagInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
trigger_deprecation('symfony/framework-bundle', '6.4', 'The "%s" class is deprecated, use "%s" instead.', LoggingTranslatorPass::class, \Symfony\Component\Translation\DependencyInjection\LoggingTranslatorPass::class);
|
||||
|
||||
/**
|
||||
* @author Abdellatif Ait boudad <a.aitboudad@gmail.com>
|
||||
*
|
||||
* @deprecated since Symfony 6.4, use Symfony\Component\Translation\DependencyInjection\LoggingTranslatorPass instead.
|
||||
*/
|
||||
class LoggingTranslatorPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasAlias('logger') || !$container->hasAlias('translator')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($container->hasParameter('translator.logging') && $container->getParameter('translator.logging')) {
|
||||
$translatorAlias = $container->getAlias('translator');
|
||||
$definition = $container->getDefinition((string) $translatorAlias);
|
||||
$class = $container->getParameterBag()->resolveValue($definition->getClass());
|
||||
|
||||
if (!$r = $container->getReflectionClass($class)) {
|
||||
throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $translatorAlias));
|
||||
}
|
||||
if ($r->isSubclassOf(TranslatorInterface::class) && $r->isSubclassOf(TranslatorBagInterface::class)) {
|
||||
$container->getDefinition('translator.logging')->setDecoratedService('translator');
|
||||
$warmer = $container->getDefinition('translation.warmer');
|
||||
$subscriberAttributes = $warmer->getTag('container.service_subscriber');
|
||||
$warmer->clearTag('container.service_subscriber');
|
||||
|
||||
foreach ($subscriberAttributes as $k => $v) {
|
||||
if ((!isset($v['id']) || 'translator' !== $v['id']) && (!isset($v['key']) || 'translator' !== $v['key'])) {
|
||||
$warmer->addTag('container.service_subscriber', $v);
|
||||
}
|
||||
}
|
||||
$warmer->addTag('container.service_subscriber', ['key' => 'translator', 'id' => 'translator.logging.inner']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\DataCollector\TemplateAwareDataCollectorInterface;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* Adds tagged data_collector services to profiler service.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class ProfilerPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (false === $container->hasDefinition('profiler')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$definition = $container->getDefinition('profiler');
|
||||
|
||||
$collectors = new \SplPriorityQueue();
|
||||
$order = \PHP_INT_MAX;
|
||||
foreach ($container->findTaggedServiceIds('data_collector', true) as $id => $attributes) {
|
||||
$priority = $attributes[0]['priority'] ?? 0;
|
||||
$template = null;
|
||||
|
||||
$collectorClass = $container->findDefinition($id)->getClass();
|
||||
if (isset($attributes[0]['template']) || is_subclass_of($collectorClass, TemplateAwareDataCollectorInterface::class)) {
|
||||
$idForTemplate = $attributes[0]['id'] ?? $collectorClass;
|
||||
if (!$idForTemplate) {
|
||||
throw new InvalidArgumentException(sprintf('Data collector service "%s" must have an id attribute in order to specify a template.', $id));
|
||||
}
|
||||
$template = [$idForTemplate, $attributes[0]['template'] ?? $collectorClass::getTemplate()];
|
||||
}
|
||||
|
||||
$collectors->insert([$id, $template], [$priority, --$order]);
|
||||
}
|
||||
|
||||
$templates = [];
|
||||
foreach ($collectors as $collector) {
|
||||
$definition->addMethodCall('add', [new Reference($collector[0])]);
|
||||
$templates[$collector[0]] = $collector[1];
|
||||
}
|
||||
|
||||
$container->setParameter('data_collector.templates', $templates);
|
||||
}
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
/**
|
||||
* @author Ahmed TAILOULOUTE <ahmed.tailouloute@gmail.com>
|
||||
*/
|
||||
class RemoveUnusedSessionMarshallingHandlerPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasDefinition('session.marshalling_handler')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$isMarshallerDecorated = false;
|
||||
|
||||
foreach ($container->getDefinitions() as $definition) {
|
||||
$decorated = $definition->getDecoratedService();
|
||||
if (null !== $decorated && 'session.marshaller' === $decorated[0]) {
|
||||
$isMarshallerDecorated = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$isMarshallerDecorated) {
|
||||
$container->removeDefinition('session.marshalling_handler');
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class TestServiceContainerRealRefPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasDefinition('test.private_services_locator')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$privateContainer = $container->getDefinition('test.private_services_locator');
|
||||
$definitions = $container->getDefinitions();
|
||||
$privateServices = $privateContainer->getArgument(0);
|
||||
$renamedIds = [];
|
||||
|
||||
foreach ($privateServices as $id => $argument) {
|
||||
if (isset($definitions[$target = (string) $argument->getValues()[0]])) {
|
||||
$argument->setValues([new Reference($target)]);
|
||||
if ($id !== $target) {
|
||||
$renamedIds[$id] = $target;
|
||||
}
|
||||
if ($inner = $definitions[$target]->getTag('container.decorator')[0]['inner'] ?? null) {
|
||||
$renamedIds[$id] = $inner;
|
||||
}
|
||||
} else {
|
||||
unset($privateServices[$id]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($container->getAliases() as $id => $target) {
|
||||
while ($container->hasAlias($target = (string) $target)) {
|
||||
$target = $container->getAlias($target);
|
||||
}
|
||||
|
||||
if ($definitions[$target]->hasTag('container.private')) {
|
||||
$privateServices[$id] = new ServiceClosureArgument(new Reference($target));
|
||||
}
|
||||
|
||||
$renamedIds[$id] = $target;
|
||||
}
|
||||
|
||||
$privateContainer->replaceArgument(0, $privateServices);
|
||||
|
||||
if ($container->hasDefinition('test.service_container') && $renamedIds) {
|
||||
$container->getDefinition('test.service_container')->setArgument(2, $renamedIds);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class TestServiceContainerWeakRefPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasDefinition('test.private_services_locator')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$privateServices = [];
|
||||
$definitions = $container->getDefinitions();
|
||||
|
||||
foreach ($definitions as $id => $definition) {
|
||||
if ($id && '.' !== $id[0] && (!$definition->isPublic() || $definition->isPrivate() || $definition->hasTag('container.private')) && !$definition->hasErrors() && !$definition->isAbstract()) {
|
||||
$privateServices[$id] = new Reference($id, ContainerBuilder::IGNORE_ON_UNINITIALIZED_REFERENCE);
|
||||
}
|
||||
}
|
||||
|
||||
$aliases = $container->getAliases();
|
||||
|
||||
foreach ($aliases as $id => $alias) {
|
||||
if ($id && '.' !== $id[0] && (!$alias->isPublic() || $alias->isPrivate())) {
|
||||
while (isset($aliases[$target = (string) $alias])) {
|
||||
$alias = $aliases[$target];
|
||||
}
|
||||
if (isset($definitions[$target]) && !$definitions[$target]->hasErrors() && !$definitions[$target]->isAbstract()) {
|
||||
$privateServices[$id] = new Reference($target, ContainerBuilder::IGNORE_ON_UNINITIALIZED_REFERENCE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($privateServices) {
|
||||
$id = (string) ServiceLocatorTagPass::register($container, $privateServices);
|
||||
$container->setDefinition('test.private_services_locator', $container->getDefinition($id))->setPublic(true);
|
||||
$container->removeDefinition($id);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
class TranslationUpdateCommandPass implements CompilerPassInterface
|
||||
{
|
||||
public function process(ContainerBuilder $container): void
|
||||
{
|
||||
if (!$container->hasDefinition('console.command.translation_extract')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$translationWriterClass = $container->getParameterBag()->resolveValue($container->findDefinition('translation.writer')->getClass());
|
||||
|
||||
if (!method_exists($translationWriterClass, 'getFormats')) {
|
||||
$container->removeDefinition('console.command.translation_extract');
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
/**
|
||||
* Find all service tags which are defined, but not used and yield a warning log message.
|
||||
*
|
||||
* @author Florian Pfitzer <pfitzer@wurzel3.de>
|
||||
*/
|
||||
class UnusedTagsPass implements CompilerPassInterface
|
||||
{
|
||||
private const KNOWN_TAGS = [
|
||||
'annotations.cached_reader',
|
||||
'assets.package',
|
||||
'asset_mapper.compiler',
|
||||
'auto_alias',
|
||||
'cache.pool',
|
||||
'cache.pool.clearer',
|
||||
'cache.taggable',
|
||||
'chatter.transport_factory',
|
||||
'config_cache.resource_checker',
|
||||
'console.command',
|
||||
'container.do_not_inline',
|
||||
'container.env_var_loader',
|
||||
'container.env_var_processor',
|
||||
'container.excluded',
|
||||
'container.hot_path',
|
||||
'container.no_preload',
|
||||
'container.preload',
|
||||
'container.private',
|
||||
'container.reversible',
|
||||
'container.service_locator',
|
||||
'container.service_locator_context',
|
||||
'container.service_subscriber',
|
||||
'container.stack',
|
||||
'controller.argument_value_resolver',
|
||||
'controller.service_arguments',
|
||||
'controller.targeted_value_resolver',
|
||||
'data_collector',
|
||||
'event_dispatcher.dispatcher',
|
||||
'form.type',
|
||||
'form.type_extension',
|
||||
'form.type_guesser',
|
||||
'html_sanitizer',
|
||||
'http_client.client',
|
||||
'kernel.cache_clearer',
|
||||
'kernel.cache_warmer',
|
||||
'kernel.event_listener',
|
||||
'kernel.event_subscriber',
|
||||
'kernel.fragment_renderer',
|
||||
'kernel.locale_aware',
|
||||
'kernel.reset',
|
||||
'ldap',
|
||||
'mailer.transport_factory',
|
||||
'messenger.bus',
|
||||
'messenger.message_handler',
|
||||
'messenger.receiver',
|
||||
'messenger.transport_factory',
|
||||
'mime.mime_type_guesser',
|
||||
'monolog.logger',
|
||||
'notifier.channel',
|
||||
'property_info.access_extractor',
|
||||
'property_info.initializable_extractor',
|
||||
'property_info.list_extractor',
|
||||
'property_info.type_extractor',
|
||||
'proxy',
|
||||
'remote_event.consumer',
|
||||
'routing.condition_service',
|
||||
'routing.expression_language_function',
|
||||
'routing.expression_language_provider',
|
||||
'routing.loader',
|
||||
'routing.route_loader',
|
||||
'scheduler.schedule_provider',
|
||||
'scheduler.task',
|
||||
'security.authenticator.login_linker',
|
||||
'security.expression_language_provider',
|
||||
'security.remember_me_handler',
|
||||
'security.voter',
|
||||
'serializer.encoder',
|
||||
'serializer.normalizer',
|
||||
'texter.transport_factory',
|
||||
'translation.dumper',
|
||||
'translation.extractor',
|
||||
'translation.extractor.visitor',
|
||||
'translation.loader',
|
||||
'translation.provider_factory',
|
||||
'twig.extension',
|
||||
'twig.loader',
|
||||
'twig.runtime',
|
||||
'validator.auto_mapper',
|
||||
'validator.constraint_validator',
|
||||
'validator.group_provider',
|
||||
'validator.initializer',
|
||||
'workflow',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
$tags = array_unique(array_merge($container->findTags(), self::KNOWN_TAGS));
|
||||
|
||||
foreach ($container->findUnusedTags() as $tag) {
|
||||
// skip known tags
|
||||
if (\in_array($tag, self::KNOWN_TAGS)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// check for typos
|
||||
$candidates = [];
|
||||
foreach ($tags as $definedTag) {
|
||||
if ($definedTag === $tag) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (str_contains($definedTag, $tag) || levenshtein($tag, $definedTag) <= \strlen($tag) / 3) {
|
||||
$candidates[] = $definedTag;
|
||||
}
|
||||
}
|
||||
|
||||
$services = array_keys($container->findTaggedServiceIds($tag));
|
||||
$message = sprintf('Tag "%s" was defined on service(s) "%s", but was never used.', $tag, implode('", "', $services));
|
||||
if ($candidates) {
|
||||
$message .= sprintf(' Did you mean "%s"?', implode('", "', $candidates));
|
||||
}
|
||||
|
||||
$container->log($this, $message);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Exception\LogicException;
|
||||
|
||||
trigger_deprecation('symfony/framework-bundle', '6.4', 'The "%s" class is deprecated, use "%s" instead.', WorkflowGuardListenerPass::class, \Symfony\Component\Workflow\DependencyInjection\WorkflowGuardListenerPass::class);
|
||||
|
||||
/**
|
||||
* @author Christian Flothmann <christian.flothmann@sensiolabs.de>
|
||||
* @author Grégoire Pineau <lyrixx@lyrixx.info>
|
||||
*
|
||||
* @deprecated since Symfony 6.4, use Symfony\Component\Workflow\DependencyInjection\WorkflowGuardListenerPass instead.
|
||||
*/
|
||||
class WorkflowGuardListenerPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasParameter('workflow.has_guard_listeners')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$container->getParameterBag()->remove('workflow.has_guard_listeners');
|
||||
|
||||
$servicesNeeded = [
|
||||
'security.token_storage',
|
||||
'security.authorization_checker',
|
||||
'security.authentication.trust_resolver',
|
||||
'security.role_hierarchy',
|
||||
];
|
||||
|
||||
foreach ($servicesNeeded as $service) {
|
||||
if (!$container->has($service)) {
|
||||
throw new LogicException(sprintf('The "%s" service is needed to be able to use the workflow guard listener.', $service));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
2600
plugins/simplesaml/lib/vendor/symfony/framework-bundle/DependencyInjection/Configuration.php
vendored
Normal file
2600
plugins/simplesaml/lib/vendor/symfony/framework-bundle/DependencyInjection/Configuration.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3230
plugins/simplesaml/lib/vendor/symfony/framework-bundle/DependencyInjection/FrameworkExtension.php
vendored
Normal file
3230
plugins/simplesaml/lib/vendor/symfony/framework-bundle/DependencyInjection/FrameworkExtension.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
class VirtualRequestStackPass implements CompilerPassInterface
|
||||
{
|
||||
public function process(ContainerBuilder $container): void
|
||||
{
|
||||
if ($container->has('.virtual_request_stack')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($container->hasDefinition('debug.event_dispatcher')) {
|
||||
$container->getDefinition('debug.event_dispatcher')->replaceArgument(3, new Reference('request_stack', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
|
||||
}
|
||||
|
||||
if ($container->hasDefinition('debug.log_processor')) {
|
||||
$container->getDefinition('debug.log_processor')->replaceArgument(0, new Reference('request_stack'));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user