 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\Component\DependencyInjection\Argument;

use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;

/**
 * Represents an environment variable presented as an invokable and Stringable wrapper.
 *
 * @author Nicolas Grekas <p@tchwork.com>
 */
class EnvClosureArgu

ingable && !\is_string($default ?? '')) {
            throw new InvalidArgumentException('The default value of a stringable EnvClosureArgument must be a string or null.');
        }
    }

    public function getValue(): string
    {
        return $this->

ment implements ArgumentInterface
{
    use ArgumentTrait;

    public function __construct(
        private string $value,
        private mixed $default = null,
        private bool $stringable = false,
    ) {
        if ($str


ge.
 *
 * (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\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

/**
 * Removes unused service definitions from the container.
 *
 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
 * @author Nicolas Grekas <p@tchw

ions.
     */
    public function process(ContainerBuilder $container): void
    {
        try {
            $this->enableExpressionProcessing();
            $this->container = $container;
            $connectedIds = [];
            $aliases = $container->

ork.com>
 */
class RemoveUnusedDefinitionsPass extends AbstractRecursivePass
{
    protected bool $skipScalars = true;

    private array $connectedIds = [];

    /**
     * Processes the ContainerBuilder to remove unused definit


/*
 * 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\Component\DependencyInjection\Argument;

/**
 * Represents a collection of values to lazily iterate over.
 *
 * @author Titouan Galopin <galopintitouan@gmail.com>
 */
class IteratorArgument implements ArgumentInterface
{
    use ArgumentTrait;

    private arra

  public function __construct(array $values)
    {
        $this->setValues($values);
    }

    public function getValues(): array
    {
        return $this->values;
    }

    public function setValues(array $values): void
    {
        $this->values =


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\DependencyInjection\Argument;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\VarExporter\ProxyHelper;

/**
 * @

  }

    public function __get(mixed $name): mixed
    {
        if ('service' !== $name) {
            throw new InvalidArgumentException(\sprintf('Cannot read property "%s" from a lazy closure.', $name));
        }

        if (isset($this->initializer))

author Nicolas Grekas <p@tchwork.com>
 *
 * @internal
 */
class LazyClosure
{
    public readonly object $service;

    public function __construct(
        private \Closure $initializer,
    ) {
        unset($this->service);


ony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\DependencyInjection\Argument;

/**
 * @internal
 */
class RewindableGenerator implements \IteratorAggregate, \Countable
{
    private \Closure $generator;
    private \Closure|int $count;

    public function __construct(callable $generator, int|callable $count)
    {
        $this->generator = $generator(...);
        $this->count = \is_

c function getIterator(): \Traversable
    {
        $g = $this->generator;

        return $g();
    }

    public function count(): int
    {
        if (!\is_int($count = $this->count)) {
            $this->count = $count();
        }

        return $t

int($count) ? $count : $count(...);
    }

    publi


?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\Component\DependencyInjection\Argument;

use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;

/**
 * Represents a service wrapped in a memoizing closure.
 *
 * @author Nicolas Grekas <p@tchwork.com>
 */
class ServiceClosureArgument

 return $this->values;
    }

    public function setValues(array $values): void
    {
        if ([0] !== array_keys($values)) {
            throw new InvalidArgumentException('A ServiceClosureArgument must hold one and only one value.');
        }

 implements ArgumentInterface
{
    use ArgumentTrait;

    private array $values;

    public function __construct(mixed $value)
    {
        $this->values = [$value];
    }

    public function getValues(): array
    {


ge.
 *
 * (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\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Definition;
use Symfony\Contracts\Service\Attribute\Required;

/**
 * Looks for definitions with autowiring enabled and registers their corresponding "#[Required]" methods as setters.
 *
 * @author Nicolas Grekas <p@tchwork.

cessValue($value, $isRoot);

        if (!$value instanceof Definition || !$value->isAutowired() || $value->isAbstract() || !$value->getClass()) {
            return $value;
        }
        if (!$reflectionClass = $this->container->getReflectionClass($va

com>
 */
class AutowireRequiredMethodsPass extends AbstractRecursivePass
{
    protected bool $skipScalars = true;

    protected function processValue(mixed $value, bool $isRoot = false): mixed
    {
        $value = parent::pro


ge.
 *
 * (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\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;

/**
 * This pass validates aliases, it provides the following checks:
 *
 * - An alias which happens to be an interface must resolve to

ilder $container): void
    {
        foreach ($container->getAliases() as $id => $alias) {
            try {
                if ($alias->isDeprecated() || !$container->hasDefinition((string) $alias)) {
                    continue;
                }

 a service implementing this interface. This ensures injecting the aliased interface won't cause a type error at runtime.
 */
class CheckAliasValidityPass implements CompilerPassInterface
{
    public function process(ContainerBu


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;

/**
 * Checks if arguments of methods are properly configured.
 *
 * @author Kévin Dunglas <dunglas@gmail.com>
 * @author Nicolas Grekas <p@tchwork.com>
 */
class CheckArgumentsValidityPass ex

 false): mixed
    {
        if (!$value instanceof Definition) {
            return parent::processValue($value, $isRoot);
        }

        $i = 0;
        $hasNamedArgs = false;
        foreach ($value->getArguments() as $k => $v) {
            if (pre

tends AbstractRecursivePass
{
    protected bool $skipScalars = true;

    public function __construct(
        private bool $throwExceptions = true,
    ) {
    }

    protected function processValue(mixed $value, bool $isRoot =


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\EnvParameterException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;

/**
 * This pass validates each definition individually only taking the information
 * into account which is co

ic services are always public
 *
 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
 */
class CheckDefinitionValidityPass implements CompilerPassInterface
{
    /**
     * Processes the ContainerBuilder to validate the Definition.
     *
     * @throws

ntained in the definition itself.
 *
 * Later passes can rely on the following, and specifically do not need to
 * perform these checks themselves:
 *
 * - non synthetic, non abstract services always have a class set
 * - synthet


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException;
use Symfony\Component\DependencyInjection\Reference;

/**
 * Detects cycles where a service's factory is `[Definitio

 * before deferred edges fire, but a factory consumes the builder's state at call
 * time: deferring $b's setup until after `$b->method(...)` would feed the factory
 * an unconfigured builder. The cycle is unresolvable; bail out instead of letting
 * the

n $b, $method]` and $b's
 * own properties/method calls/configurator transitively require that same service
 * through constructor references.
 *
 * The soft-circular instantiation pattern relies on storing the service's instance


 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\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\Reference;

/**
 * Checks the validity of references.
 *
 * The following

lars = true;

    protected function processValue(mixed $value, bool $isRoot = false): mixed
    {
        if ($isRoot && $value instanceof Definition && ($value->isSynthetic() || $value->isAbstract())) {
            return $value;
        }
        if ($v

checks are performed by this pass:
 * - target definitions are not abstract
 *
 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
 */
class CheckReferenceValidityPass extends AbstractRecursivePass
{
    protected bool $skipSca


buted with this source code.
 */

namespace Symfony\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
use Symfony\Component\DependencyInjection\Reference;

/**
 * Overwrites a service but keeps

Pass
{
    protected bool $skipScalars = true;

    public function process(ContainerBuilder $container): void
    {
        $definitions = new \SplPriorityQueue();
        $order = \PHP_INT_MAX;

        foreach ($container->getDefinitions() as $id => $de

the overridden one.
 *
 * @author Christophe Coevoet <stof@notk.org>
 * @author Fabien Potencier <fabien@symfony.com>
 * @author Diego Saint Esteben <diego@saintesteben.me>
 */
class DecoratorServicePass extends AbstractRecursive


 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\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\ContainerBuilder;

/**
 * A pass to automatically process extensions if they implement
 * CompilerPassInterface.
 *
 * @author Wouter J <wouter@wouterj.nl>
 */
class ExtensionCompilerPass im

 process(ContainerBuilder $container): void
    {
        foreach ($container->getExtensions() as $extension) {
            if (!$extension instanceof CompilerPassInterface) {
                continue;
            }

            $extension->process($contai

plements CompilerPassInterface
{
    public function


buted with this source code.
 */

namespace Symfony\Component\DependencyInjection\Compiler;

use Symfony\Component\Config\Definition\BaseNode;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\Extension\ConfigurationExtensionInterface;
use Sy

\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;

/**
 * Merges extension configs into the container builder.
 *
 * @author Fabien Potencier <fabien@symfony.com>
 */

mfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component


tion\Attribute\AsTaggedItem;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\TypedReference;

/**
 * Trait that allows a generic method to find and sort service by priority option in the tag.
 *
 * @author Iltar van der Berg <kjarli@gmail.com>
 */
trait PriorityTaggedServiceTrait
{
    /**
     * Finds all services with the g

    * we should not use that class.
     *
     * @see https://bugs.php.net/53710
     * @see https://bugs.php.net/60926
     *
     * @return Reference[]
     */
    private function findAndSortTaggedServices(string|TaggedIteratorArgument $tagName, Contai

iven tag name and order them by their priority.
     *
     * The order of additions must be respected for services having the same priority,
     * and knowing that the \SplPriorityQueue class does not respect the FIFO method,


ge.
 *
 * (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\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\EnvVarProcessor;
use Symfony\Component\DependencyInjection\EnvVarProcessorInterface;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
u

 <p@tchwork.com>
 */
class RegisterEnvVarProcessorsPass implements CompilerPassInterface
{
    private const ALLOWED_TYPES = ['array', 'bool', 'float', 'int', 'string', \BackedEnum::class];

    public function process(ContainerBuilder $container): void

se Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag;
use Symfony\Component\DependencyInjection\Reference;

/**
 * Creates the container.env_var_processors_locator service.
 *
 * @author Nicolas Grekas


buted with this source code.
 */

namespace Symfony\Component\DependencyInjection\Compiler;

use Psr\Container\ContainerInterface as PsrContainerInterface;
use Symfony\Component\DependencyInjection\Argument\BoundArgument;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyIn

ceProviderInterface;
use Symfony\Contracts\Service\ServiceSubscriberInterface;

/**
 * Compiler pass to register tagged services that require a service locator.
 *
 * @author Nicolas Grekas <p@tchwork.com>
 */
class RegisterServiceSubscribersPass extends A

jection\Reference;
use Symfony\Component\DependencyInjection\TypedReference;
use Symfony\Contracts\Service\Attribute\SubscribedService;
use Symfony\Contracts\Service\ServiceCollectionInterface;
use Symfony\Contracts\Service\Servi


n 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\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\ContainerBuilder;

/**
 * Removes abstract Definitions.
 */
class RemoveAbstractDefinitionsPass implements CompilerPassInterface
{
    /**
     * Removes abstract definitions from the ContainerBuilder.
     */
    public function process(Conta

($container->getDefinitions() as $id => $definition) {
            if ($definition->isAbstract()) {
                $container->resolveEnvPlaceholders($definition);
                $container->removeDefinition($id);
                $container->log($this, \

inerBuilder $container): void
    {
        foreach


hp

/*
 * 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\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\ContainerBuilder;

/**
 * Remove private aliases from the container. They were only used to establish
 * dependencies between services, and these dependencies have been resolve

     */
    public function process(ContainerBuilder $container): void
    {
        foreach ($container->getAliases() as $id => $alias) {
            if ($alias->isPublic()) {
                continue;
            }

            $container->removeAlias($i

d in
 * one of the previous passes.
 *
 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
 */
class RemovePrivateAliasesPass implements CompilerPassInterface
{
    /**
     * Removes private aliases from the ContainerBuilder.


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
use Symfony\Component\DependencyInjection\Reference;

/**
 * Replaces aliases with actual service def

rivate array $replacements;

    /**
     * Process the Container to replace aliases with service definitions.
     *
     * @throws InvalidArgumentException if the service definition does not exist
     */
    public function process(ContainerBuilder $con

initions, effectively removing these
 * aliases.
 *
 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
 */
class ReplaceAliasByActualDefinitionPass extends AbstractRecursivePass
{
    protected bool $skipScalars = true;

    p


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Attribute\AsDecorator;
use Symfony\Component\DependencyInjection\Attribute\AsTagDecorator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Definition;

/**
 *

c function process(ContainerBuilder $container): void
    {
        foreach ($container->getDefinitions() as $id => $definition) {
            if ($this->accept($definition) && $reflectionClass = $container->getReflectionClass($definition->getClass(), fals

Reads #[AsDecorator] and #[AsTagDecorator] attributes on definitions that are autowired
 * and don't have the "container.ignore_attributes" tag.
 */
final class AutowireAsDecoratorPass implements CompilerPassInterface
{
    publi


ge.
 *
 * (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\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\DependencyInjection\Attribute\AutowireDecorated;
use Symfony\Component\DependencyInjection\Attribute\Target;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony

/**
 * Looks for definitions with autowiring enabled and registers their corresponding "#[Required]" properties.
 *
 * @author Sebastien Morel (Plopix) <morel.seb@gmail.com>
 * @author Nicolas Grekas <p@tchwork.com>
 */
class AutowireRequiredPropertiesPas

\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\TypedReference;
use Symfony\Contracts\Service\Attribute\Required;


ge.
 *
 * (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\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException;

/**
 * Checks your services for circular references.
 *
 * References from method calls are ignored since we might be

lass CheckCircularReferencesPass implements CompilerPassInterface
{
    private array $currentPath;
    private array $checkedNodes;
    private array $checkedLazyNodes;

    /**
     * Checks the ContainerBuilder object for circular references.
     */

able to resolve
 * these references depending on the order in which services are called.
 *
 * Circular reference from method calls will only be detected at run-time.
 *
 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
 */
c


t\EnvClosureArgument;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Co

encyInjection\Parameter;
use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ServiceLocator;
use Symfony\Component\ExpressionLangu

mponent\DependencyInjection\Exception\InvalidParameterTypeException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\ExpressionLanguage;
use Symfony\Component\Depend


ge.
 *
 * (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\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\EnvParameterException;

/**
 * This class is used to remove circular dependencies between individual passes.
 *
 * @author Johannes M. Schmitt <schmittjoh

PassConfig();
        $this->serviceReferenceGraph = new ServiceReferenceGraph();
    }

    public function getPassConfig(): PassConfig
    {
        return $this->passConfig;
    }

    public function getServiceReferenceGraph(): ServiceReferenceGraph

@gmail.com>
 */
class Compiler
{
    private PassConfig $passConfig;
    private array $log = [];
    private ServiceReferenceGraph $serviceReferenceGraph;

    public function __construct()
    {
        $this->passConfig = new


buted with this source code.
 */

namespace Symfony\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;

/**
 * Compiler Pass Configuration.
 *
 * This class has a default configuration embedded.
 *
 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
 */
class PassConfig
{
    // In the order of execution
    public const TYPE_BEFORE_OPTIMIZATION = 'beforeOptimization';
    public const TYPE_OPTIMIZE = 'optimization';
    public const TYPE

es;
    private array $beforeOptimizationPasses;
    private array $beforeRemovingPasses = [];
    private array $optimizationPasses;
    private array $removingPasses;

    public function __construct()
    {
        $this->mergePass = new MergeExtensionC

_BEFORE_REMOVING = 'beforeRemoving';
    public const TYPE_REMOVE = 'removing';
    public const TYPE_AFTER_REMOVING = 'afterRemoving';

    private MergeExtensionConfigurationPass $mergePass;
    private array $afterRemovingPass


ge.
 *
 * (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\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Com

    ) {
    }

    public function process(ContainerBuilder $container): void
    {
        if (!$container->hasDefinition('reverse_container')) {
            return;
        }

        $refType = $this->beforeRemoving ? ContainerInterface::IGNORE_ON_UNIN

ponent\DependencyInjection\Reference;

/**
 * @author Nicolas Grekas <p@tchwork.com>
 */
class RegisterReverseContainerPass implements CompilerPassInterface
{
    public function __construct(
        private bool $beforeRemoving,


 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\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\ContainerBuilder;

class RemoveBuildParametersPass implements CompilerPassInterface
{
    /**
     * @var array<string, mixed>
     */
    private array $removedParameters = [];

    public function

rs = [];

        foreach ($parameterBag->all() as $name => $value) {
            if ('.' !== ($name[0] ?? '')) {
                continue;
            }
            if (!$this->preserveArrays || !\is_array($value)) {
                $this->removedParamete

 __construct(
        private bool $preserveArrays = false,
    ) {
    }

    public function process(ContainerBuilder $container): void
    {
        $parameterBag = $container->getParameterBag();
        $this->removedParamete


   private array $ambiguousServiceTypes;
    private array $autowiringAliases;
    private ?string $lastFailure = null;
    private ?string $decoratedClass = null;
    private ?string $decoratedId = null;
    private object $defaultArgument;
    private ?\Closure $restorePreviousValue = null;
    private ?self $typesClone = null;

    public function __construct(
        private bool $throwOnAutowiringException = true,
    ) {
        $this->defaultArgument = new class {
            public $value;

$parameter->getDefaultValue());

                return $clone;
            }
        };
    }

    public function process(ContainerBuilder $container): void
    {
        $this->defaultArgument->bag = $container->getParameterBag();

        try {

   public $names;
            public $bag;

            public function withValue(\ReflectionParameter $parameter): self
            {
                $clone = clone $this;
                $clone->value = $this->bag->escapeValue(


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
use Symfony\Component\DependencyInjection\Reference;

/**
 * Checks that all references are pointing to a valid servi

Ids = [];

    public function process(ContainerBuilder $container): void
    {
        $this->serviceLocatorContextIds = [];
        foreach ($container->findTaggedServiceIds('container.service_locator_context') as $id => $tags) {
            $this->servi

ce.
 *
 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
 */
class CheckExceptionOnInvalidReferenceBehaviorPass extends AbstractRecursivePass
{
    protected bool $skipScalars = true;

    private array $serviceLocatorContext


/*
 * 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\Component\DependencyInjection\Argument;

use Symfony\Component\DependencyInjection\ServiceLocator as BaseServiceLocator;

/**
 * @author Nicolas Grekas <p@tchwork.com>
 *
 * @internal
 */
class ServiceLocator extends BaseServiceLocator
{
    public function __co

        return match (\count($this->serviceMap[$id] ?? [])) {
            0 => parent::get($id),
            1 => $this->serviceMap[$id][0],
            default => ($this->factory)(...$this->serviceMap[$id]),
        };
    }

    public function getProvi

nstruct(
        private \Closure $factory,
        private array $serviceMap,
        private ?array $serviceTypes = null,
    ) {
        parent::__construct($serviceMap);
    }

    public function get(string $id): mixed
    {


 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\Component\DependencyInjection\Tests\Fixtures;

use Symfony\Component\DependencyInjection\Tests\Fixtures\Attribute\CustomAnyAttribute;
use Symfony\Component\DependencyInjection\Tests\Fixtures\Attribute\CustomMethodAttribute;
use Symfony\Component\DependencyInjection\Tests\Fixtures\

ribute(someAttribute: "on name")]
    public string $name;

    public function __construct(
        #[CustomAnyAttribute]
        #[CustomParameterAttribute(someAttribute: "on param1 in constructor")]
        private string $param1,
        #[CustomAnyAtt

Attribute\CustomPropertyAttribute;
use Symfony\Component\DependencyInjection\Tests\Fixtures\Attribute\CustomParameterAttribute;

#[CustomAnyAttribute]
final class TaggedService4
{
    #[CustomAnyAttribute]
    #[CustomPropertyAtt


use Symfony\Contracts\Service\Attribute\SubscribedService;
use Symfony\Contracts\Service\ServiceMethodsSubscriberTrait;

class TestServiceSubscriberChild extends TestServiceSubscriberParent
{
    use ServiceMethodsSubscriberTrait;
    use TestServiceMethodsSubscriberTrait;

    #[SubscribedService]
    private function testDefinition2(): ?TestDefinition2
    {
        return $this->container->get(__METHOD__);
    }

    #[SubscribedService('custom_name')]
    private function testDefinition3(): TestDefini

stom_name');
    }

    #[SubscribedService]
    private function invalidDefinition(): InvalidDefinition
    {
        return $this->container->get(__METHOD__);
    }

    private function privateFunction1(): string
    {
    }

    private function privat

tion3
    {
        return $this->container->get('cu


ependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;

/**
 * @internal This class has been auto-genera

ion __construct()
    {
        $this->services = $this->privates = [];
        $this->methodMap = [
            'Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\ListenerResolver' => 'getListenerResolverService',
        ];

        $this->aliase

ted by the Symfony Dependency Injection Component.
 */
class Symfony_DI_PhpDumper_Test_AutowireCallable_With_ServiceLocator extends Container
{
    protected $parameters = [];
    protected \Closure $getService;

    public funct


y\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;

/**
 * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
 */
class Symfony_DI_PhpDumper_Test_Autowire_Closur

 [
            'bar' => 'getBarService',
            'baz' => 'getBazService',
            'foo' => 'getFooService',
            'my_callable' => 'getMyCallableService',
        ];

        $this->aliases = [];
    }

    public function compile(): void

e extends Container
{
    protected $parameters = [];

    public function __construct()
    {
        $this->parameters = $this->getDefaultParameters();

        $this->services = $this->privates = [];
        $this->methodMap =


ent\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\Paramete

meters = [];

    public function __construct()
    {
        $this->services = $this->privates = [];
        $this->methodMap = [
            'bar' => 'getBarService',
        ];

        $this->aliases = [];
    }

    public function compile(): void

rBag\ParameterBagInterface;

/**
 * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
 */
class Symfony_DI_PhpDumper_Test_Callable_Adapter_Consumer extends Container
{
    protected $para


gument\RewindableGenerator;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface

        $this->services = $this->privates = [];
        $this->methodMap = [
            'closure' => 'getClosureService',
            'closure_of_service_closure' => 'getClosureOfServiceClosureService',
        ];

        $this->aliases = [];
    }

;

/**
 * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
 */
class ProjectServiceContainer extends Container
{
    protected $parameters = [];

    public function __construct()
    {


nstruct()
    {
        $this->services = $this->privates = [];
        $this->methodMap = [
            'closure_proxy' => 'getClosureProxyService',
        ];

        $this->aliases = [];
    }

    public function compile(): void
    {
        throw ne

;

/**
 * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
 */
class Symfony_DI_PhpDumper_Test_Closure_Proxy extends Container
{
    protected $parameters = [];

    public function __co


ion\Tests\Fixtures\Container;

use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
u

omponent\DependencyInjection\Tests\Fixtures\Container\ConstructorWithoutArgumentsContainer
{
    protected $parameters = [];

    public function __construct()
    {
        parent::__construct();
        unset($this->parameterBag);

        $this->service

se Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;

/**
 * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
 */
class ProjectServiceContainer extends \Symfony\C


pace Symfony\Component\DependencyInjection\Tests\Fixtures\Container;

use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjec

jectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\ConstructorWithMandatoryArgumentsContainer
{
    protected $parameters = [];

    public function __construct()
    {
        $this->services = $this->privates = [

tion\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;

/**
 * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
 */
class Pro


omponent\DependencyInjection\Tests\Fixtures\Container\ConstructorWithOptionalArgumentsContainer
{
    protected $parameters = [];

    public function __construct()
    {
        parent::__construct();
        unset($this->parameterBag);

        $this->se


jectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\NoConstructorContainer
{
    protected $parameters = [];

    public function __construct()
    {
        $this->services = $this->privates = [];

        $this->a


y\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;

/**
 * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
 */
class Symfony_DI_PhpDumper_Test_Inline_Adapter_

odMap = [
            'Symfony\\Component\\DependencyInjection\\Tests\\Dumper\\InlineAdapterConsumer' => 'getInlineAdapterConsumerService',
            'bar' => 'getBarService',
            'foo' => 'getFooService',
        ];

        $this->aliases = [];

Consumer extends Container
{
    protected $parameters = [];

    public function __construct()
    {
        $this->parameters = $this->getDefaultParameters();

        $this->services = $this->privates = [];
        $this->meth


ction __construct()
    {
        $this->services = $this->privates = [];
        $this->methodMap = [
            'bar' => 'getBarService',
            'foo' => 'getFooService',
        ];

        $this->aliases = [];
    }

    public function compile()

;

/**
 * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
 */
class Symfony_DI_PhpDumper_Test_Lazy_Autowire_Attribute extends Container
{
    protected $parameters = [];

    public fun


     $this->methodMap = [
            'foo' => 'getFooService',
        ];

        $this->aliases = [];
    }

    public function compile(): void
    {
        throw new LogicException('You cannot compile a dumped container that was already compiled.');

ted by the Symfony Dependency Injection Component.
 */
class ProjectServiceContainer extends Container
{
    protected $parameters = [];

    public function __construct()
    {
        $this->services = $this->privates = [];


struct()
    {
        $this->services = $this->privates = [];
        $this->methodMap = [
            'closure1' => 'getClosure1Service',
            'closure2' => 'getClosure2Service',
        ];

        $this->aliases = [];
    }

    public function

;

/**
 * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
 */
class Symfony_DI_PhpDumper_Test_Lazy_Closure extends Container
{
    protected $parameters = [];

    public function __con


     $this->methodMap = [
            'from_callable' => 'getFromCallableService',
            'has_configurator' => 'getHasConfiguratorService',
            'has_factory' => 'getHasFactoryService',
            'with_closure' => 'getWithClosureService',


namespace Symfony\Component\DependencyInjection\Dump;

use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\Parameter

 \Symfony\Component\DependencyInjection\Dump\AbstractContainer
{
    protected $parameters = [];

    public function __construct()
    {
        $this->services = $this->privates = [];

        $this->aliases = [];
    }

    public function compile(): vo

Bag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;

/**
 * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
 */
class Container extends


hp

use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\Depend

 = [];

    public function __construct()
    {
        $this->services = $this->privates = [];

        $this->aliases = [];
    }

    public function compile(): void
    {
        throw new LogicException('You cannot compile a dumped container that was

encyInjection\ParameterBag\ParameterBagInterface;

/**
 * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
 */
class ProjectServiceContainer extends Container
{
    protected $parameters


ters();

        $this->services = $this->privates = [];
        $this->methodMap = [
            'test' => 'getTestService',
        ];

        $this->aliases = [];
    }

    public function compile(): void
    {
        throw new LogicException('You ca

ted by the Symfony Dependency Injection Component.
 */
class ProjectServiceContainer extends Container
{
    protected $parameters = [];

    public function __construct()
    {
        $this->parameters = $this->getDefaultParame


ction __construct()
    {
        $this->services = $this->privates = [];
        $this->methodMap = [
            'bar' => 'getBarService',
        ];

        $this->aliases = [];
    }

    public function compile(): void
    {
        throw new LogicEx

rBag\ParameterBagInterface;

/**
 * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
 */
class ProjectServiceContainer extends Container
{
    protected $parameters = [];

    public fun


ters();

        $this->services = $this->privates = [];
        $this->methodMap = [
            'service_from_anonymous_factory' => 'getServiceFromAnonymousFactoryService',
            'service_with_method_call_and_factory' => 'getServiceWithMethodCallAn


ymfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjec

   public function __construct()
    {
        $this->services = $this->privates = [];
        $this->methodMap = [
            'foo' => 'getFooService',
        ];

        $this->aliases = [];
    }

    public function compile(): void
    {
        thro

tion\ParameterBag\ParameterBagInterface;

/**
 * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
 */
class ProjectServiceContainer extends Container
{
    protected $parameters = [];


getDefaultParameters();

        $this->services = $this->privates = [];
        $this->methodMap = [
            'bar' => 'getBarService',
            'test' => 'getTestService',
        ];

        $this->aliases = [];
    }

    public function compile(

ted by the Symfony Dependency Injection Component.
 */
class Symfony_DI_PhpDumper_Test_EnvParameters extends Container
{
    protected $parameters = [];

    public function __construct()
    {
        $this->parameters = $this->


ction __construct()
    {
        $this->services = $this->privates = [];
        $this->methodMap = [
            'Bar\\Foo' => 'getFooService',
            'Foo\\Foo' => 'getFoo2Service',
        ];

        $this->aliases = [];
    }

    public functio


n;
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;

/**
 * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
 */
class ProjectServiceContainer extends Container
{
    protected $parameters = [];

    public function __construct()
    {
        $this->parameters = $this->getDefaultParameters();

        $this->services = $this->privates = [];
        $this->synthe

ce' => 'getBServiceService',
            'bar' => 'getBar3Service',
            'bar2' => 'getBar22Service',
            'baz' => 'getBazService',
            'configured_service' => 'getConfiguredServiceService',
            'configured_service_simple' =>

ticIds = [
            'request' => true,
        ];
        $this->methodMap = [
            'BAR' => 'getBARService',
            'BAR2' => 'getBAR2Service',
            'a_service' => 'getAServiceService',
            'b_servi


     $this->methodMap = [
            'App\\Bus' => 'getBusService',
            'App\\Db' => 'getDbService',
        ];

        $this->aliases = [];
    }

    public function compile(): void
    {
        throw new LogicException('You cannot compile a d


       $this->services = $this->privates = [];
        $this->methodMap = [
            'bar2' => 'getBar2Service',
            'bar3' => 'getBar3Service',
            'baz6' => 'getBaz6Service',
            'connection' => 'getConnectionService',
            'connection2' => 'getConnection2Service',
            'doctrine.entity_manager' => 'getDoctrine_EntityManagerService',
            'foo' => 'getFooService',
            'foo2' => 'getFoo2Service',
            'foo5' => 'getFoo5Service',
            'fo

anager' => 'getManagerService',
            'manager2' => 'getManager2Service',
            'manager3' => 'getManager3Service',
            'monolog.logger' => 'getMonolog_LoggerService',
            'monolog_inline.logger' => 'getMonologInline_LoggerServi

o6' => 'getFoo6Service',
            'foobar4' => 'getFoobar4Service',
            'listener3' => 'getListener3Service',
            'listener4' => 'getListener4Service',
            'logger' => 'getLoggerService',
            'm


      $this->services = $this->privates = [];
        $this->methodMap = [
            'bar' => 'getBarService',
            'bar3' => 'getBar3Service',
            'bar5' => 'getBar5Service',
            'baz6' => 'getBaz6Service',
            'connection' => 'getConnectionService',
            'connection2' => 'getConnection2Service',
            'connection3' => 'getConnection3Service',
            'connection4' => 'getConnection4Service',
            'dispatcher' => 'getDispatcherService',
            '

ctrine.listener' => 'getDoctrine_ListenerService',
            'foo' => 'getFooService',
            'foo2' => 'getFoo2Service',
            'foo4' => 'getFoo4Service',
            'foo5' => 'getFoo5Service',
            'foo6' => 'getFoo6Service',

dispatcher2' => 'getDispatcher2Service',
            'doctrine.entity_listener_resolver' => 'getDoctrine_EntityListenerResolverService',
            'doctrine.entity_manager' => 'getDoctrine_EntityManagerService',
            'do


ters();

        $this->services = $this->privates = [];
        $this->methodMap = [
            'bar' => 'getBarService',
        ];

        $this->aliases = [];
    }

    public function compile(): void
    {
        throw new LogicException('You cann


s->getDefaultParameters();

        $this->services = $this->privates = [];

        $this->aliases = [];
    }

    public function compile(): void
    {
        throw new LogicException('You cannot compile a dumped container that was already compiled.');

ted by the Symfony Dependency Injection Component.
 */
class Symfony_DI_PhpDumper_Test_Base64Parameters extends Container
{
    protected $parameters = [];

    public function __construct()
    {
        $this->parameters = $thi


        $this->services = $this->privates = [];
        $this->methodMap = [
            'foo' => 'getFooService',
            'service_closure' => 'getServiceClosureService',
            'service_closure_invalid' => 'getServiceClosureInvalidService',

;

/**
 * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
 */
class ProjectServiceContainer extends Container
{
    protected $parameters = [];

    public function __construct()
    {


getDefaultParameters();

        $this->services = $this->privates = [];

        $this->aliases = [];
    }

    public function compile(): void
    {
        throw new LogicException('You cannot compile a dumped container that was already compiled.');

ted by the Symfony Dependency Injection Component.
 */
class Symfony_DI_PhpDumper_Test_CsvParameters extends Container
{
    protected $parameters = [];

    public function __construct()
    {
        $this->parameters = $this->


unction __construct()
    {
        $this->services = $this->privates = [];
        $this->methodMap = [
            'inlined_current' => 'getInlinedCurrentService',
            'not_inlined_current' => 'getNotInlinedCurrentService',
        ];

        $t

;

/**
 * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
 */
class Symfony_DI_PhpDumper_Service_CurrentFactoryInlining extends Container
{
    protected $parameters = [];

    public f


on\Kernel\RequiredBundle;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\Filesystem\Filesystem;

class AbstractKernelTest extends TestCase
{
    private string $varDir;

    protected function setUp(): void
    {
        $this->varDir = sys_get_temp_dir().'/sf_abstract_kernel_test';
    }

    protected function tearDown(): void
    {
        (new Filesystem())->remove($this->varDir);
    }

    public function testBootBuildsAndCachesContainer()

kernel.environment'));
        $this->assertTrue($kernel->getContainer()->getParameter('kernel.debug'));
    }

    public function testBootIsIdempotent()
    {
        $kernel = $this->createKernel();
        $kernel->boot();
        $container1 = $kernel

  {
        $kernel = $this->createKernel();
        $kernel->boot();

        $this->assertInstanceOf(ContainerInterface::class, $kernel->getContainer());
        $this->assertSame('test', $kernel->getContainer()->getParameter('


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\DependencyInjection\Tests;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ChildDefinition;

class ChildDefinitionTest extends TestCase
{
    public function testConstructor()
    {
        $def = new ChildDefinition('foo');

        $this->assertSame('foo', $def->getParent

 'get'.ucfirst($property);
        $setter = 'set'.ucfirst($property);

        $this->assertNull($def->$getter());
        $this->assertSame($def, $def->$setter('foo'));
        $this->assertSame('foo', $def->$getter());
        $this->assertSame([$change

());
        $this->assertSame([], $def->getChanges());
    }

    #[DataProvider('getPropertyTests')]
    public function testSetProperty($property, $changeKey)
    {
        $def = new ChildDefinition('foo');

        $getter =


ncyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
use Symfony\Component\DependencyInjection\ServiceLocator;
use Symfony\Contracts\Service\ResetInterface;

class ContainerTest extends TestCase
{
    public function testConstructor()
    {
        $sc = new Container();
        $this->assertSame($sc, $sc->get('service_container'), '__construct() automatically registers itself as a service');

        $sc = new Container(new ParameterBag(['foo' =

estCamelize($id, $expected)
    {
        $this->assertEquals($expected, Container::camelize($id), \sprintf('Container::camelize("%s")', $id));
    }

    public static function dataForTestCamelize()
    {
        return [
            ['foo_bar', 'FooBar']

> 'bar']));
        $this->assertEquals(['foo' => 'bar'], $sc->getParameterBag()->all(), '__construct() takes an array of parameters as its first argument');
    }

    #[DataProvider('dataForTestCamelize')]
    public function t


t\DependencyInjection\Exception\ParameterCircularReferenceException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\Tests\Fixtures\IntBackedEnum;
use Symfony\Component\DependencyInjection\Tests\Fixtures\StringBackedEnum;

class EnvVarProcessorTest extends TestCase
{
    public const TEST_CONST = 'test';

    #[DataProvider('validStrings')]
    public function testGetEnvString($value, $processed)
    {
        $container = new ContainerBuilder(

->fail('Should not be called');
        });

        $this->assertSame($processed, $result);
    }

    public static function validStrings()
    {
        return [
            ['hello', 'hello'],
            ['true', 'true'],
            ['false', 'false'

);
        $container->setParameter('env(foo)', $value);
        $container->compile();

        $processor = new EnvVarProcessor($container);

        $result = $processor->getEnv('string', 'foo', function () {
            $this


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\DependencyInjection\Tests;

use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
use Symfony\Compon

nction getServiceLocator(array $factories): ContainerInterface
    {
        return new ServiceLocator($factories);
    }

    public function testGetThrowsOnUndefinedService()
    {
        $locator = $this->getServiceLocator([
            'foo' => static

ent\DependencyInjection\ServiceLocator;
use Symfony\Contracts\Service\ServiceSubscriberInterface;
use Symfony\Contracts\Service\Test\ServiceLocatorTestCase;

class ServiceLocatorTest extends ServiceLocatorTestCase
{
    public fu


buted with this source code.
 */

namespace Symfony\Component\DependencyInjection\Tests\Extension;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\ConfigurableInterface;
use Symfony\Component\Config\Definition\Configuration;
use Symfony\Component\Config\Definition\Configurator\DefinitionConfigurator;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\AbstractExtension;
use

or;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;

class AbstractExtensionTest extends TestCase
{
    public function testConfiguration()
    {
        $extension = new class extends AbstractExtension {
            public function co


 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\Component\DependencyInjection\Tests\Exception;

use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Exception\AutowiringFailedException;

final class AutowiringFailedExceptionTest extends TestCase
{
    public function testGetMessageCallbackWhenM

d "string", you should configure its value explicitly.'
        );

        self::assertNull($exception->getMessageCallback());
    }

    public function testLazyness()
    {
        $counter = 0;
        $exception = new AutowiringFailedException(

essageIsNotANotClosure()
    {
        $exception = new AutowiringFailedException(
            'App\DummyService',
            'Cannot autowire service "App\DummyService": argument "$email" of method "__construct()" is type-hinte


 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\Component\DependencyInjection\Tests\Exception;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Exception\InvalidParameterTypeException;

final class InvalidParameterTypeExceptionTest extends TestCase
{
    #

arameter);

        self::assertSame($expectedMessage, $exception->getMessage());
    }

    public static function provideReflectionParameters(): iterable
    {
        yield 'static method' => [
            new \ReflectionParameter([MyClass::class, 'doSo

[DataProvider('provideReflectionParameters')]
    public function testExceptionMessage(\ReflectionParameter $parameter, string $expectedMessage)
    {
        $exception = new InvalidParameterTypeException('my_service', 'int', $p


 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\Component\DependencyInjection\Tests\Attribute;

use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
use Symfony\Component\DependencyInjection\Attribute\AutowireLocator;
use Symfony\Component\DependencyInjection\ContainerInterf

sertEquals(
            new ServiceLocatorArgument(['foo' => new TypedReference('foo', 'foo'), 'bar' => new TypedReference('bar', 'bar')]),
            $locator->value,
        );
    }

    public function testComplexLocator()
    {
        $locator = new

ace;
use Symfony\Component\DependencyInjection\TypedReference;

class AutowireLocatorTest extends TestCase
{
    public function testSimpleLocator()
    {
        $locator = new AutowireLocator(['foo', 'bar']);

        $this->as


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\DependencyInjection\Tests\Attribute;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\ExpressionLanguage\Express

new Autowire(...$parameters);
    }

    public function testMustSetOneParameter()
    {
        $this->expectException(LogicException::class);

        new Autowire();
    }

    public function testCanUseZeroForValue()
    {
        $this->assertSame('0'

ion;

class AutowireTest extends TestCase
{
    #[DataProvider('provideMultipleParameters')]
    public function testCanOnlySetOneParameter(array $parameters)
    {
        $this->expectException(LogicException::class);


<?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\Component\DependencyInjection\Tests\Fixtures;

use Psr\Container\ContainerInterface;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\DependencyInjection\Attribute\AutowireLocator;
use Symfony\Contracts\Service\Attribute\

lid',
            'subscribed' => new SubscribedService(type: 'string', attributes: new Autowire('%some.parameter%')),
            'subscribed1' => new Autowire('%some.parameter%'),
        ])]
        public readonly ContainerInterface $locator,
    ) {

SubscribedService;

final class AutowireLocatorConsumer
{
    public function __construct(
        #[AutowireLocator([
            BarTagClass::class,
            'with_key' => FooTagClass::class,
            'nullable' => '?inva


buted with this source code.
 */

namespace Symfony\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Argument\ArgumentInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException;
use Symfony\Component\DependencyInjection\Reference;

/**
 * Inline service definitions where this is possible.
 *
 * @author Johannes M. Schmitt <s

InlinedIds = [];
    private array $inlinedIds = [];
    private array $notInlinableIds = [];
    private array $autowireInline = [];
    private ?ServiceReferenceGraph $graph = null;

    public function __construct(
        private ?AnalyzeServiceReferen

chmittjoh@gmail.com>
 */
class InlineServiceDefinitionsPass extends AbstractRecursivePass
{
    protected bool $skipScalars = true;

    private array $cloningIds = [];
    private array $connectedIds = [];
    private array $not


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
use Symfony\Component\DependencyInjection\Attribute\Lazy;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\AutoconfigureFailedExcepti

Grekas <p@tchwork.com>
 */
final class RegisterAutoconfigureAttributesPass implements CompilerPassInterface
{
    private static \Closure $registerForAutoconfiguration;

    public function process(ContainerBuilder $container): void
    {
        foreach (

on;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;

/**
 * Reads #[Autoconfigure] attributes on definitions that are autoconfigured
 * and don't have the "container.ignore_attributes" tag.
 *
 * @author Nicolas


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Argument\ArgumentInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
u

ds AbstractRecursivePass
{
    protected bool $skipScalars = true;

    private array $erroredDefinitions = [];
    private array $sourceReferences = [];

    public function process(ContainerBuilder $container): void
    {
        try {
            parent

se Symfony\Component\DependencyInjection\Reference;

/**
 * Throws an exception for any Definitions that have errors and still exist.
 *
 * @author Ryan Weaver <ryan@knpuniversity.com>
 */
class DefinitionErrorExceptionPass exten


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\DependencyInjection\Argument;

/**
 * Represents a collection of services found by tag name to lazily iterate over.
 *
 * @author Roland Franssen <franssen.roland@gmail.com>
 */
class TaggedIteratorArgument extends IteratorArgument
{
    private mixed $indexAttribute = null;
    private ?string $defaultIndexMethod = null;
    private ?string $def

et services
     * @param string|null $indexAttribute The name of the attribute that defines the key referencing each service in the tagged collection
     * @param bool        $needsIndexes   Whether indexes are required and should be generated when compu

aultPriorityMethod = null;
    private bool $needsIndexes = false;
    private array $exclude = [];
    private bool $excludeSelf = true;

    /**
     * @param string      $tag            The name of the tag identifying the targ


e Symfony\Component\DependencyInjection\Tests\Compiler\Wither;
use Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass;
use Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition;
use Symfony\Component\DependencyInjection\Tests\Fixtures\FooWithAbstractArgument;
use Symfony\Component\DependencyInjection\Tests\Fixtures\ProxyAndInheritance;
use Symfony\Component\DependencyInjection\Tests\Fixtures\ScalarFactory;
use Symfony\Component\DependencyInjection\Tests\Fixtures\SimilarA

use Symfony\Component\ExpressionLanguage\Expression;

class ContainerBuilderTest extends TestCase
{
    public function testDefaultRegisteredDefinitions()
    {
        $builder = new ContainerBuilder();

        $this->assertCount(1, $builder->getDefiniti

rgumentsDummy;
use Symfony\Component\DependencyInjection\Tests\Fixtures\StringBackedEnum;
use Symfony\Component\DependencyInjection\Tests\Fixtures\WitherStaticReturnType;
use Symfony\Component\DependencyInjection\TypedReference;


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\DependencyInjection\Tests;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Dump

  self::$fixturesPath = __DIR__.'/Fixtures/';

        require_once self::$fixturesPath.'/includes/classes.php';
        require_once self::$fixturesPath.'/includes/foo.php';
    }

    #[DataProvider('crossCheckYamlLoadersDumpers')]
    #[IgnoreDeprecatio

er\YamlDumper;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;

class CrossCheckTest extends TestCase
{
    protected static string $fixturesPath;

    public static function setUpBeforeClass(): void
    {


/*
 * 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\Component\DependencyInjection\Tests;

use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\EnvVarLoaderInterface;
use Symfony\Component\DependencyInjection\StaticEnvVarLoader;

class StaticEnvVarLoaderTest extends TestCase
{
    public funct

lic array $envVars = [])
            {
            }

            public function loadEnvVars(): array
            {
                return $this->envVars;
            }
        };

        $loader = new StaticEnvVarLoader($innerLoader);
        $this->ass

ion testLoadEnvVarsCachesInnerLoaderEnvVars()
    {
        $innerLoader = new class(['FOO' => 'BAR']) implements EnvVarLoaderInterface {
            /** @param array<string, string> */
            public function __construct(pub


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\DependencyInjection\Tests\Attribute;

use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Attribute\AutowireCallable;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Reference;

class AutowireCallableTest extends TestCase
{
    public function testNoArguments()

lable(callable: 'my_callable', service: 'my_service', method: 'my_method');
    }

    public function testMethodOnly()
    {
        $this->expectException(LogicException::class);

        new AutowireCallable(method: 'my_method');
    }

    public funct

  {
        $this->expectException(LogicException::class);

        new AutowireCallable();
    }

    public function testCallableAndService()
    {
        $this->expectException(LogicException::class);

        new AutowireCal


buted with this source code.
 */

namespace Symfony\Component\DependencyInjection\Tests\Attribute;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Attribute\AutowireInline;
use Symfony\Component\DependencyInjection\Reference;

class AutowireInlineTest extends TestCase
{
    public function testInvalidFactoryArray()
    {
        $autowireInline = new AutowireInline([123, 456]);

        self::assertSame([123, 456], $autowireInline->va

'someClass', $autowireInline->value['class']);
        self::assertSame($calls, $autowireInline->value['calls']);
    }

    public static function provideInvalidCalls(): iterable
    {
        yield 'missing method' => [[[]]];
        yield 'invalid metho

lue['factory']);
    }

    #[DataProvider('provideInvalidCalls')]
    public function testInvalidCallsArray(array $calls)
    {
        $autowireInline = new AutowireInline('someClass', calls: $calls);

        self::assertSame(


 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\Component\DependencyInjection\Tests\Fixtures;

use Psr\Container\ContainerInterface;
use Symfony\Component\DependencyInjection\Attribute\AutowireLocator;
use Symfony\Contracts\Service\Attribute\Required;
use Symfony\Contracts\Service\ServiceSubscriberInterface;

final

key')]
        private ContainerInterface $locator,
    ) {
    }

    public function getLocator(): ContainerInterface
    {
        return $this->locator;
    }

    public function getContainer(): ?ContainerInterface
    {
        return $this->containe

 class TaggedLocatorConsumerWithServiceSubscriber implements ServiceSubscriberInterface
{
    private ?ContainerInterface $container = null;

    public function __construct(
        #[AutowireLocator('foo_bar', indexAttribute: '


/*
 * 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\Component\DependencyInjection\Argument;

/**
 * Represents a closure acting as a service locator.
 *
 * @author Nicolas Grekas <p@tchwork.com>
 */
class ServiceLocatorArgument implements ArgumentInterface
{
    use ArgumentTrait;

    private array $values;

teratorArgument = $values;
            $values = [];
        }

        $this->setValues($values);
    }

    public function getTaggedIteratorArgument(): ?TaggedIteratorArgument
    {
        return $this->taggedIteratorArgument;
    }

    public functio

private ?TaggedIteratorArgument $taggedIteratorArgument = null;

    public function __construct(array|TaggedIteratorArgument $values = [])
    {
        if ($values instanceof TaggedIteratorArgument) {
            $this->taggedI


) takes the class name as its first argument');
        $this->assertSame(['class' => true], $def->getChanges());

        $def = new Definition('stdClass', ['foo']);
        $this->assertEquals(['foo'], $def->getArguments(), '__construct() takes an optional array of arguments as its second argument');
    }

    public function testSetGetFactory()
    {
        $def = new Definition();

        $this->assertSame($def, $def->setFactory('foo'), '->setFactory() implements a fluent interface');
        $this->

all to the array');

        $def->setFactory($ref = new Reference('baz'));
        $this->assertSame([$ref, '__invoke'], $def->getFactory(), '->setFactory() converts service reference to class invoke call');

        $def->setFactory($innerDef = new Defin

assertEquals('foo', $def->getFactory(), '->getFactory() returns the factory');

        $def->setFactory('Foo::bar');
        $this->assertEquals(['Foo', 'bar'], $def->getFactory(), '->setFactory() converts string static method c


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\DependencyInjection\Tests\Extension;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\Dep

iValidConfigExtension;
use Symfony\Component\DependencyInjection\Tests\Fixtures\Extension\ValidConfig\Configuration;
use Symfony\Component\DependencyInjection\Tests\Fixtures\Extension\ValidConfig\ValidConfigExtension;

class ExtensionTest extends TestCase


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\Component\DependencyInjection\Tests\Fixtures;

use Psr\Container\ContainerInterface;
use Symfony\Component\DependencyInjection\Attribute\AutowireIterator;
use Symfony\Component\DependencyInjection\Attribute\AutowireLocator;

final class TaggedConsumerWithExclude implements Autoc

t(
        #[AutowireIterator(AutoconfiguredInterface2::class, exclude: self::class)]
        public iterable $items,
        #[AutowireLocator(AutoconfiguredInterface2::class, exclude: self::class)]
        public ContainerInterface $locator,
    ) {

onfiguredInterface2
{
    public function __construc


buted with this source code.
 */

namespace Symfony\Component\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Argument\ArgumentInterface;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInje

h information. You can
 * retrieve the graph in other passes from the compiler.
 *
 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
 * @author Nicolas Grekas <p@tchwork.com>
 */
class AnalyzeServiceReferencesPass extends AbstractRecursivePass
{
    pr

ction\Reference;
use Symfony\Component\ExpressionLanguage\Expression;

/**
 * Run this pass before passes that need to know more about the relation of
 * your services.
 *
 * This class will populate the ServiceReferenceGraph wit


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\DependencyInjection\Tests;

use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ServicesResetter;
use Symfony\Component\DependencyInjection\Tests\Fixtures\ClearableService;
use Symfony\Component\DependencyInjection\Tests\Fixtures\LazyResettableService;
use Symfony\Component\DependencyInjection\Tests\Fixtures\MultiResettableS

ResettableService::$counter = 0;
        ClearableService::$counter = 0;
        MultiResettableService::$resetFirstCounter = 0;
        MultiResettableService::$resetSecondCounter = 0;
    }

    public function testResetServices()
    {
        $resetter

ervice;
use Symfony\Component\DependencyInjection\Tests\Fixtures\ResettableService;
use Symfony\Component\VarExporter\ProxyHelper;

class ServicesResetterTest extends TestCase
{
    protected function setUp(): void
    {


ge.
 *
 * (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\Component\DependencyInjection\Tests;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;

class AliasTest extends TestCase
{
    public function testCon

$alias = new Alias('foo', false);

        $this->assertEquals('foo', (string) $alias);
        $this->assertFalse($alias->isPublic());
    }

    public function testCanConstructAPrivateAlias()
    {
        $alias = new Alias('foo', false, false);

structor()
    {
        $alias = new Alias('foo');

        $this->assertEquals('foo', (string) $alias);
        $this->assertFalse($alias->isPublic());
    }

    public function testCanConstructANonPublicAlias()
    {


n 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\Component\DependencyInjection\Tests\Attribute;

use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Attribute\AutowireMethodOf;
use Symfony\Component\DependencyInjection\Reference;

class AutowireMethodOfTest extends TestCase
{
    public function testConstructor()
    {
        $a = new AutowireMethodO

e('foo')], $a->value);
    }

    public function testBuildDefinition(?\Closure $dummy = null)
    {
        $a = new AutowireMethodOf('foo');
        $r = new \ReflectionParameter([__CLASS__, __FUNCTION__], 0);

        $this->assertEquals([[new Reference

f('foo');

        $this->assertEquals([new Referenc


ependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;

/**
 * @internal This class has been auto-genera

protected $parameters = [];

    public function __construct()
    {
        $this->services = $this->privates = [];
        $this->methodMap = [
            'foo' => 'getFooService',
        ];

        $this->aliases = [];
    }

    public function comp

ted by the Symfony Dependency Injection Component.
 */
class ProjectServiceContainer extends Container
{
    private const NONEMPTY_PARAMETERS = [
        'bar' => 'Did you forget to configure the "foo.bar" option?',
    ];


gument\RewindableGenerator;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface

onstruct()
    {
        $this->services = $this->privates = [];
        $this->methodMap = [
            'wither' => 'getWitherService',
        ];

        $this->aliases = [];
    }

    public function compile(): void
    {
        throw new LogicExcep

;

/**
 * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
 */
class Symfony_DI_PhpDumper_Service_Wither_Lazy extends Container
{
    protected $parameters = [];

    public function __c


unction __construct()
    {
        $this->services = $this->privates = [];
        $this->methodMap = [
            'wither' => 'getWitherService',
        ];

        $this->aliases = [];
    }

    public function compile(): void
    {
        throw new

;

/**
 * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
 */
class Symfony_DI_PhpDumper_Service_Wither_Lazy_Non_Shared extends Container
{
    protected $parameters = [];

    public f


ent\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\Paramete

meters = [];

    public function __construct()
    {
        $this->services = $this->privates = [];
        $this->methodMap = [
            'wither' => 'getWitherService',
        ];

        $this->aliases = [];
    }

    public function compile(): vo

rBag\ParameterBagInterface;

/**
 * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
 */
class Symfony_DI_PhpDumper_Service_WitherStaticReturnType extends Container
{
    protected $para


ction __construct()
    {
        $this->services = $this->privates = [];
        $this->methodMap = [
            'static_constructor' => 'getStaticConstructorService',
        ];

        $this->aliases = [];
    }

    public function compile(): void

rBag\ParameterBagInterface;

/**
 * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
 */
class ProjectServiceContainer extends Container
{
    protected $parameters = [];

    public fun


?php

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;

class ProjectExtension implements ExtensionInterface
{
    public function load(array $configs, ContainerBuilder $configuration): void
    {
        $configuration->setParameter('project.configs', $configs);
        $configs = array_filter($configs);

        if ($configs) {
            $config = array_merge(...$configs);
        } else {
            $config = [];

ice.foo', 'FooClass')->setPublic(true);
        $configuration->setParameter('project.parameter.foo', $config['foo'] ?? 'foobar');
    }

    public function getAlias(): string
    {
        return 'project';
    }

    public function getConfiguration(arr

  }

        $configuration->register('project.service.bar', 'FooClass')->setPublic(true);
        $configuration->setParameter('project.parameter.bar', $config['foo'] ?? 'foobar');

        $configuration->register('project.serv


_classes.php';
require __DIR__.'/autowiring_classes_80.php';
require __DIR__.'/intersectiontype_classes.php';
require __DIR__.'/compositetype_classes.php';

class Foo
{
    public static int $counter = 0;
    public int $foo = 0;

    #[Required]
    public function cloneFoo(?\stdClass $bar = null): static
    {
        ++self::$counter;

        return clone $this;
    }
}

class FooVoid
{
    public static int $counter = 0;

    public function __invoke(string $name): void
    {
        ++self::$counter;

   public function __construct(A $a)
    {
    }
}

interface DInterface
{
}

interface EInterface extends DInterface
{
}

interface IInterface
{
}

class I implements IInterface
{
}

class F extends I implements EInterface
{
}

class G
{
    public functi

    }
}

class Bar
{
    public function __construct(Foo $foo)
    {
    }
}

interface AInterface
{
}

class A implements AInterface
{
    public static function create(Foo $foo)
    {
    }
}

class B extends A
{
}

class C
{


use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\DependencyInjection\Attribute\AutowireDecorated;
use Symfony\Component\DependencyInjection\Attribute\AutowireInline;
use Symfony\Component\DependencyInjection\Attribute\AutowireIterator;
use Symfony\Component\DependencyInjection\Attribute\AutowireLocator;
use Symfony\Component\DependencyInjection\Attribute\Lazy;
use Symfony\Component\DependencyInjection\Attribute\Target;
use Symfony\Component\DependencyInjection\ContainerIn

foo): static
    {
        return $this;
    }
}

class AutowireProperty
{
    #[Required]
    public Foo $foo;
}

class AutowirePropertyWithTarget
{
    #[Required]
    #[Target('foo.target')]
    public Foo $foo;
}

class AutowireReadonlyProperty
{
    #

terface;
use Symfony\Contracts\Service\Attribute\Required;

class AutowireSetter
{
    #[Required]
    public function setFoo(Foo $foo): void
    {
    }
}

class AutowireWither
{
    #[Required]
    public function withFoo(Foo $


\LazyProxy\PhpDumper\DumperInterface;

function sc_configure($instance)
{
    $instance->configure();
}

class BarClass extends BazClass
{
    protected $baz;
    public $foo = 'foo';

    public function setBaz(BazClass $baz)
    {
        $this->baz = $baz;
    }

    public function getBaz()
    {
        return $this->baz;
    }
}

class BazClass
{
    protected $foo;

    public function setFoo(Foo $foo)
    {
        $this->foo = $foo;
    }

    public function configure($instance)
    {
        $ins

tion configureStatic1()
    {
    }
}

class BazInvokableFactory
{
    public function __invoke(): BazClass
    {
        return new BazClass();
    }
}

class BazInvokableConfigurator
{
    public function __invoke($instance): void
    {
        $instance

tance->configure();
    }

    public static function getInstance()
    {
        return new self();
    }

    public static function configureStatic($instance)
    {
        $instance->configure();
    }

    public static func


php

namespace App;

class BarService
{
}

class Db
{
    public Schema $schema;
}

class Bus
{
    public Handler1 $handler1;
    public Handler2 $handler2;

    public function __construct(public Db $db)
    {
    }
}

class Handler1
{
    public function __construct(
        public Db $db,
        public Schema $schema,
        public Processor $processor,
    ) {
    }
}

class Handler2
{
    public function __construct(
        public Db $db,
        public Schema $schema,
        public Processor $pro

{
    }
}

class Processor
{
    public function __construct(
        public Registry $registry,
        public Db $db,
    ) {
    }
}

class Registry
{
    public array $processor;
}

class Schema
{
    public function __construct(public Db $db)
    {


 public $otherInstances;

    public $bar = null;
    public $initialized = false;
    public $configured = false;
    public $called = false;
    public $arguments = [];

    public function __construct($arguments = [])
    {
        $this->arguments = $arguments;
    }

    public static function getInstance($arguments = [])
    {
        $obj = new self($arguments);
        $obj->called = true;

        return $obj;
    }

    public function initialize()
    {
        $this->initialized = true;
    }

configured = true;
    }

    public function setBar($value = null)
    {
        $this->bar = $value;
    }

    public function setOtherInstances($otherInstances)
    {
        $this->otherInstances = $otherInstances;
    }
}

namespace Acme;

class Foo

   public function configure()
    {
        $this->


DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass;

class BarMethodCall
{
    public $foo;

    public function setBar(Bar $bar)
    {
    }

    public function setFoo(\stdClass $foo)
    {
        $this->foo = $foo;
    }

    public function setFoosVariadic(Foo $foo, Foo ...$foos)
    {
        $this->foo = $foo;
    }

    public function setFoosOptional(Foo $foo, ?Foo $fooOptional = null)
    {
        $this->foo = $foo;
    }

    public function setScalars(int $int, string $string, bool $b

ay(array $array)
    {
    }

    public function setIterable(iterable $iterable)
    {
    }

    public function setCallable(callable $callable): void
    {
    }

    public function setClosure(\Closure $closure): void
    {
    }

    public function s

ool = false)
    {
    }

    public function setArr


use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;

require_once __DIR__.'/../includes/classes.php';

$container = new ContainerBuilder();

$container->setParameter('env(FOO)', 'Bar\FaooClass');
$container->setParameter('foo', '%env(FOO)%');

$container
    ->register('service_from_anonymous_factory', '%foo%')
    ->setFactory([new Definition('%foo%'), 'getInstance'])
    ->setPublic(true)
;

$anonymousServiceWithFactory = new Definition('Bar\F

onymousServiceWithFactory->setFactory('Bar\FooClass::getInstance');
$container
    ->register('service_with_method_call_and_factory', 'Bar\FooClass')
    ->addMethodCall('setBar', [$anonymousServiceWithFactory])
    ->setPublic(true)
;

return $container;


<?php

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;

$container = new ContainerBuilder(new ParameterBag([
    'foo' => '%baz%',
    'baz' => 'bar',
    'bar' => 'foo is %%foo bar',
    'escape' => '@escapeme',
    'values' => [true, false, null, 0, 1000.3, 'true', 'false', 'null'],
    'utf-8 valid string' => "\u{021b}\u{1b56}\ttest",
    'binary' => "\xf0\xf0\xf0\xf0",
    'binary-control-char' => "This is a Bell char \x07"

string' => 'false',
    'binary number string' => '0b0110',
    'numeric string' => '-1.2E2',
    'hexadecimal number string' => '0xFF',
    'float string' => '10100.1',
    'positive float string' => '+10100.1',
    'negative float string' => '-10100.1',

,
    'console banner' => "\e[37;44mHello\e[30;43mWorld\e[0m",
    'null string' => 'null',
    'string of digits' => '123',
    'string of digits prefixed with minus character' => '-123',
    'true string' => 'true',
    'false


ponent\DependencyInjection\Argument\TaggedIteratorArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Parameter;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\ExpressionLanguage\Expression;

$container = new ContainerBuilder();
$container
    ->register('foo', FooClass::class)
    ->addTag('foo', ['foo' => 'foo'])
    ->addTag('foo', ['bar' => 'bar', 'baz' =>

foo%' => 'foo is %foo%', 'foobar' => '%foo%'], true, new Reference('service_container')])
    ->setProperties(['foo' => 'bar', 'moo' => new Reference('foo.baz'), 'qux' => ['%foo%' => 'foo is %foo%', 'foobar' => '%foo%']])
    ->addMethodCall('setBar', [new

 'baz'])
    ->addTag('nullable', ['bar' => 'bar', 'baz' => null])
    ->addTag('foo', ['name' => 'bar', 'baz' => 'baz'])
    ->setFactory(['Bar\\FooClass', 'getInstance'])
    ->setArguments(['foo', new Reference('foo.baz'), ['%


ilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls;

$public = 'public' === $visibility;
$container = new ContainerBuilder();

// factory with lazy injection

$container->register('doctrine.config', 'stdClass')
    ->setProperty('resolver', new Reference('doctrine.entity_listener_resolver'))
    ->setProperty('flag', 'ok');

$container->register('doctrine.entity_

lic)
    ->addArgument(new IteratorArgument([new Reference('doctrine.listener')]));
$container->register('doctrine.listener', 'stdClass')->setPublic($public)
    ->addArgument(new Reference('doctrine.entity_manager'));

// multiple path detection

$contain

manager', 'stdClass')->setPublic(true)
    ->setFactory([FactoryChecker::class, 'create'])
    ->addArgument(new Reference('doctrine.config'));
$container->register('doctrine.entity_listener_resolver', 'stdClass')->setPublic($pub


?php

use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

$container = new ContainerBuilder();

$container
    ->register('foo1', 'stdClass')
    ->setPublic(true)
;

$container
    ->register('foo2', 'stdClass')
;

$container
    ->register('foo3', 'stdClass')
    ->setShared(false)
;

$container
    ->register('foo4', 'stdClass')
    ->addError('BOOM')
;

$container

    'foo2' => new Reference('foo2'),
        'foo3' => new Reference('foo3'),
        'foo4' => new Reference('foo4', $container::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE),
        'foo5' => new Reference('foo5', $container::IGNORE_ON_UNINITIALIZED_REFERENCE

->register('foo5', 'stdClass')
    ->setPublic(true)
    ->setSynthetic(true)
;

$container
    ->register('bar', 'stdClass')
    ->setProperty('locator', new ServiceLocatorArgument([
        'foo1' => new Reference('foo1'),


ent\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

$container = new ContainerBuilder();

$container
    ->register('foo1', 'stdClass')
    ->setPublic(true)
;

$container
    ->register('foo2', 'stdClass')
;

$container
    ->register('foo3', 'stdClass')
;

$container
    ->register('baz', 'stdClass')
    ->setProperty('f

rence('foo2', $container::IGNORE_ON_UNINITIALIZED_REFERENCE))
    ->setProperty('foo3', new Reference('foo3', $container::IGNORE_ON_UNINITIALIZED_REFERENCE))
    ->setProperty('closures', [
        new ServiceClosureArgument(new Reference('foo1', $containe

oo3', new Reference('foo3'))
    ->setPublic(true)
;

$container
    ->register('bar', 'stdClass')
    ->setProperty('foo1', new Reference('foo1', $container::IGNORE_ON_UNINITIALIZED_REFERENCE))
    ->setProperty('foo2', new Refe


php

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Symfony\Component\DependencyInjection\Tests\Fixtures\Bar;
use Symfony\Component\DependencyInjection\Tests\Fixtures\BarFactory;

return App::config([
    'services' => [
        '_defaults' => [
            'public' => true,
        ],
        BarFactory::class => [
            'arguments' => [[]],
        ],
        'invokable_factory' => [
            'class' => Bar::class,
            'factory' => service(BarFactory::class),

lass' => Bar::class,
            'factory' => [service(BarFactory::class), 'getDefaultBar'],
        ],
        'invokable_configurator' => [
            'class' => Bar::class,
            'configurator' => service(BarFactory::class),
        ],
    ],
]);

      ],
        'array_factory' => [
            'c


namespace Testing\NamedClosure;

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

use function Symfony\Component\DependencyInjection\Loader\Configurator\closure;

interface NamedClosureInterface
{
    public function theMethod();
}

class NamedClosureClass
{
    public function __construct(...$args)
    {
    }

    public static function getInstance(): self
    {
        return new self();
    }

    public static function configure(self $instance): void
    {
    }
}

as_factory', NamedClosureClass::class)
            ->factory(NamedClosureClass::getInstance(...))
            ->public()
        ->set('has_configurator', NamedClosureClass::class)
            ->configurator(NamedClosureClass::configure(...))
            -

return function (ContainerConfigurator $c) {
    $c->services()
        ->set('from_callable', NamedClosureInterface::class)
            ->fromCallable(NamedClosureClass::getInstance(...))
            ->public()
        ->set('h