initial commit
This commit is contained in:
28
vendor/symfony/dependency-injection/Loader/Configurator/Traits/AbstractTrait.php
vendored
Normal file
28
vendor/symfony/dependency-injection/Loader/Configurator/Traits/AbstractTrait.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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\Loader\Configurator\Traits;
|
||||
|
||||
trait AbstractTrait
|
||||
{
|
||||
/**
|
||||
* Whether this definition is abstract, that means it merely serves as a
|
||||
* template for other definitions.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function abstract(bool $abstract = true): static
|
||||
{
|
||||
$this->definition->setAbstract($abstract);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
39
vendor/symfony/dependency-injection/Loader/Configurator/Traits/ArgumentTrait.php
vendored
Normal file
39
vendor/symfony/dependency-injection/Loader/Configurator/Traits/ArgumentTrait.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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\Loader\Configurator\Traits;
|
||||
|
||||
trait ArgumentTrait
|
||||
{
|
||||
/**
|
||||
* Sets the arguments to pass to the service constructor/factory method.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function args(array $arguments): static
|
||||
{
|
||||
$this->definition->setArguments(static::processValue($arguments, true));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets one argument to pass to the service constructor/factory method.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function arg(string|int $key, mixed $value): static
|
||||
{
|
||||
$this->definition->setArgument($key, static::processValue($value, true));
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
31
vendor/symfony/dependency-injection/Loader/Configurator/Traits/AutoconfigureTrait.php
vendored
Normal file
31
vendor/symfony/dependency-injection/Loader/Configurator/Traits/AutoconfigureTrait.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\DependencyInjection\Loader\Configurator\Traits;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
|
||||
trait AutoconfigureTrait
|
||||
{
|
||||
/**
|
||||
* Sets whether or not instanceof conditionals should be prepended with a global set.
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @throws InvalidArgumentException when a parent is already set
|
||||
*/
|
||||
final public function autoconfigure(bool $autoconfigured = true): static
|
||||
{
|
||||
$this->definition->setAutoconfigured($autoconfigured);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
27
vendor/symfony/dependency-injection/Loader/Configurator/Traits/AutowireTrait.php
vendored
Normal file
27
vendor/symfony/dependency-injection/Loader/Configurator/Traits/AutowireTrait.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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\Loader\Configurator\Traits;
|
||||
|
||||
trait AutowireTrait
|
||||
{
|
||||
/**
|
||||
* Enables/disables autowiring.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function autowire(bool $autowired = true): static
|
||||
{
|
||||
$this->definition->setAutowired($autowired);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
42
vendor/symfony/dependency-injection/Loader/Configurator/Traits/BindTrait.php
vendored
Normal file
42
vendor/symfony/dependency-injection/Loader/Configurator/Traits/BindTrait.php
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\DependencyInjection\Loader\Configurator\Traits;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Argument\BoundArgument;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\DefaultsConfigurator;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\InstanceofConfigurator;
|
||||
|
||||
trait BindTrait
|
||||
{
|
||||
/**
|
||||
* Sets bindings.
|
||||
*
|
||||
* Bindings map $named or FQCN arguments to values that should be
|
||||
* injected in the matching parameters (of the constructor, of methods
|
||||
* called and of controller actions).
|
||||
*
|
||||
* @param string $nameOrFqcn A parameter name with its "$" prefix, or an FQCN
|
||||
* @param mixed $valueOrRef The value or reference to bind
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function bind(string $nameOrFqcn, mixed $valueOrRef): static
|
||||
{
|
||||
$valueOrRef = static::processValue($valueOrRef, true);
|
||||
$bindings = $this->definition->getBindings();
|
||||
$type = $this instanceof DefaultsConfigurator ? BoundArgument::DEFAULTS_BINDING : ($this instanceof InstanceofConfigurator ? BoundArgument::INSTANCEOF_BINDING : BoundArgument::SERVICE_BINDING);
|
||||
$bindings[$nameOrFqcn] = new BoundArgument($valueOrRef, true, $type, $this->path ?? null);
|
||||
$this->definition->setBindings($bindings);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
35
vendor/symfony/dependency-injection/Loader/Configurator/Traits/CallTrait.php
vendored
Normal file
35
vendor/symfony/dependency-injection/Loader/Configurator/Traits/CallTrait.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\DependencyInjection\Loader\Configurator\Traits;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
|
||||
trait CallTrait
|
||||
{
|
||||
/**
|
||||
* Adds a method to call after service initialization.
|
||||
*
|
||||
* @param string $method The method name to call
|
||||
* @param array $arguments An array of arguments to pass to the method call
|
||||
* @param bool $returnsClone Whether the call returns the service instance or not
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @throws InvalidArgumentException on empty $method param
|
||||
*/
|
||||
final public function call(string $method, array $arguments = [], bool $returnsClone = false): static
|
||||
{
|
||||
$this->definition->addMethodCall($method, static::processValue($arguments, true), $returnsClone);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
27
vendor/symfony/dependency-injection/Loader/Configurator/Traits/ClassTrait.php
vendored
Normal file
27
vendor/symfony/dependency-injection/Loader/Configurator/Traits/ClassTrait.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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\Loader\Configurator\Traits;
|
||||
|
||||
trait ClassTrait
|
||||
{
|
||||
/**
|
||||
* Sets the service class.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function class(?string $class): static
|
||||
{
|
||||
$this->definition->setClass($class);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
29
vendor/symfony/dependency-injection/Loader/Configurator/Traits/ConfiguratorTrait.php
vendored
Normal file
29
vendor/symfony/dependency-injection/Loader/Configurator/Traits/ConfiguratorTrait.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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\Loader\Configurator\Traits;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ReferenceConfigurator;
|
||||
|
||||
trait ConfiguratorTrait
|
||||
{
|
||||
/**
|
||||
* Sets a configurator to call after the service is fully initialized.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function configurator(string|array|ReferenceConfigurator $configurator): static
|
||||
{
|
||||
$this->definition->setConfigurator(static::processValue($configurator, true));
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
27
vendor/symfony/dependency-injection/Loader/Configurator/Traits/ConstructorTrait.php
vendored
Normal file
27
vendor/symfony/dependency-injection/Loader/Configurator/Traits/ConstructorTrait.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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\Loader\Configurator\Traits;
|
||||
|
||||
trait ConstructorTrait
|
||||
{
|
||||
/**
|
||||
* Sets a static constructor.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function constructor(string $constructor): static
|
||||
{
|
||||
$this->definition->setFactory([null, $constructor]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
34
vendor/symfony/dependency-injection/Loader/Configurator/Traits/DecorateTrait.php
vendored
Normal file
34
vendor/symfony/dependency-injection/Loader/Configurator/Traits/DecorateTrait.php
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\DependencyInjection\Loader\Configurator\Traits;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
|
||||
trait DecorateTrait
|
||||
{
|
||||
/**
|
||||
* Sets the service that this service is decorating.
|
||||
*
|
||||
* @param string|null $id The decorated service id, use null to remove decoration
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @throws InvalidArgumentException in case the decorated service id and the new decorated service id are equals
|
||||
*/
|
||||
final public function decorate(?string $id, ?string $renamedId = null, int $priority = 0, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE): static
|
||||
{
|
||||
$this->definition->setDecoratedService($id, $renamedId, $priority, $invalidBehavior);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
35
vendor/symfony/dependency-injection/Loader/Configurator/Traits/DeprecateTrait.php
vendored
Normal file
35
vendor/symfony/dependency-injection/Loader/Configurator/Traits/DeprecateTrait.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\DependencyInjection\Loader\Configurator\Traits;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
|
||||
trait DeprecateTrait
|
||||
{
|
||||
/**
|
||||
* Whether this definition is deprecated, that means it should not be called anymore.
|
||||
*
|
||||
* @param string $package The name of the composer package that is triggering the deprecation
|
||||
* @param string $version The version of the package that introduced the deprecation
|
||||
* @param string $message The deprecation message to use
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @throws InvalidArgumentException when the message template is invalid
|
||||
*/
|
||||
final public function deprecate(string $package, string $version, string $message): static
|
||||
{
|
||||
$this->definition->setDeprecated($package, $version, $message);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
41
vendor/symfony/dependency-injection/Loader/Configurator/Traits/FactoryTrait.php
vendored
Normal file
41
vendor/symfony/dependency-injection/Loader/Configurator/Traits/FactoryTrait.php
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
<?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\Loader\Configurator\Traits;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ReferenceConfigurator;
|
||||
use Symfony\Component\ExpressionLanguage\Expression;
|
||||
|
||||
trait FactoryTrait
|
||||
{
|
||||
/**
|
||||
* Sets a factory.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function factory(string|array|ReferenceConfigurator|Expression $factory): static
|
||||
{
|
||||
if (\is_string($factory) && 1 === substr_count($factory, ':')) {
|
||||
$factoryParts = explode(':', $factory);
|
||||
|
||||
throw new InvalidArgumentException(\sprintf('Invalid factory "%s": the "service:method" notation is not available when using PHP-based DI configuration. Use "[service(\'%s\'), \'%s\']" instead.', $factory, $factoryParts[0], $factoryParts[1]));
|
||||
}
|
||||
|
||||
if ($factory instanceof Expression) {
|
||||
$factory = '@='.$factory;
|
||||
}
|
||||
|
||||
$this->definition->setFactory(static::processValue($factory, true));
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
27
vendor/symfony/dependency-injection/Loader/Configurator/Traits/FileTrait.php
vendored
Normal file
27
vendor/symfony/dependency-injection/Loader/Configurator/Traits/FileTrait.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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\Loader\Configurator\Traits;
|
||||
|
||||
trait FileTrait
|
||||
{
|
||||
/**
|
||||
* Sets a file to require before creating the service.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function file(string $file): static
|
||||
{
|
||||
$this->definition->setFile($file);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
64
vendor/symfony/dependency-injection/Loader/Configurator/Traits/FromCallableTrait.php
vendored
Normal file
64
vendor/symfony/dependency-injection/Loader/Configurator/Traits/FromCallableTrait.php
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\DependencyInjection\Loader\Configurator\Traits;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ChildDefinition;
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\FromCallableConfigurator;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ReferenceConfigurator;
|
||||
use Symfony\Component\ExpressionLanguage\Expression;
|
||||
|
||||
trait FromCallableTrait
|
||||
{
|
||||
final public function fromCallable(string|array|ReferenceConfigurator|Expression $callable): FromCallableConfigurator
|
||||
{
|
||||
if ($this->definition instanceof ChildDefinition) {
|
||||
throw new InvalidArgumentException('The configuration key "parent" is unsupported when using "fromCallable()".');
|
||||
}
|
||||
|
||||
foreach ([
|
||||
'synthetic' => 'isSynthetic',
|
||||
'factory' => 'getFactory',
|
||||
'file' => 'getFile',
|
||||
'arguments' => 'getArguments',
|
||||
'properties' => 'getProperties',
|
||||
'configurator' => 'getConfigurator',
|
||||
'calls' => 'getMethodCalls',
|
||||
] as $key => $method) {
|
||||
if ($this->definition->$method()) {
|
||||
throw new InvalidArgumentException(\sprintf('The configuration key "%s" is unsupported when using "fromCallable()".', $key));
|
||||
}
|
||||
}
|
||||
|
||||
$this->definition->setFactory(['Closure', 'fromCallable']);
|
||||
|
||||
if (\is_string($callable) && 1 === substr_count($callable, ':')) {
|
||||
$parts = explode(':', $callable);
|
||||
|
||||
throw new InvalidArgumentException(\sprintf('Invalid callable "%s": the "service:method" notation is not available when using PHP-based DI configuration. Use "[service(\'%s\'), \'%s\']" instead.', $callable, $parts[0], $parts[1]));
|
||||
}
|
||||
|
||||
if ($callable instanceof Expression) {
|
||||
$callable = '@='.$callable;
|
||||
}
|
||||
|
||||
$this->definition->setArguments([static::processValue($callable, true)]);
|
||||
|
||||
if ('Closure' !== ($this->definition->getClass() ?? 'Closure')) {
|
||||
$this->definition->setLazy(true);
|
||||
} else {
|
||||
$this->definition->setClass('Closure');
|
||||
}
|
||||
|
||||
return new FromCallableConfigurator($this, $this->definition);
|
||||
}
|
||||
}
|
||||
32
vendor/symfony/dependency-injection/Loader/Configurator/Traits/LazyTrait.php
vendored
Normal file
32
vendor/symfony/dependency-injection/Loader/Configurator/Traits/LazyTrait.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?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\Loader\Configurator\Traits;
|
||||
|
||||
trait LazyTrait
|
||||
{
|
||||
/**
|
||||
* Sets the lazy flag of this service.
|
||||
*
|
||||
* @param bool|string $lazy A FQCN to derivate the lazy proxy from or `true` to make it extend from the definition's class
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function lazy(bool|string $lazy = true): static
|
||||
{
|
||||
$this->definition->setLazy((bool) $lazy);
|
||||
if (\is_string($lazy)) {
|
||||
$this->definition->addTag('proxy', ['interface' => $lazy]);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
46
vendor/symfony/dependency-injection/Loader/Configurator/Traits/ParentTrait.php
vendored
Normal file
46
vendor/symfony/dependency-injection/Loader/Configurator/Traits/ParentTrait.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\DependencyInjection\Loader\Configurator\Traits;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ChildDefinition;
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
|
||||
trait ParentTrait
|
||||
{
|
||||
/**
|
||||
* Sets the Definition to inherit from.
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @throws InvalidArgumentException when parent cannot be set
|
||||
*/
|
||||
final public function parent(string $parent): static
|
||||
{
|
||||
if (!$this->allowParent) {
|
||||
throw new InvalidArgumentException(\sprintf('A parent cannot be defined when either "_instanceof" or "_defaults" are also defined for service prototype "%s".', $this->id));
|
||||
}
|
||||
|
||||
if ($this->definition instanceof ChildDefinition) {
|
||||
$this->definition->setParent($parent);
|
||||
} else {
|
||||
// cast Definition to ChildDefinition
|
||||
$definition = serialize($this->definition);
|
||||
$definition = substr_replace($definition, '53', 2, 2);
|
||||
$definition = substr_replace($definition, 'Child', 44, 0);
|
||||
$definition = unserialize($definition);
|
||||
|
||||
$this->definition = $definition->setParent($parent);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
27
vendor/symfony/dependency-injection/Loader/Configurator/Traits/PropertyTrait.php
vendored
Normal file
27
vendor/symfony/dependency-injection/Loader/Configurator/Traits/PropertyTrait.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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\Loader\Configurator\Traits;
|
||||
|
||||
trait PropertyTrait
|
||||
{
|
||||
/**
|
||||
* Sets a specific property.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function property(string $name, mixed $value): static
|
||||
{
|
||||
$this->definition->setProperty($name, static::processValue($value, true));
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
35
vendor/symfony/dependency-injection/Loader/Configurator/Traits/PublicTrait.php
vendored
Normal file
35
vendor/symfony/dependency-injection/Loader/Configurator/Traits/PublicTrait.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\DependencyInjection\Loader\Configurator\Traits;
|
||||
|
||||
trait PublicTrait
|
||||
{
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
final public function public(): static
|
||||
{
|
||||
$this->definition->setPublic(true);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
final public function private(): static
|
||||
{
|
||||
$this->definition->setPublic(false);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
27
vendor/symfony/dependency-injection/Loader/Configurator/Traits/ShareTrait.php
vendored
Normal file
27
vendor/symfony/dependency-injection/Loader/Configurator/Traits/ShareTrait.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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\Loader\Configurator\Traits;
|
||||
|
||||
trait ShareTrait
|
||||
{
|
||||
/**
|
||||
* Sets if the service must be shared or not.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function share(bool $shared = true): static
|
||||
{
|
||||
$this->definition->setShared($shared);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
28
vendor/symfony/dependency-injection/Loader/Configurator/Traits/SyntheticTrait.php
vendored
Normal file
28
vendor/symfony/dependency-injection/Loader/Configurator/Traits/SyntheticTrait.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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\Loader\Configurator\Traits;
|
||||
|
||||
trait SyntheticTrait
|
||||
{
|
||||
/**
|
||||
* Sets whether this definition is synthetic, that is not constructed by the
|
||||
* container, but dynamically injected.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function synthetic(bool $synthetic = true): static
|
||||
{
|
||||
$this->definition->setSynthetic($synthetic);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
47
vendor/symfony/dependency-injection/Loader/Configurator/Traits/TagTrait.php
vendored
Normal file
47
vendor/symfony/dependency-injection/Loader/Configurator/Traits/TagTrait.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\DependencyInjection\Loader\Configurator\Traits;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
|
||||
trait TagTrait
|
||||
{
|
||||
/**
|
||||
* Adds a tag for this definition.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function tag(string $name, array $attributes = []): static
|
||||
{
|
||||
if ('' === $name) {
|
||||
throw new InvalidArgumentException(\sprintf('The tag name for service "%s" must be a non-empty string.', $this->id));
|
||||
}
|
||||
|
||||
$this->validateAttributes($name, $attributes);
|
||||
|
||||
$this->definition->addTag($name, $attributes);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function validateAttributes(string $tag, array $attributes, array $path = []): void
|
||||
{
|
||||
foreach ($attributes as $name => $value) {
|
||||
if (\is_array($value)) {
|
||||
$this->validateAttributes($tag, $value, [...$path, $name]);
|
||||
} elseif (!\is_scalar($value ?? '')) {
|
||||
$name = implode('.', [...$path, $name]);
|
||||
throw new InvalidArgumentException(\sprintf('A tag attribute must be of a scalar-type or an array of scalar-types for service "%s", tag "%s", attribute "%s".', $this->id, $tag, $name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user