diff --git a/Compiler/MergeExtensionConfigurationPass.php b/Compiler/MergeExtensionConfigurationPass.php index c64381886..c182d7cda 100644 --- a/Compiler/MergeExtensionConfigurationPass.php +++ b/Compiler/MergeExtensionConfigurationPass.php @@ -79,10 +79,6 @@ public function process(ContainerBuilder $container) $container->getParameterBag()->mergeEnvPlaceholders($resolvingBag); } - if ($configAvailable) { - BaseNode::resetPlaceholders(); - } - throw $e; } @@ -95,10 +91,6 @@ public function process(ContainerBuilder $container) $container->getParameterBag()->add($parameters); } - if ($configAvailable) { - BaseNode::resetPlaceholders(); - } - $container->addDefinitions($definitions); $container->addAliases($aliases); } diff --git a/Compiler/ValidateEnvPlaceholdersPass.php b/Compiler/ValidateEnvPlaceholdersPass.php index 1a397f209..510e90093 100644 --- a/Compiler/ValidateEnvPlaceholdersPass.php +++ b/Compiler/ValidateEnvPlaceholdersPass.php @@ -48,46 +48,42 @@ public function process(ContainerBuilder $container) $defaultBag = new ParameterBag($resolvingBag->all()); $envTypes = $resolvingBag->getProvidedTypes(); - try { - foreach ($resolvingBag->getEnvPlaceholders() + $resolvingBag->getUnusedEnvPlaceholders() as $env => $placeholders) { - $values = []; - if (false === $i = strpos($env, ':')) { - $default = $defaultBag->has("env($env)") ? $defaultBag->get("env($env)") : self::TYPE_FIXTURES['string']; - $defaultType = null !== $default ? get_debug_type($default) : 'string'; - $values[$defaultType] = $default; - } else { - $prefix = substr($env, 0, $i); - foreach ($envTypes[$prefix] ?? ['string'] as $type) { - $values[$type] = self::TYPE_FIXTURES[$type] ?? null; - } - } - foreach ($placeholders as $placeholder) { - BaseNode::setPlaceholder($placeholder, $values); + foreach ($resolvingBag->getEnvPlaceholders() + $resolvingBag->getUnusedEnvPlaceholders() as $env => $placeholders) { + $values = []; + if (false === $i = strpos($env, ':')) { + $default = $defaultBag->has("env($env)") ? $defaultBag->get("env($env)") : self::TYPE_FIXTURES['string']; + $defaultType = null !== $default ? get_debug_type($default) : 'string'; + $values[$defaultType] = $default; + } else { + $prefix = substr($env, 0, $i); + foreach ($envTypes[$prefix] ?? ['string'] as $type) { + $values[$type] = self::TYPE_FIXTURES[$type] ?? null; } } + foreach ($placeholders as $placeholder) { + BaseNode::setPlaceholder($placeholder, $values); + } + } - $processor = new Processor(); - - foreach ($extensions as $name => $extension) { - if (!($extension instanceof ConfigurationExtensionInterface || $extension instanceof ConfigurationInterface) - || !$config = array_filter($container->getExtensionConfig($name)) - ) { - // this extension has no semantic configuration or was not called - continue; - } + $processor = new Processor(); - $config = $resolvingBag->resolveValue($config); + foreach ($extensions as $name => $extension) { + if (!($extension instanceof ConfigurationExtensionInterface || $extension instanceof ConfigurationInterface) + || !$config = array_filter($container->getExtensionConfig($name)) + ) { + // this extension has no semantic configuration or was not called + continue; + } - if ($extension instanceof ConfigurationInterface) { - $configuration = $extension; - } elseif (null === $configuration = $extension->getConfiguration($config, $container)) { - continue; - } + $config = $resolvingBag->resolveValue($config); - $this->extensionConfig[$name] = $processor->processConfiguration($configuration, $config); + if ($extension instanceof ConfigurationInterface) { + $configuration = $extension; + } elseif (null === $configuration = $extension->getConfiguration($config, $container)) { + continue; } - } finally { - BaseNode::resetPlaceholders(); + + $this->extensionConfig[$name] = $processor->processConfiguration($configuration, $config); } $resolvingBag->clearUnusedEnvPlaceholders(); diff --git a/Container.php b/Container.php index 0532120ad..fc38cd93a 100644 --- a/Container.php +++ b/Container.php @@ -103,7 +103,7 @@ public function getParameterBag(): ParameterBagInterface /** * Gets a parameter. * - * @return array|bool|string|int|float|null + * @return array|bool|string|int|float|\UnitEnum|null * * @throws InvalidArgumentException if the parameter is not defined */ @@ -117,7 +117,7 @@ public function hasParameter(string $name): bool return $this->parameterBag->has($name); } - public function setParameter(string $name, array|bool|string|int|float|null $value) + public function setParameter(string $name, array|bool|string|int|float|\UnitEnum|null $value) { $this->parameterBag->set($name, $value); } diff --git a/ContainerInterface.php b/ContainerInterface.php index aa5d6b317..cad44026c 100644 --- a/ContainerInterface.php +++ b/ContainerInterface.php @@ -48,7 +48,7 @@ public function has(string $id): bool; public function initialized(string $id): bool; /** - * @return array|bool|string|int|float|null + * @return array|bool|string|int|float|\UnitEnum|null * * @throws InvalidArgumentException if the parameter is not defined */ @@ -56,5 +56,5 @@ public function getParameter(string $name); public function hasParameter(string $name): bool; - public function setParameter(string $name, array|bool|string|int|float|null $value); + public function setParameter(string $name, array|bool|string|int|float|\UnitEnum|null $value); } diff --git a/Dumper/PhpDumper.php b/Dumper/PhpDumper.php index ddb9b195a..3f50561a5 100644 --- a/Dumper/PhpDumper.php +++ b/Dumper/PhpDumper.php @@ -334,7 +334,7 @@ class %s extends {$options['class']} if (!$class || str_contains($class, '$') || \in_array($class, ['int', 'float', 'string', 'bool', 'resource', 'object', 'array', 'null', 'callable', 'iterable', 'mixed', 'void'], true)) { continue; } - if (!(class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false)) || (new \ReflectionClass($class))->isUserDefined()) { + if (!(class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false)) || ((new \ReflectionClass($class))->isUserDefined() && !\in_array($class, ['Attribute', 'JsonException', 'ReturnTypeWillChange', 'Stringable', 'UnhandledMatchError', 'ValueError'], true))) { $code[$options['class'].'.preload.php'] .= sprintf("\$classes[] = '%s';\n", $class); } } @@ -1491,10 +1491,11 @@ private function addDefaultParametersMethod(): string if ($key !== $resolvedKey = $this->container->resolveEnvPlaceholders($key)) { throw new InvalidArgumentException(sprintf('Parameter name cannot use env parameters: "%s".', $resolvedKey)); } - $export = $this->exportParameters([$value]); + $hasEnum = false; + $export = $this->exportParameters([$value], '', 12, $hasEnum); $export = explode('0 => ', substr(rtrim($export, " ]\n"), 2, -1), 2); - if (preg_match("/\\\$this->(?:getEnv\('(?:[-.\w]*+:)*+\w++'\)|targetDir\.'')/", $export[1])) { + if ($hasEnum || preg_match("/\\\$this->(?:getEnv\('(?:[-.\w]*+:)*+\w++'\)|targetDir\.'')/", $export[1])) { $dynamicPhp[$key] = sprintf('%scase %s: $value = %s; break;', $export[0], $this->export($key), $export[1]); } else { $php[] = sprintf('%s%s => %s,', $export[0], $this->export($key), $export[1]); @@ -1504,7 +1505,7 @@ private function addDefaultParametersMethod(): string $code = <<<'EOF' - public function getParameter(string $name): array|string|int|float|bool|null + public function getParameter(string $name): array|bool|string|int|float|\UnitEnum|null { if (isset($this->buildParameters[$name])) { return $this->buildParameters[$name]; @@ -1595,12 +1596,12 @@ protected function getDefaultParameters(): array /** * @throws InvalidArgumentException */ - private function exportParameters(array $parameters, string $path = '', int $indent = 12): string + private function exportParameters(array $parameters, string $path = '', int $indent = 12, bool &$hasEnum = false): string { $php = []; foreach ($parameters as $key => $value) { if (\is_array($value)) { - $value = $this->exportParameters($value, $path.'/'.$key, $indent + 4); + $value = $this->exportParameters($value, $path.'/'.$key, $indent + 4, $hasEnum); } elseif ($value instanceof ArgumentInterface) { throw new InvalidArgumentException(sprintf('You cannot dump a container with parameters that contain special arguments. "%s" found in "%s".', get_debug_type($value), $path.'/'.$key)); } elseif ($value instanceof Variable) { @@ -1611,6 +1612,9 @@ private function exportParameters(array $parameters, string $path = '', int $ind throw new InvalidArgumentException(sprintf('You cannot dump a container with parameters that contain references to other services (reference to service "%s" found in "%s").', $value, $path.'/'.$key)); } elseif ($value instanceof Expression) { throw new InvalidArgumentException(sprintf('You cannot dump a container with parameters that contain expressions. Expression "%s" found in "%s".', $value, $path.'/'.$key)); + } elseif ($value instanceof \UnitEnum) { + $hasEnum = true; + $value = sprintf('\%s::%s', \get_class($value), $value->name); } else { $value = $this->export($value); } diff --git a/Loader/Configurator/ParametersConfigurator.php b/Loader/Configurator/ParametersConfigurator.php index d3e9fd9e7..302255b04 100644 --- a/Loader/Configurator/ParametersConfigurator.php +++ b/Loader/Configurator/ParametersConfigurator.php @@ -12,6 +12,8 @@ namespace Symfony\Component\DependencyInjection\Loader\Configurator; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use Symfony\Component\ExpressionLanguage\Expression; /** * @author Nicolas Grekas
@@ -32,6 +34,10 @@ public function __construct(ContainerBuilder $container)
*/
final public function set(string $name, mixed $value): static
{
+ if ($value instanceof Expression) {
+ throw new InvalidArgumentException(sprintf('Using an expression in parameter "%s" is not allowed.', $name));
+ }
+
$this->container->setParameter($name, static::processValue($value, true));
return $this;
diff --git a/Loader/YamlFileLoader.php b/Loader/YamlFileLoader.php
index 2c7f41364..8d7c3ab6e 100644
--- a/Loader/YamlFileLoader.php
+++ b/Loader/YamlFileLoader.php
@@ -883,6 +883,10 @@ private function resolveServices(mixed $value, string $file, bool $isParameter =
$value[$k] = $this->resolveServices($v, $file, $isParameter);
}
} elseif (\is_string($value) && str_starts_with($value, '@=')) {
+ if ($isParameter) {
+ throw new InvalidArgumentException(sprintf('Using expressions in parameters is not allowed in "%s".', $file));
+ }
+
if (!class_exists(Expression::class)) {
throw new \LogicException('The "@=" expression syntax cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".');
}
diff --git a/ParameterBag/ContainerBag.php b/ParameterBag/ContainerBag.php
index d6559d894..ec5876f50 100644
--- a/ParameterBag/ContainerBag.php
+++ b/ParameterBag/ContainerBag.php
@@ -36,7 +36,7 @@ public function all(): array
/**
* {@inheritdoc}
*/
- public function get(string $name): array|bool|string|int|float|null
+ public function get(string $name): array|bool|string|int|float|\UnitEnum|null
{
return $this->container->getParameter($name);
}
diff --git a/ParameterBag/FrozenParameterBag.php b/ParameterBag/FrozenParameterBag.php
index 0e57d3379..2a617ffd8 100644
--- a/ParameterBag/FrozenParameterBag.php
+++ b/ParameterBag/FrozenParameterBag.php
@@ -53,7 +53,7 @@ public function add(array $parameters)
/**
* {@inheritdoc}
*/
- public function set(string $name, array|bool|string|int|float|null $value)
+ public function set(string $name, array|bool|string|int|float|\UnitEnum|null $value)
{
throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
}
diff --git a/ParameterBag/ParameterBag.php b/ParameterBag/ParameterBag.php
index c29a5ce0c..bfeee834d 100644
--- a/ParameterBag/ParameterBag.php
+++ b/ParameterBag/ParameterBag.php
@@ -59,7 +59,7 @@ public function all(): array
/**
* {@inheritdoc}
*/
- public function get(string $name): array|bool|string|int|float|null
+ public function get(string $name): array|bool|string|int|float|\UnitEnum|null
{
if (!\array_key_exists($name, $this->parameters)) {
if (!$name) {
@@ -99,7 +99,7 @@ public function get(string $name): array|bool|string|int|float|null
/**
* {@inheritdoc}
*/
- public function set(string $name, array|bool|string|int|float|null $value)
+ public function set(string $name, array|bool|string|int|float|\UnitEnum|null $value)
{
$this->parameters[$name] = $value;
}
diff --git a/ParameterBag/ParameterBagInterface.php b/ParameterBag/ParameterBagInterface.php
index 7e276fd8f..0ac3323ff 100644
--- a/ParameterBag/ParameterBagInterface.php
+++ b/ParameterBag/ParameterBagInterface.php
@@ -45,7 +45,7 @@ public function all(): array;
*
* @throws ParameterNotFoundException if the parameter is not defined
*/
- public function get(string $name): array|bool|string|int|float|null;
+ public function get(string $name): array|bool|string|int|float|\UnitEnum|null;
/**
* Removes a parameter.
@@ -57,7 +57,7 @@ public function remove(string $name);
*
* @throws LogicException if the parameter cannot be set
*/
- public function set(string $name, array|bool|string|int|float|null $value);
+ public function set(string $name, array|bool|string|int|float|\UnitEnum|null $value);
/**
* Returns true if a parameter name is defined.
diff --git a/Tests/Dumper/PhpDumperTest.php b/Tests/Dumper/PhpDumperTest.php
index 209079fc7..fbcf4459c 100644
--- a/Tests/Dumper/PhpDumperTest.php
+++ b/Tests/Dumper/PhpDumperTest.php
@@ -24,6 +24,7 @@
use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
+use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface as SymfonyContainerInterface;
use Symfony\Component\DependencyInjection\Definition;
@@ -1219,16 +1220,37 @@ public function testDumpHandlesEnumeration()
->setPublic(true)
->addArgument(FooUnitEnum::BAR);
+ $container->setParameter('unit_enum', FooUnitEnum::BAR);
+ $container->setParameter('enum_array', [FooUnitEnum::BAR, FooUnitEnum::FOO]);
$container->compile();
$dumper = new PhpDumper($container);
- eval('?>'.$dumper->dump([
+ eval('?>'.$dumpedContainer = $dumper->dump([
'class' => 'Symfony_DI_PhpDumper_Test_Enumeration',
]));
+ /** @var Container $container */
$container = new \Symfony_DI_PhpDumper_Test_Enumeration();
$this->assertSame(FooUnitEnum::BAR, $container->get('foo')->getBar());
+ $this->assertSame(FooUnitEnum::BAR, $container->getParameter('unit_enum'));
+ $this->assertSame([FooUnitEnum::BAR, FooUnitEnum::FOO], $container->getParameter('enum_array'));
+ $this->assertStringMatchesFormat(<<<'PHP'
+%A
+ private function getDynamicParameter(string $name)
+ {
+ switch ($name) {
+ case 'unit_enum': $value = \Symfony\Component\DependencyInjection\Tests\Fixtures\FooUnitEnum::BAR; break;
+ case 'enum_array': $value = [
+ 0 => \Symfony\Component\DependencyInjection\Tests\Fixtures\FooUnitEnum::BAR,
+ 1 => \Symfony\Component\DependencyInjection\Tests\Fixtures\FooUnitEnum::FOO,
+ ]; break;
+ default: throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name));
+ }
+%A
+PHP
+ , $dumpedContainer
+ );
}
public function testUninitializedSyntheticReference()
diff --git a/Tests/Dumper/XmlDumperTest.php b/Tests/Dumper/XmlDumperTest.php
index 067db14e9..deca0a196 100644
--- a/Tests/Dumper/XmlDumperTest.php
+++ b/Tests/Dumper/XmlDumperTest.php
@@ -49,13 +49,6 @@ public function testExportParameters()
$this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/xml/services8.xml', $dumper->dump(), '->dump() dumps parameters');
}
- public function testAddParameters()
- {
- $container = include self::$fixturesPath.'//containers/container8.php';
- $dumper = new XmlDumper($container);
- $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/xml/services8.xml', $dumper->dump(), '->dump() dumps parameters');
- }
-
public function testAddService()
{
$container = include self::$fixturesPath.'/containers/container9.php';
@@ -255,6 +248,9 @@ public function testDumpHandlesEnumeration()
->setPublic(true)
->addArgument(FooUnitEnum::BAR);
+ $container->setParameter('unit_enum', FooUnitEnum::BAR);
+ $container->setParameter('enum_array', [FooUnitEnum::BAR, FooUnitEnum::FOO]);
+
$container->compile();
$dumper = new XmlDumper($container);
diff --git a/Tests/Dumper/YamlDumperTest.php b/Tests/Dumper/YamlDumperTest.php
index 0fed70bb0..1bfd222ed 100644
--- a/Tests/Dumper/YamlDumperTest.php
+++ b/Tests/Dumper/YamlDumperTest.php
@@ -144,6 +144,9 @@ public function testDumpHandlesEnumeration()
->setPublic(true)
->addArgument(FooUnitEnum::BAR);
+ $container->setParameter('unit_enum', FooUnitEnum::BAR);
+ $container->setParameter('enum_array', [FooUnitEnum::BAR, FooUnitEnum::FOO]);
+
$container->compile();
$dumper = new YamlDumper($container);
diff --git a/Tests/Fixtures/FooUnitEnum.php b/Tests/Fixtures/FooUnitEnum.php
index d51cf9c99..e6ce96391 100644
--- a/Tests/Fixtures/FooUnitEnum.php
+++ b/Tests/Fixtures/FooUnitEnum.php
@@ -5,4 +5,5 @@
enum FooUnitEnum
{
case BAR;
+ case FOO;
}
diff --git a/Tests/Fixtures/php/services10.php b/Tests/Fixtures/php/services10.php
index c0d747a7a..41ac6df9c 100644
--- a/Tests/Fixtures/php/services10.php
+++ b/Tests/Fixtures/php/services10.php
@@ -48,7 +48,7 @@ protected function getTestService()
return $this->services['test'] = new \stdClass(['only dot' => '.', 'concatenation as value' => '.\'\'.', 'concatenation from the start value' => '\'\'.', '.' => 'dot as a key', '.\'\'.' => 'concatenation as a key', '\'\'.' => 'concatenation from the start key', 'optimize concatenation' => 'string1-string2', 'optimize concatenation with empty string' => 'string1string2', 'optimize concatenation from the start' => 'start', 'optimize concatenation at the end' => 'end', 'new line' => 'string with '."\n".'new line']);
}
- public function getParameter(string $name): array|string|int|float|bool|null
+ public function getParameter(string $name): array|bool|string|int|float|\UnitEnum|null
{
if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
diff --git a/Tests/Fixtures/php/services12.php b/Tests/Fixtures/php/services12.php
index ffa52cb3c..275f553df 100644
--- a/Tests/Fixtures/php/services12.php
+++ b/Tests/Fixtures/php/services12.php
@@ -48,7 +48,7 @@ protected function getTestService()
return $this->services['test'] = new \stdClass(('file://'.\dirname(__DIR__, 1)), [('file://'.\dirname(__DIR__, 1)) => (\dirname(__DIR__, 2).'/')]);
}
- public function getParameter(string $name): array|string|int|float|bool|null
+ public function getParameter(string $name): array|bool|string|int|float|\UnitEnum|null
{
if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
diff --git a/Tests/Fixtures/php/services19.php b/Tests/Fixtures/php/services19.php
index 0c6fb392d..038ed1460 100644
--- a/Tests/Fixtures/php/services19.php
+++ b/Tests/Fixtures/php/services19.php
@@ -63,7 +63,7 @@ protected function getServiceWithMethodCallAndFactoryService()
return $instance;
}
- public function getParameter(string $name): array|string|int|float|bool|null
+ public function getParameter(string $name): array|bool|string|int|float|\UnitEnum|null
{
if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
diff --git a/Tests/Fixtures/php/services26.php b/Tests/Fixtures/php/services26.php
index 3e98b3507..4ae8d63c7 100644
--- a/Tests/Fixtures/php/services26.php
+++ b/Tests/Fixtures/php/services26.php
@@ -59,7 +59,7 @@ protected function getTestService()
return $this->services['test'] = new ${($_ = $this->getEnv('FOO')) && false ?: "_"}($this->getEnv('Bar'), 'foo'.$this->getEnv('string:FOO').'baz', $this->getEnv('int:Baz'));
}
- public function getParameter(string $name): array|string|int|float|bool|null
+ public function getParameter(string $name): array|bool|string|int|float|\UnitEnum|null
{
if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
diff --git a/Tests/Fixtures/php/services8.php b/Tests/Fixtures/php/services8.php
index 1946a9e52..a2928c29f 100644
--- a/Tests/Fixtures/php/services8.php
+++ b/Tests/Fixtures/php/services8.php
@@ -35,7 +35,7 @@ public function isCompiled(): bool
return true;
}
- public function getParameter(string $name): array|string|int|float|bool|null
+ public function getParameter(string $name): array|bool|string|int|float|\UnitEnum|null
{
if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
diff --git a/Tests/Fixtures/php/services9_as_files.txt b/Tests/Fixtures/php/services9_as_files.txt
index 3f93e3037..e91f08f4f 100644
--- a/Tests/Fixtures/php/services9_as_files.txt
+++ b/Tests/Fixtures/php/services9_as_files.txt
@@ -821,7 +821,7 @@ class ProjectServiceContainer extends Container
return $instance;
}
- public function getParameter(string $name): array|string|int|float|bool|null
+ public function getParameter(string $name): array|bool|string|int|float|\UnitEnum|null
{
if (isset($this->buildParameters[$name])) {
return $this->buildParameters[$name];
diff --git a/Tests/Fixtures/php/services9_compiled.php b/Tests/Fixtures/php/services9_compiled.php
index 3ec66320c..9e09743da 100644
--- a/Tests/Fixtures/php/services9_compiled.php
+++ b/Tests/Fixtures/php/services9_compiled.php
@@ -419,7 +419,7 @@ protected function getFactorySimpleService()
return new \SimpleFactoryClass('foo');
}
- public function getParameter(string $name): array|string|int|float|bool|null
+ public function getParameter(string $name): array|bool|string|int|float|\UnitEnum|null
{
if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
diff --git a/Tests/Fixtures/php/services9_inlined_factories.txt b/Tests/Fixtures/php/services9_inlined_factories.txt
index eb6347e19..2447367de 100644
--- a/Tests/Fixtures/php/services9_inlined_factories.txt
+++ b/Tests/Fixtures/php/services9_inlined_factories.txt
@@ -474,7 +474,7 @@ class ProjectServiceContainer extends Container
return new \SimpleFactoryClass('foo');
}
- public function getParameter(string $name): array|string|int|float|bool|null
+ public function getParameter(string $name): array|bool|string|int|float|\UnitEnum|null
{
if (isset($this->buildParameters[$name])) {
return $this->buildParameters[$name];
diff --git a/Tests/Fixtures/php/services9_lazy_inlined_factories.txt b/Tests/Fixtures/php/services9_lazy_inlined_factories.txt
index 822240560..c3487ac0c 100644
--- a/Tests/Fixtures/php/services9_lazy_inlined_factories.txt
+++ b/Tests/Fixtures/php/services9_lazy_inlined_factories.txt
@@ -94,7 +94,7 @@ class ProjectServiceContainer extends Container
return new \Bar\FooClass(new \Bar\FooLazyClass());
}
- public function getParameter(string $name): array|string|int|float|bool|null
+ public function getParameter(string $name): array|bool|string|int|float|\UnitEnum|null
{
if (isset($this->buildParameters[$name])) {
return $this->buildParameters[$name];
diff --git a/Tests/Fixtures/php/services_array_params.php b/Tests/Fixtures/php/services_array_params.php
index 8bab13be9..3295d21ce 100644
--- a/Tests/Fixtures/php/services_array_params.php
+++ b/Tests/Fixtures/php/services_array_params.php
@@ -52,7 +52,7 @@ protected function getBarService()
return $instance;
}
- public function getParameter(string $name): array|string|int|float|bool|null
+ public function getParameter(string $name): array|bool|string|int|float|\UnitEnum|null
{
if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
diff --git a/Tests/Fixtures/php/services_base64_env.php b/Tests/Fixtures/php/services_base64_env.php
index c5e3f258a..cee2a435a 100644
--- a/Tests/Fixtures/php/services_base64_env.php
+++ b/Tests/Fixtures/php/services_base64_env.php
@@ -35,7 +35,7 @@ public function isCompiled(): bool
return true;
}
- public function getParameter(string $name): array|string|int|float|bool|null
+ public function getParameter(string $name): array|bool|string|int|float|\UnitEnum|null
{
if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
diff --git a/Tests/Fixtures/php/services_csv_env.php b/Tests/Fixtures/php/services_csv_env.php
index 11d11c8d6..054fe1ea8 100644
--- a/Tests/Fixtures/php/services_csv_env.php
+++ b/Tests/Fixtures/php/services_csv_env.php
@@ -35,7 +35,7 @@ public function isCompiled(): bool
return true;
}
- public function getParameter(string $name): array|string|int|float|bool|null
+ public function getParameter(string $name): array|bool|string|int|float|\UnitEnum|null
{
if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
diff --git a/Tests/Fixtures/php/services_default_env.php b/Tests/Fixtures/php/services_default_env.php
index 0448e7b21..82044d62d 100644
--- a/Tests/Fixtures/php/services_default_env.php
+++ b/Tests/Fixtures/php/services_default_env.php
@@ -35,7 +35,7 @@ public function isCompiled(): bool
return true;
}
- public function getParameter(string $name): array|string|int|float|bool|null
+ public function getParameter(string $name): array|bool|string|int|float|\UnitEnum|null
{
if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
diff --git a/Tests/Fixtures/php/services_env_in_id.php b/Tests/Fixtures/php/services_env_in_id.php
index dd4b93499..e8f3ddb8e 100644
--- a/Tests/Fixtures/php/services_env_in_id.php
+++ b/Tests/Fixtures/php/services_env_in_id.php
@@ -67,7 +67,7 @@ protected function getFooService()
return $this->services['foo'] = new \stdClass(($this->privates['bar_%env(BAR)%'] ?? ($this->privates['bar_%env(BAR)%'] = new \stdClass())), ['baz_'.$this->getEnv('string:BAR') => new \stdClass()]);
}
- public function getParameter(string $name): array|string|int|float|bool|null
+ public function getParameter(string $name): array|bool|string|int|float|\UnitEnum|null
{
if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
diff --git a/Tests/Fixtures/php/services_errored_definition.php b/Tests/Fixtures/php/services_errored_definition.php
index 4b21be584..621a04c9e 100644
--- a/Tests/Fixtures/php/services_errored_definition.php
+++ b/Tests/Fixtures/php/services_errored_definition.php
@@ -419,7 +419,7 @@ protected function getFactorySimpleService()
return new \SimpleFactoryClass('foo');
}
- public function getParameter(string $name): array|string|int|float|bool|null
+ public function getParameter(string $name): array|bool|string|int|float|\UnitEnum|null
{
if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
diff --git a/Tests/Fixtures/php/services_inline_requires.php b/Tests/Fixtures/php/services_inline_requires.php
index 8271065a5..50f874d8f 100644
--- a/Tests/Fixtures/php/services_inline_requires.php
+++ b/Tests/Fixtures/php/services_inline_requires.php
@@ -87,7 +87,7 @@ protected function getC2Service()
return $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C2'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2(new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3());
}
- public function getParameter(string $name): array|string|int|float|bool|null
+ public function getParameter(string $name): array|bool|string|int|float|\UnitEnum|null
{
if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
diff --git a/Tests/Fixtures/php/services_json_env.php b/Tests/Fixtures/php/services_json_env.php
index 82057518e..ef9b95f2e 100644
--- a/Tests/Fixtures/php/services_json_env.php
+++ b/Tests/Fixtures/php/services_json_env.php
@@ -35,7 +35,7 @@ public function isCompiled(): bool
return true;
}
- public function getParameter(string $name): array|string|int|float|bool|null
+ public function getParameter(string $name): array|bool|string|int|float|\UnitEnum|null
{
if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
diff --git a/Tests/Fixtures/php/services_query_string_env.php b/Tests/Fixtures/php/services_query_string_env.php
index 83e8d7bc6..6d147b930 100644
--- a/Tests/Fixtures/php/services_query_string_env.php
+++ b/Tests/Fixtures/php/services_query_string_env.php
@@ -35,7 +35,7 @@ public function isCompiled(): bool
return true;
}
- public function getParameter(string $name): array|string|int|float|bool|null
+ public function getParameter(string $name): array|bool|string|int|float|\UnitEnum|null
{
if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
diff --git a/Tests/Fixtures/php/services_rot13_env.php b/Tests/Fixtures/php/services_rot13_env.php
index 27c2a5795..a17f9ed56 100644
--- a/Tests/Fixtures/php/services_rot13_env.php
+++ b/Tests/Fixtures/php/services_rot13_env.php
@@ -72,7 +72,7 @@ protected function getContainer_EnvVarProcessorsLocatorService()
]);
}
- public function getParameter(string $name): array|string|int|float|bool|null
+ public function getParameter(string $name): array|bool|string|int|float|\UnitEnum|null
{
if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
diff --git a/Tests/Fixtures/php/services_unsupported_characters.php b/Tests/Fixtures/php/services_unsupported_characters.php
index 68d442f63..7e03f763a 100644
--- a/Tests/Fixtures/php/services_unsupported_characters.php
+++ b/Tests/Fixtures/php/services_unsupported_characters.php
@@ -70,7 +70,7 @@ protected function getFooohnoService()
return $this->services['foo*/oh-no'] = new \FooClass();
}
- public function getParameter(string $name): array|string|int|float|bool|null
+ public function getParameter(string $name): array|bool|string|int|float|\UnitEnum|null
{
if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
diff --git a/Tests/Fixtures/php/services_url_env.php b/Tests/Fixtures/php/services_url_env.php
index ff5fd5ccf..b370f8db7 100644
--- a/Tests/Fixtures/php/services_url_env.php
+++ b/Tests/Fixtures/php/services_url_env.php
@@ -35,7 +35,7 @@ public function isCompiled(): bool
return true;
}
- public function getParameter(string $name): array|string|int|float|bool|null
+ public function getParameter(string $name): array|bool|string|int|float|\UnitEnum|null
{
if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
diff --git a/Tests/Fixtures/xml/services_with_enumeration.xml b/Tests/Fixtures/xml/services_with_enumeration.xml
index 30e80f005..3f26d968a 100644
--- a/Tests/Fixtures/xml/services_with_enumeration.xml
+++ b/Tests/Fixtures/xml/services_with_enumeration.xml
@@ -1,5 +1,12 @@
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages. Alternative Proxies:Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.