Ajout des vendor
This commit is contained in:
47
vendor/symfony/framework-bundle/DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php
vendored
Normal file
47
vendor/symfony/framework-bundle/DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php
vendored
Normal file
@ -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\Argument\ServiceClosureArgument;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class AddAnnotationsCachedReaderPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
// "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);
|
||||
$reader->setPublic(false);
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
43
vendor/symfony/framework-bundle/DependencyInjection/Compiler/AddDebugLogProcessorPass.php
vendored
Normal file
43
vendor/symfony/framework-bundle/DependencyInjection/Compiler/AddDebugLogProcessorPass.php
vendored
Normal file
@ -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\DependencyInjection\Reference;
|
||||
|
||||
class AddDebugLogProcessorPass implements CompilerPassInterface
|
||||
{
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasDefinition('profiler')) {
|
||||
return;
|
||||
}
|
||||
if (!$container->hasDefinition('monolog.logger_prototype')) {
|
||||
return;
|
||||
}
|
||||
if (!$container->hasDefinition('debug.log_processor')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$definition = $container->getDefinition('monolog.logger_prototype');
|
||||
$definition->setConfigurator([__CLASS__, 'configureLogger']);
|
||||
$definition->addMethodCall('pushProcessor', [new Reference('debug.log_processor')]);
|
||||
}
|
||||
|
||||
public static function configureLogger($logger)
|
||||
{
|
||||
if (\is_object($logger) && method_exists($logger, 'removeDebugLogger') && \in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) {
|
||||
$logger->removeDebugLogger();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* Registers the expression language providers.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class AddExpressionLanguageProvidersPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
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)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
44
vendor/symfony/framework-bundle/DependencyInjection/Compiler/AssetsContextPass.php
vendored
Normal file
44
vendor/symfony/framework-bundle/DependencyInjection/Compiler/AssetsContextPass.php
vendored
Normal file
@ -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;
|
||||
|
||||
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
|
||||
{
|
||||
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']));
|
||||
}
|
||||
}
|
||||
}
|
35
vendor/symfony/framework-bundle/DependencyInjection/Compiler/ContainerBuilderDebugDumpPass.php
vendored
Normal file
35
vendor/symfony/framework-bundle/DependencyInjection/Compiler/ContainerBuilderDebugDumpPass.php
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
<?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
|
||||
{
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
$cache = new ConfigCache($container->getParameter('debug.container.dump'), true);
|
||||
if (!$cache->isFresh()) {
|
||||
$cache->write((new XmlDumper($container))->dump(), $container->getResources());
|
||||
}
|
||||
}
|
||||
}
|
35
vendor/symfony/framework-bundle/DependencyInjection/Compiler/DataCollectorTranslatorPass.php
vendored
Normal file
35
vendor/symfony/framework-bundle/DependencyInjection/Compiler/DataCollectorTranslatorPass.php
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
<?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 Christian Flothmann <christian.flothmann@sensiolabs.de>
|
||||
*/
|
||||
class DataCollectorTranslatorPass implements CompilerPassInterface
|
||||
{
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->has('translator')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$translatorClass = $container->getParameterBag()->resolveValue($container->findDefinition('translator')->getClass());
|
||||
|
||||
if (!is_subclass_of($translatorClass, 'Symfony\Component\Translation\TranslatorBagInterface')) {
|
||||
$container->removeDefinition('translator.data_collector');
|
||||
$container->removeDefinition('data_collector.translation');
|
||||
}
|
||||
}
|
||||
}
|
54
vendor/symfony/framework-bundle/DependencyInjection/Compiler/LoggingTranslatorPass.php
vendored
Normal file
54
vendor/symfony/framework-bundle/DependencyInjection/Compiler/LoggingTranslatorPass.php
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* @author Abdellatif Ait boudad <a.aitboudad@gmail.com>
|
||||
*/
|
||||
class LoggingTranslatorPass implements CompilerPassInterface
|
||||
{
|
||||
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']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
62
vendor/symfony/framework-bundle/DependencyInjection/Compiler/ProfilerPass.php
vendored
Normal file
62
vendor/symfony/framework-bundle/DependencyInjection/Compiler/ProfilerPass.php
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
<?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
|
||||
{
|
||||
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();
|
||||
$isTemplateAware = is_subclass_of($collectorClass, TemplateAwareDataCollectorInterface::class);
|
||||
if (isset($attributes[0]['template']) || $isTemplateAware) {
|
||||
$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,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;
|
||||
|
||||
/**
|
||||
* @author Ahmed TAILOULOUTE <ahmed.tailouloute@gmail.com>
|
||||
*/
|
||||
class RemoveUnusedSessionMarshallingHandlerPass implements CompilerPassInterface
|
||||
{
|
||||
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');
|
||||
}
|
||||
}
|
||||
}
|
72
vendor/symfony/framework-bundle/DependencyInjection/Compiler/SessionPass.php
vendored
Normal file
72
vendor/symfony/framework-bundle/DependencyInjection/Compiler/SessionPass.php
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
<?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 to be removed in 6.0
|
||||
*/
|
||||
class SessionPass implements CompilerPassInterface
|
||||
{
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->has('session.factory')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// BC layer: Make "session" an alias of ".session.do-not-use" when not overridden by the user
|
||||
if (!$container->has('session')) {
|
||||
$alias = $container->setAlias('session', '.session.do-not-use');
|
||||
$alias->setDeprecated('symfony/framework-bundle', '5.3', 'The "%alias_id%" service and "SessionInterface" alias are deprecated, use "$requestStack->getSession()" instead.');
|
||||
// restore previous behavior
|
||||
$alias->setPublic(true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($container->hasDefinition('session')) {
|
||||
$definition = $container->getDefinition('session');
|
||||
$definition->setDeprecated('symfony/framework-bundle', '5.3', 'The "%service_id%" service and "SessionInterface" alias are deprecated, use "$requestStack->getSession()" instead.');
|
||||
} else {
|
||||
$alias = $container->getAlias('session');
|
||||
$alias->setDeprecated('symfony/framework-bundle', '5.3', 'The "%alias_id%" and "SessionInterface" aliases are deprecated, use "$requestStack->getSession()" instead.');
|
||||
$definition = $container->findDefinition('session');
|
||||
}
|
||||
|
||||
// Convert internal service `.session.do-not-use` into alias of `session`.
|
||||
$container->setAlias('.session.do-not-use', 'session');
|
||||
|
||||
$bags = [
|
||||
'session.flash_bag' => $container->hasDefinition('session.flash_bag') ? $container->getDefinition('session.flash_bag') : null,
|
||||
'session.attribute_bag' => $container->hasDefinition('session.attribute_bag') ? $container->getDefinition('session.attribute_bag') : null,
|
||||
];
|
||||
|
||||
foreach ($definition->getArguments() as $v) {
|
||||
if (!$v instanceof Reference || !isset($bags[$bag = (string) $v]) || !\is_array($factory = $bags[$bag]->getFactory())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ([0, 1] !== array_keys($factory) || !$factory[0] instanceof Reference || !\in_array((string) $factory[0], ['session', '.session.do-not-use'], true)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ('get'.ucfirst(substr($bag, 8, -4)).'Bag' !== $factory[1]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$bags[$bag]->setFactory(null);
|
||||
}
|
||||
}
|
||||
}
|
43
vendor/symfony/framework-bundle/DependencyInjection/Compiler/TestServiceContainerRealRefPass.php
vendored
Normal file
43
vendor/symfony/framework-bundle/DependencyInjection/Compiler/TestServiceContainerRealRefPass.php
vendored
Normal file
@ -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\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class TestServiceContainerRealRefPass implements CompilerPassInterface
|
||||
{
|
||||
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);
|
||||
|
||||
foreach ($privateServices as $id => $argument) {
|
||||
if (isset($definitions[$target = (string) $argument->getValues()[0]])) {
|
||||
$argument->setValues([new Reference($target)]);
|
||||
} else {
|
||||
unset($privateServices[$id]);
|
||||
}
|
||||
}
|
||||
|
||||
$privateContainer->replaceArgument(0, $privateServices);
|
||||
}
|
||||
}
|
71
vendor/symfony/framework-bundle/DependencyInjection/Compiler/TestServiceContainerWeakRefPass.php
vendored
Normal file
71
vendor/symfony/framework-bundle/DependencyInjection/Compiler/TestServiceContainerWeakRefPass.php
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
<?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\Definition;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class TestServiceContainerWeakRefPass implements CompilerPassInterface
|
||||
{
|
||||
private $privateTagName;
|
||||
|
||||
public function __construct(string $privateTagName = 'container.private')
|
||||
{
|
||||
if (0 < \func_num_args()) {
|
||||
trigger_deprecation('symfony/framework-bundle', '5.3', 'Configuring "%s" is deprecated.', __CLASS__);
|
||||
}
|
||||
|
||||
$this->privateTagName = $privateTagName;
|
||||
}
|
||||
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasDefinition('test.private_services_locator')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$privateServices = [];
|
||||
$definitions = $container->getDefinitions();
|
||||
$hasErrors = method_exists(Definition::class, 'hasErrors') ? 'hasErrors' : 'getErrors';
|
||||
|
||||
foreach ($definitions as $id => $definition) {
|
||||
if ($id && '.' !== $id[0] && (!$definition->isPublic() || $definition->isPrivate() || $definition->hasTag($this->privateTagName)) && !$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);
|
||||
}
|
||||
}
|
||||
}
|
128
vendor/symfony/framework-bundle/DependencyInjection/Compiler/UnusedTagsPass.php
vendored
Normal file
128
vendor/symfony/framework-bundle/DependencyInjection/Compiler/UnusedTagsPass.php
vendored
Normal file
@ -0,0 +1,128 @@
|
||||
<?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',
|
||||
'auto_alias',
|
||||
'cache.pool',
|
||||
'cache.pool.clearer',
|
||||
'chatter.transport_factory',
|
||||
'config_cache.resource_checker',
|
||||
'console.command',
|
||||
'container.env_var_loader',
|
||||
'container.env_var_processor',
|
||||
'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',
|
||||
'data_collector',
|
||||
'event_dispatcher.dispatcher',
|
||||
'form.type',
|
||||
'form.type_extension',
|
||||
'form.type_guesser',
|
||||
'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',
|
||||
'routing.expression_language_function',
|
||||
'routing.expression_language_provider',
|
||||
'routing.loader',
|
||||
'routing.route_loader',
|
||||
'security.authenticator.login_linker',
|
||||
'security.expression_language_provider',
|
||||
'security.remember_me_aware',
|
||||
'security.remember_me_handler',
|
||||
'security.voter',
|
||||
'serializer.encoder',
|
||||
'serializer.normalizer',
|
||||
'texter.transport_factory',
|
||||
'translation.dumper',
|
||||
'translation.extractor',
|
||||
'translation.loader',
|
||||
'translation.provider_factory',
|
||||
'twig.extension',
|
||||
'twig.loader',
|
||||
'twig.runtime',
|
||||
'validator.auto_mapper',
|
||||
'validator.constraint_validator',
|
||||
'validator.initializer',
|
||||
];
|
||||
|
||||
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 (!empty($candidates)) {
|
||||
$message .= sprintf(' Did you mean "%s"?', implode('", "', $candidates));
|
||||
}
|
||||
|
||||
$container->log($this, $message);
|
||||
}
|
||||
}
|
||||
}
|
48
vendor/symfony/framework-bundle/DependencyInjection/Compiler/WorkflowGuardListenerPass.php
vendored
Normal file
48
vendor/symfony/framework-bundle/DependencyInjection/Compiler/WorkflowGuardListenerPass.php
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* @author Christian Flothmann <christian.flothmann@sensiolabs.de>
|
||||
* @author Grégoire Pineau <lyrixx@lyrixx.info>
|
||||
*/
|
||||
class WorkflowGuardListenerPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user