diff -ruN a/Argument/BoundArgument.php b/Argument/BoundArgument.php --- a/Argument/BoundArgument.php 2026-07-15 12:28:17 +++ b/Argument/BoundArgument.php 2026-07-15 12:28:17 @@ -28,7 +28,7 @@ private int $type; private ?string $file; - public function __construct(mixed $value, bool $trackUsage = true, int $type = 0, string $file = null) + public function __construct(mixed $value, bool $trackUsage = true, int $type = 0, ?string $file = null) { $this->value = $value; if ($trackUsage) { diff -ruN a/Argument/ServiceLocator.php b/Argument/ServiceLocator.php --- a/Argument/ServiceLocator.php 2026-07-15 12:28:17 +++ b/Argument/ServiceLocator.php 2026-07-15 12:28:17 @@ -24,7 +24,7 @@ private array $serviceMap; private ?array $serviceTypes; - public function __construct(\Closure $factory, array $serviceMap, array $serviceTypes = null) + public function __construct(\Closure $factory, array $serviceMap, ?array $serviceTypes = null) { $this->factory = $factory; $this->serviceMap = $serviceMap; diff -ruN a/Argument/TaggedIteratorArgument.php b/Argument/TaggedIteratorArgument.php --- a/Argument/TaggedIteratorArgument.php 2026-07-15 12:28:17 +++ b/Argument/TaggedIteratorArgument.php 2026-07-15 12:28:17 @@ -31,7 +31,7 @@ * @param bool $needsIndexes Whether indexes are required and should be generated when computing the map * @param string|null $defaultPriorityMethod The static method that should be called to get each service's priority when their tag doesn't define the "priority" attribute */ - public function __construct(string $tag, string $indexAttribute = null, string $defaultIndexMethod = null, bool $needsIndexes = false, string $defaultPriorityMethod = null) + public function __construct(string $tag, ?string $indexAttribute = null, ?string $defaultIndexMethod = null, bool $needsIndexes = false, ?string $defaultPriorityMethod = null) { parent::__construct([]); diff -ruN a/Attribute/AutoconfigureTag.php b/Attribute/AutoconfigureTag.php --- a/Attribute/AutoconfigureTag.php 2026-07-15 12:28:17 +++ b/Attribute/AutoconfigureTag.php 2026-07-15 12:28:17 @@ -19,7 +19,7 @@ #[\Attribute(\Attribute::TARGET_CLASS | \Attribute::IS_REPEATABLE)] class AutoconfigureTag extends Autoconfigure { - public function __construct(string $name = null, array $attributes = []) + public function __construct(?string $name = null, array $attributes = []) { parent::__construct( tags: [ diff -ruN a/Compiler/CheckTypeDeclarationsPass.php b/Compiler/CheckTypeDeclarationsPass.php --- a/Compiler/CheckTypeDeclarationsPass.php 2026-07-15 12:28:17 +++ b/Compiler/CheckTypeDeclarationsPass.php 2026-07-15 12:28:17 @@ -158,7 +158,7 @@ /** * @throws InvalidParameterTypeException When a parameter is not compatible with the declared type */ - private function checkType(Definition $checkedDefinition, mixed $value, \ReflectionParameter $parameter, ?string $envPlaceholderUniquePrefix, \ReflectionType $reflectionType = null): void + private function checkType(Definition $checkedDefinition, mixed $value, \ReflectionParameter $parameter, ?string $envPlaceholderUniquePrefix, ?\ReflectionType $reflectionType = null): void { $reflectionType = $reflectionType ?? $parameter->getType(); diff -ruN a/Compiler/InlineServiceDefinitionsPass.php b/Compiler/InlineServiceDefinitionsPass.php --- a/Compiler/InlineServiceDefinitionsPass.php 2026-07-15 12:28:17 +++ b/Compiler/InlineServiceDefinitionsPass.php 2026-07-15 12:28:17 @@ -32,7 +32,7 @@ private array $notInlinableIds = []; private $graph = null; - public function __construct(AnalyzeServiceReferencesPass $analyzingPass = null) + public function __construct(?AnalyzeServiceReferencesPass $analyzingPass = null) { $this->analyzingPass = $analyzingPass; } diff -ruN a/Compiler/MergeExtensionConfigurationPass.php b/Compiler/MergeExtensionConfigurationPass.php --- a/Compiler/MergeExtensionConfigurationPass.php 2026-07-15 12:28:17 +++ b/Compiler/MergeExtensionConfigurationPass.php 2026-07-15 12:28:17 @@ -153,7 +153,7 @@ { private string $extensionClass; - public function __construct(ExtensionInterface $extension, ParameterBagInterface $parameterBag = null) + public function __construct(ExtensionInterface $extension, ?ParameterBagInterface $parameterBag = null) { parent::__construct($parameterBag); @@ -187,7 +187,7 @@ /** * {@inheritdoc} */ - public function resolveEnvPlaceholders(mixed $value, string|bool $format = null, array &$usedEnvs = null): mixed + public function resolveEnvPlaceholders(mixed $value, string|bool|null $format = null, ?array &$usedEnvs = null): mixed { if (true !== $format || !\is_string($value)) { return parent::resolveEnvPlaceholders($value, $format, $usedEnvs); diff -ruN a/Compiler/ServiceLocatorTagPass.php b/Compiler/ServiceLocatorTagPass.php --- a/Compiler/ServiceLocatorTagPass.php 2026-07-15 12:28:17 +++ b/Compiler/ServiceLocatorTagPass.php 2026-07-15 12:28:17 @@ -104,7 +104,7 @@ /** * @param Reference[] $refMap */ - public static function register(ContainerBuilder $container, array $refMap, string $callerId = null): Reference + public static function register(ContainerBuilder $container, array $refMap, ?string $callerId = null): Reference { foreach ($refMap as $id => $ref) { if (!$ref instanceof Reference) { diff -ruN a/Compiler/ServiceReferenceGraph.php b/Compiler/ServiceReferenceGraph.php --- a/Compiler/ServiceReferenceGraph.php 2026-07-15 12:28:17 +++ b/Compiler/ServiceReferenceGraph.php 2026-07-15 12:28:17 @@ -74,7 +74,7 @@ /** * Connects 2 nodes together in the Graph. */ - public function connect(?string $sourceId, mixed $sourceValue, ?string $destId, mixed $destValue = null, Reference $reference = null, bool $lazy = false, bool $weak = false, bool $byConstructor = false) + public function connect(?string $sourceId, mixed $sourceValue, ?string $destId, mixed $destValue = null, ?Reference $reference = null, bool $lazy = false, bool $weak = false, bool $byConstructor = false) { if (null === $sourceId || null === $destId) { return; diff -ruN a/Container.php b/Container.php --- a/Container.php 2026-07-15 12:28:17 +++ b/Container.php 2026-07-15 12:28:17 @@ -62,7 +62,7 @@ private bool $compiled = false; private \Closure $getEnv; - public function __construct(ParameterBagInterface $parameterBag = null) + public function __construct(?ParameterBagInterface $parameterBag = null) { $this->parameterBag = $parameterBag ?? new EnvPlaceholderParameterBag(); } diff -ruN a/ContainerAwareInterface.php b/ContainerAwareInterface.php --- a/ContainerAwareInterface.php 2026-07-15 12:28:17 +++ b/ContainerAwareInterface.php 2026-07-15 12:28:17 @@ -21,5 +21,5 @@ /** * Sets the container. */ - public function setContainer(ContainerInterface $container = null); + public function setContainer(?ContainerInterface $container = null); } diff -ruN a/ContainerAwareTrait.php b/ContainerAwareTrait.php --- a/ContainerAwareTrait.php 2026-07-15 12:28:17 +++ b/ContainerAwareTrait.php 2026-07-15 12:28:17 @@ -23,7 +23,7 @@ */ protected $container; - public function setContainer(ContainerInterface $container = null) + public function setContainer(?ContainerInterface $container = null) { $this->container = $container; } diff -ruN a/ContainerBuilder.php b/ContainerBuilder.php --- a/ContainerBuilder.php 2026-07-15 12:28:17 +++ b/ContainerBuilder.php 2026-07-15 12:28:17 @@ -147,7 +147,7 @@ 'mixed' => true, ]; - public function __construct(ParameterBagInterface $parameterBag = null) + public function __construct(?ParameterBagInterface $parameterBag = null) { parent::__construct($parameterBag); @@ -416,7 +416,7 @@ * @throws BadMethodCallException When this ContainerBuilder is compiled * @throws \LogicException if the extension is not registered */ - public function loadFromExtension(string $extension, array $values = null): static + public function loadFromExtension(string $extension, ?array $values = null): static { if ($this->isCompiled()) { throw new BadMethodCallException('Cannot load from an extension on a compiled container.'); @@ -512,7 +512,7 @@ return $this->doGet($id, $invalidBehavior); } - private function doGet(string $id, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, array &$inlineServices = null, bool $isConstructorArgument = false): mixed + private function doGet(string $id, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, ?array &$inlineServices = null, bool $isConstructorArgument = false): mixed { if (isset($inlineServices[$id])) { return $inlineServices[$id]; @@ -845,7 +845,7 @@ * This methods allows for simple registration of service definition * with a fluid interface. */ - public function register(string $id, string $class = null): Definition + public function register(string $id, ?string $class = null): Definition { return $this->setDefinition($id, new Definition($class)); } @@ -856,7 +856,7 @@ * This method implements a shortcut for using setDefinition() with * an autowired definition. */ - public function autowire(string $id, string $class = null): Definition + public function autowire(string $id, ?string $class = null): Definition { return $this->setDefinition($id, (new Definition($class))->setAutowired(true)); } @@ -970,7 +970,7 @@ * @throws RuntimeException When the service is a synthetic service * @throws InvalidArgumentException When configure callable is not callable */ - private function createService(Definition $definition, array &$inlineServices, bool $isConstructorArgument = false, string $id = null, bool $tryProxy = true): mixed + private function createService(Definition $definition, array &$inlineServices, bool $isConstructorArgument = false, ?string $id = null, bool $tryProxy = true): mixed { if (null === $id && isset($inlineServices[$h = spl_object_hash($definition)])) { return $inlineServices[$h]; @@ -1282,7 +1282,7 @@ * "$fooBar"-named arguments with $type as type-hint. Such arguments will * receive the service $id when autowiring is used. */ - public function registerAliasForArgument(string $id, string $type, string $name = null): Alias + public function registerAliasForArgument(string $id, string $type, ?string $name = null): Alias { $name = (new Target($name ?? $id))->name; @@ -1321,7 +1321,7 @@ * * @return mixed The value with env parameters resolved if a string or an array is passed */ - public function resolveEnvPlaceholders(mixed $value, string|bool $format = null, array &$usedEnvs = null): mixed + public function resolveEnvPlaceholders(mixed $value, string|bool|null $format = null, ?array &$usedEnvs = null): mixed { if (null === $format) { $format = '%%env(%s)%%'; diff -ruN a/Definition.php b/Definition.php --- a/Definition.php 2026-07-15 12:28:17 +++ b/Definition.php 2026-07-15 12:28:17 @@ -61,7 +61,7 @@ */ public ?int $decorationOnInvalid = null; - public function __construct(string $class = null, array $arguments = []) + public function __construct(?string $class = null, array $arguments = []) { if (null !== $class) { $this->setClass($class); @@ -133,7 +133,7 @@ * * @throws InvalidArgumentException in case the decorated service id and the new decorated service id are equals */ - public function setDecoratedService(?string $id, string $renamedId = null, int $priority = 0, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE): static + public function setDecoratedService(?string $id, ?string $renamedId = null, int $priority = 0, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE): static { if ($renamedId && $id === $renamedId) { throw new InvalidArgumentException(sprintf('The decorated service inner name for "%s" must be different than the service name itself.', $id)); diff -ruN a/Dumper/PhpDumper.php b/Dumper/PhpDumper.php --- a/Dumper/PhpDumper.php 2026-07-15 12:28:17 +++ b/Dumper/PhpDumper.php 2026-07-15 12:28:17 @@ -1014,7 +1014,7 @@ return $code; } - private function addInlineService(string $id, Definition $definition, Definition $inlineDef = null, bool $forConstructor = true): string + private function addInlineService(string $id, Definition $definition, ?Definition $inlineDef = null, bool $forConstructor = true): string { $code = ''; @@ -1071,7 +1071,7 @@ return $code; } - private function addServices(array &$services = null): string + private function addServices(?array &$services = null): string { $publicServices = $privateServices = ''; $definitions = $this->container->getDefinitions(); @@ -1113,7 +1113,7 @@ } } - private function addNewInstance(Definition $definition, string $return = '', string $id = null): string + private function addNewInstance(Definition $definition, string $return = '', ?string $id = null): string { $tail = $return ? ";\n" : ''; @@ -1671,7 +1671,7 @@ return implode(' && ', $conditions); } - private function getDefinitionsFromArguments(array $arguments, \SplObjectStorage $definitions = null, array &$calls = [], bool $byConstructor = null): \SplObjectStorage + private function getDefinitionsFromArguments(array $arguments, ?\SplObjectStorage $definitions = null, array &$calls = [], ?bool $byConstructor = null): \SplObjectStorage { if (null === $definitions) { $definitions = new \SplObjectStorage(); @@ -1902,7 +1902,7 @@ return sprintf('$this->getParameter(%s)', $this->doExport($name)); } - private function getServiceCall(string $id, Reference $reference = null): string + private function getServiceCall(string $id, ?Reference $reference = null): string { while ($this->container->hasAlias($id)) { $id = (string) $this->container->getAlias($id); diff -ruN a/Dumper/YamlDumper.php b/Dumper/YamlDumper.php --- a/Dumper/YamlDumper.php 2026-07-15 12:28:17 +++ b/Dumper/YamlDumper.php 2026-07-15 12:28:17 @@ -307,7 +307,7 @@ return $value; } - private function getServiceCall(string $id, Reference $reference = null): string + private function getServiceCall(string $id, ?Reference $reference = null): string { if (null !== $reference) { switch ($reference->getInvalidBehavior()) { diff -ruN a/EnvVarProcessor.php b/EnvVarProcessor.php --- a/EnvVarProcessor.php 2026-07-15 12:28:17 +++ b/EnvVarProcessor.php 2026-07-15 12:28:17 @@ -27,7 +27,7 @@ /** * @param EnvVarLoaderInterface[] $loaders */ - public function __construct(ContainerInterface $container, \Traversable $loaders = null) + public function __construct(ContainerInterface $container, ?\Traversable $loaders = null) { $this->container = $container; $this->loaders = $loaders ?? new \ArrayIterator(); diff -ruN a/Exception/AutowiringFailedException.php b/Exception/AutowiringFailedException.php --- a/Exception/AutowiringFailedException.php 2026-07-15 12:28:17 +++ b/Exception/AutowiringFailedException.php 2026-07-15 12:28:17 @@ -19,7 +19,7 @@ private string $serviceId; private ?\Closure $messageCallback = null; - public function __construct(string $serviceId, string|\Closure $message = '', int $code = 0, \Throwable $previous = null) + public function __construct(string $serviceId, string|\Closure $message = '', int $code = 0, ?\Throwable $previous = null) { $this->serviceId = $serviceId; diff -ruN a/Exception/EnvParameterException.php b/Exception/EnvParameterException.php --- a/Exception/EnvParameterException.php 2026-07-15 12:28:17 +++ b/Exception/EnvParameterException.php 2026-07-15 12:28:17 @@ -18,7 +18,7 @@ */ class EnvParameterException extends InvalidArgumentException { - public function __construct(array $envs, \Throwable $previous = null, string $message = 'Incompatible use of dynamic environment variables "%s" found in parameters.') + public function __construct(array $envs, ?\Throwable $previous = null, string $message = 'Incompatible use of dynamic environment variables "%s" found in parameters.') { parent::__construct(sprintf($message, implode('", "', $envs)), 0, $previous); } diff -ruN a/Exception/ParameterCircularReferenceException.php b/Exception/ParameterCircularReferenceException.php --- a/Exception/ParameterCircularReferenceException.php 2026-07-15 12:28:17 +++ b/Exception/ParameterCircularReferenceException.php 2026-07-15 12:28:17 @@ -20,7 +20,7 @@ { private array $parameters; - public function __construct(array $parameters, \Throwable $previous = null) + public function __construct(array $parameters, ?\Throwable $previous = null) { parent::__construct(sprintf('Circular reference detected for parameter "%s" ("%s" > "%s").', $parameters[0], implode('" > "', $parameters), $parameters[0]), 0, $previous); diff -ruN a/Exception/ParameterNotFoundException.php b/Exception/ParameterNotFoundException.php --- a/Exception/ParameterNotFoundException.php 2026-07-15 12:28:17 +++ b/Exception/ParameterNotFoundException.php 2026-07-15 12:28:17 @@ -34,7 +34,7 @@ * @param string[] $alternatives Some parameter name alternatives * @param string|null $nonNestedAlternative The alternative parameter name when the user expected dot notation for nested parameters */ - public function __construct(string $key, string $sourceId = null, string $sourceKey = null, \Throwable $previous = null, array $alternatives = [], string $nonNestedAlternative = null) + public function __construct(string $key, ?string $sourceId = null, ?string $sourceKey = null, ?\Throwable $previous = null, array $alternatives = [], ?string $nonNestedAlternative = null) { $this->key = $key; $this->sourceId = $sourceId; diff -ruN a/Exception/ServiceCircularReferenceException.php b/Exception/ServiceCircularReferenceException.php --- a/Exception/ServiceCircularReferenceException.php 2026-07-15 12:28:17 +++ b/Exception/ServiceCircularReferenceException.php 2026-07-15 12:28:17 @@ -21,7 +21,7 @@ private string $serviceId; private array $path; - public function __construct(string $serviceId, array $path, \Throwable $previous = null) + public function __construct(string $serviceId, array $path, ?\Throwable $previous = null) { parent::__construct(sprintf('Circular reference detected for service "%s", path: "%s".', $serviceId, implode(' -> ', $path)), 0, $previous); diff -ruN a/Exception/ServiceNotFoundException.php b/Exception/ServiceNotFoundException.php --- a/Exception/ServiceNotFoundException.php 2026-07-15 12:28:17 +++ b/Exception/ServiceNotFoundException.php 2026-07-15 12:28:17 @@ -24,7 +24,7 @@ private ?string $sourceId; private array $alternatives; - public function __construct(string $id, string $sourceId = null, \Throwable $previous = null, array $alternatives = [], string $msg = null) + public function __construct(string $id, ?string $sourceId = null, ?\Throwable $previous = null, array $alternatives = [], ?string $msg = null) { if (null !== $msg) { // no-op diff -ruN a/ExpressionLanguage.php b/ExpressionLanguage.php --- a/ExpressionLanguage.php 2026-07-15 12:28:17 +++ b/ExpressionLanguage.php 2026-07-15 12:28:17 @@ -30,7 +30,7 @@ /** * {@inheritdoc} */ - public function __construct(CacheItemPoolInterface $cache = null, array $providers = [], callable $serviceCompiler = null) + public function __construct(?CacheItemPoolInterface $cache = null, array $providers = [], ?callable $serviceCompiler = null) { // prepend the default provider to let users override it easily array_unshift($providers, new ExpressionLanguageProvider($serviceCompiler)); diff -ruN a/ExpressionLanguageProvider.php b/ExpressionLanguageProvider.php --- a/ExpressionLanguageProvider.php 2026-07-15 12:28:17 +++ b/ExpressionLanguageProvider.php 2026-07-15 12:28:17 @@ -26,7 +26,7 @@ { private ?\Closure $serviceCompiler; - public function __construct(callable $serviceCompiler = null) + public function __construct(?callable $serviceCompiler = null) { $this->serviceCompiler = null !== $serviceCompiler && !$serviceCompiler instanceof \Closure ? \Closure::fromCallable($serviceCompiler) : $serviceCompiler; } diff -ruN a/LazyProxy/ProxyHelper.php b/LazyProxy/ProxyHelper.php --- a/LazyProxy/ProxyHelper.php 2026-07-15 12:28:17 +++ b/LazyProxy/ProxyHelper.php 2026-07-15 12:28:17 @@ -21,7 +21,7 @@ /** * @return string|null The FQCN or builtin name of the type hint, or null when the type hint references an invalid self|parent context */ - public static function getTypeHint(\ReflectionFunctionAbstract $r, \ReflectionParameter $p = null, bool $noBuiltin = false): ?string + public static function getTypeHint(\ReflectionFunctionAbstract $r, ?\ReflectionParameter $p = null, bool $noBuiltin = false): ?string { if ($p instanceof \ReflectionParameter) { $type = $p->getType(); diff -ruN a/Loader/ClosureLoader.php b/Loader/ClosureLoader.php --- a/Loader/ClosureLoader.php 2026-07-15 12:28:17 +++ b/Loader/ClosureLoader.php 2026-07-15 12:28:17 @@ -25,7 +25,7 @@ { private $container; - public function __construct(ContainerBuilder $container, string $env = null) + public function __construct(ContainerBuilder $container, ?string $env = null) { $this->container = $container; parent::__construct($env); @@ -34,7 +34,7 @@ /** * {@inheritdoc} */ - public function load(mixed $resource, string $type = null): mixed + public function load(mixed $resource, ?string $type = null): mixed { return $resource($this->container, $this->env); } @@ -42,7 +42,7 @@ /** * {@inheritdoc} */ - public function supports(mixed $resource, string $type = null): bool + public function supports(mixed $resource, ?string $type = null): bool { return $resource instanceof \Closure; } diff -ruN a/Loader/Configurator/AbstractServiceConfigurator.php b/Loader/Configurator/AbstractServiceConfigurator.php --- a/Loader/Configurator/AbstractServiceConfigurator.php 2026-07-15 12:28:17 +++ b/Loader/Configurator/AbstractServiceConfigurator.php 2026-07-15 12:28:17 @@ -20,7 +20,7 @@ protected $id; private array $defaultTags = []; - public function __construct(ServicesConfigurator $parent, Definition $definition, string $id = null, array $defaultTags = []) + public function __construct(ServicesConfigurator $parent, Definition $definition, ?string $id = null, array $defaultTags = []) { $this->parent = $parent; $this->definition = $definition; @@ -42,7 +42,7 @@ /** * Registers a service. */ - final public function set(?string $id, string $class = null): ServiceConfigurator + final public function set(?string $id, ?string $class = null): ServiceConfigurator { $this->__destruct(); @@ -106,7 +106,7 @@ /** * Registers a service. */ - final public function __invoke(string $id, string $class = null): ServiceConfigurator + final public function __invoke(string $id, ?string $class = null): ServiceConfigurator { $this->__destruct(); diff -ruN a/Loader/Configurator/ContainerConfigurator.php b/Loader/Configurator/ContainerConfigurator.php --- a/Loader/Configurator/ContainerConfigurator.php 2026-07-15 12:28:17 +++ b/Loader/Configurator/ContainerConfigurator.php 2026-07-15 12:28:17 @@ -38,7 +38,7 @@ private int $anonymousCount = 0; private ?string $env; - public function __construct(ContainerBuilder $container, PhpFileLoader $loader, array &$instanceof, string $path, string $file, string $env = null) + public function __construct(ContainerBuilder $container, PhpFileLoader $loader, array &$instanceof, string $path, string $file, ?string $env = null) { $this->container = $container; $this->loader = $loader; @@ -58,7 +58,7 @@ $this->container->loadFromExtension($namespace, static::processValue($config)); } - final public function import(string $resource, string $type = null, bool|string $ignoreErrors = false) + final public function import(string $resource, ?string $type = null, bool|string $ignoreErrors = false) { $this->loader->setCurrentDir(\dirname($this->path)); $this->loader->import($resource, $type, $ignoreErrors, $this->file); @@ -111,7 +111,7 @@ /** * Creates an inline service. */ -function inline_service(string $class = null): InlineServiceConfigurator +function inline_service(?string $class = null): InlineServiceConfigurator { return new InlineServiceConfigurator(new Definition($class)); } @@ -139,7 +139,7 @@ /** * Creates a lazy iterator by tag name. */ -function tagged_iterator(string $tag, string $indexAttribute = null, string $defaultIndexMethod = null, string $defaultPriorityMethod = null): TaggedIteratorArgument +function tagged_iterator(string $tag, ?string $indexAttribute = null, ?string $defaultIndexMethod = null, ?string $defaultPriorityMethod = null): TaggedIteratorArgument { return new TaggedIteratorArgument($tag, $indexAttribute, $defaultIndexMethod, false, $defaultPriorityMethod); } @@ -147,7 +147,7 @@ /** * Creates a service locator by tag name. */ -function tagged_locator(string $tag, string $indexAttribute = null, string $defaultIndexMethod = null, string $defaultPriorityMethod = null): ServiceLocatorArgument +function tagged_locator(string $tag, ?string $indexAttribute = null, ?string $defaultIndexMethod = null, ?string $defaultPriorityMethod = null): ServiceLocatorArgument { return new ServiceLocatorArgument(new TaggedIteratorArgument($tag, $indexAttribute, $defaultIndexMethod, true, $defaultPriorityMethod)); } diff -ruN a/Loader/Configurator/DefaultsConfigurator.php b/Loader/Configurator/DefaultsConfigurator.php --- a/Loader/Configurator/DefaultsConfigurator.php 2026-07-15 12:28:17 +++ b/Loader/Configurator/DefaultsConfigurator.php 2026-07-15 12:28:17 @@ -28,7 +28,7 @@ private ?string $path; - public function __construct(ServicesConfigurator $parent, Definition $definition, string $path = null) + public function __construct(ServicesConfigurator $parent, Definition $definition, ?string $path = null) { parent::__construct($parent, $definition, null, []); diff -ruN a/Loader/Configurator/InstanceofConfigurator.php b/Loader/Configurator/InstanceofConfigurator.php --- a/Loader/Configurator/InstanceofConfigurator.php 2026-07-15 12:28:17 +++ b/Loader/Configurator/InstanceofConfigurator.php 2026-07-15 12:28:17 @@ -32,7 +32,7 @@ private ?string $path; - public function __construct(ServicesConfigurator $parent, Definition $definition, string $id, string $path = null) + public function __construct(ServicesConfigurator $parent, Definition $definition, string $id, ?string $path = null) { parent::__construct($parent, $definition, $id, []); diff -ruN a/Loader/Configurator/ServiceConfigurator.php b/Loader/Configurator/ServiceConfigurator.php --- a/Loader/Configurator/ServiceConfigurator.php 2026-07-15 12:28:17 +++ b/Loader/Configurator/ServiceConfigurator.php 2026-07-15 12:28:17 @@ -47,7 +47,7 @@ private ?string $path; private bool $destructed = false; - public function __construct(ContainerBuilder $container, array $instanceof, bool $allowParent, ServicesConfigurator $parent, Definition $definition, ?string $id, array $defaultTags, string $path = null) + public function __construct(ContainerBuilder $container, array $instanceof, bool $allowParent, ServicesConfigurator $parent, Definition $definition, ?string $id, array $defaultTags, ?string $path = null) { $this->container = $container; $this->instanceof = $instanceof; diff -ruN a/Loader/Configurator/ServicesConfigurator.php b/Loader/Configurator/ServicesConfigurator.php --- a/Loader/Configurator/ServicesConfigurator.php 2026-07-15 12:28:17 +++ b/Loader/Configurator/ServicesConfigurator.php 2026-07-15 12:28:17 @@ -34,7 +34,7 @@ private string $anonymousHash; private int $anonymousCount; - public function __construct(ContainerBuilder $container, PhpFileLoader $loader, array &$instanceof, string $path = null, int &$anonymousCount = 0) + public function __construct(ContainerBuilder $container, PhpFileLoader $loader, array &$instanceof, ?string $path = null, int &$anonymousCount = 0) { $this->defaults = new Definition(); $this->container = $container; @@ -70,7 +70,7 @@ * @param string|null $id The service id, or null to create an anonymous service * @param string|null $class The class of the service, or null when $id is also the class name */ - final public function set(?string $id, string $class = null): ServiceConfigurator + final public function set(?string $id, ?string $class = null): ServiceConfigurator { $defaults = $this->defaults; $definition = new Definition(); @@ -180,7 +180,7 @@ /** * Registers a service. */ - final public function __invoke(string $id, string $class = null): ServiceConfigurator + final public function __invoke(string $id, ?string $class = null): ServiceConfigurator { return $this->set($id, $class); } diff -ruN a/Loader/Configurator/Traits/DecorateTrait.php b/Loader/Configurator/Traits/DecorateTrait.php --- a/Loader/Configurator/Traits/DecorateTrait.php 2026-07-15 12:28:17 +++ b/Loader/Configurator/Traits/DecorateTrait.php 2026-07-15 12:28:17 @@ -25,7 +25,7 @@ * * @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 + 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); diff -ruN a/Loader/DirectoryLoader.php b/Loader/DirectoryLoader.php --- a/Loader/DirectoryLoader.php 2026-07-15 12:28:17 +++ b/Loader/DirectoryLoader.php 2026-07-15 12:28:17 @@ -21,7 +21,7 @@ /** * {@inheritdoc} */ - public function load(mixed $file, string $type = null): mixed + public function load(mixed $file, ?string $type = null): mixed { $file = rtrim($file, '/'); $path = $this->locator->locate($file); @@ -45,7 +45,7 @@ /** * {@inheritdoc} */ - public function supports(mixed $resource, string $type = null): bool + public function supports(mixed $resource, ?string $type = null): bool { if ('directory' === $type) { return true; diff -ruN a/Loader/FileLoader.php b/Loader/FileLoader.php --- a/Loader/FileLoader.php 2026-07-15 12:28:17 +++ b/Loader/FileLoader.php 2026-07-15 12:28:17 @@ -40,7 +40,7 @@ protected $singlyImplemented = []; protected $autoRegisterAliasesForSinglyImplementedInterfaces = true; - public function __construct(ContainerBuilder $container, FileLocatorInterface $locator, string $env = null) + public function __construct(ContainerBuilder $container, FileLocatorInterface $locator, ?string $env = null) { $this->container = $container; @@ -52,7 +52,7 @@ * * @param bool|string $ignoreErrors Whether errors should be ignored; pass "not_found" to ignore only when the loaded resource is not found */ - public function import(mixed $resource, string $type = null, bool|string $ignoreErrors = false, string $sourceResource = null, $exclude = null): mixed + public function import(mixed $resource, ?string $type = null, bool|string $ignoreErrors = false, ?string $sourceResource = null, $exclude = null): mixed { $args = \func_get_args(); @@ -91,7 +91,7 @@ * @param string $resource The directory to look for classes, glob-patterns allowed * @param string|string[]|null $exclude A globbed path of files to exclude or an array of globbed paths of files to exclude */ - public function registerClasses(Definition $prototype, string $namespace, string $resource, string|array $exclude = null) + public function registerClasses(Definition $prototype, string $namespace, string $resource, string|array|null $exclude = null) { if (!str_ends_with($namespace, '\\')) { throw new InvalidArgumentException(sprintf('Namespace prefix must end with a "\\": "%s".', $namespace)); diff -ruN a/Loader/GlobFileLoader.php b/Loader/GlobFileLoader.php --- a/Loader/GlobFileLoader.php 2026-07-15 12:28:17 +++ b/Loader/GlobFileLoader.php 2026-07-15 12:28:17 @@ -21,7 +21,7 @@ /** * {@inheritdoc} */ - public function load(mixed $resource, string $type = null): mixed + public function load(mixed $resource, ?string $type = null): mixed { foreach ($this->glob($resource, false, $globResource) as $path => $info) { $this->import($path); @@ -35,7 +35,7 @@ /** * {@inheritdoc} */ - public function supports(mixed $resource, string $type = null): bool + public function supports(mixed $resource, ?string $type = null): bool { return 'glob' === $type; } diff -ruN a/Loader/IniFileLoader.php b/Loader/IniFileLoader.php --- a/Loader/IniFileLoader.php 2026-07-15 12:28:17 +++ b/Loader/IniFileLoader.php 2026-07-15 12:28:17 @@ -24,7 +24,7 @@ /** * {@inheritdoc} */ - public function load(mixed $resource, string $type = null): mixed + public function load(mixed $resource, ?string $type = null): mixed { $path = $this->locator->locate($resource); @@ -57,7 +57,7 @@ /** * {@inheritdoc} */ - public function supports(mixed $resource, string $type = null): bool + public function supports(mixed $resource, ?string $type = null): bool { if (!\is_string($resource)) { return false; diff -ruN a/Loader/PhpFileLoader.php b/Loader/PhpFileLoader.php --- a/Loader/PhpFileLoader.php 2026-07-15 12:28:17 +++ b/Loader/PhpFileLoader.php 2026-07-15 12:28:17 @@ -36,7 +36,7 @@ protected $autoRegisterAliasesForSinglyImplementedInterfaces = false; private $generator; - public function __construct(ContainerBuilder $container, FileLocatorInterface $locator, string $env = null, ConfigBuilderGeneratorInterface $generator = null) + public function __construct(ContainerBuilder $container, FileLocatorInterface $locator, ?string $env = null, ?ConfigBuilderGeneratorInterface $generator = null) { parent::__construct($container, $locator, $env); $this->generator = $generator; @@ -45,7 +45,7 @@ /** * {@inheritdoc} */ - public function load(mixed $resource, string $type = null): mixed + public function load(mixed $resource, ?string $type = null): mixed { // the container and loader variables are exposed to the included file below $container = $this->container; @@ -77,7 +77,7 @@ /** * {@inheritdoc} */ - public function supports(mixed $resource, string $type = null): bool + public function supports(mixed $resource, ?string $type = null): bool { if (!\is_string($resource)) { return false; diff -ruN a/Loader/XmlFileLoader.php b/Loader/XmlFileLoader.php --- a/Loader/XmlFileLoader.php 2026-07-15 12:28:17 +++ b/Loader/XmlFileLoader.php 2026-07-15 12:28:17 @@ -43,7 +43,7 @@ /** * {@inheritdoc} */ - public function load(mixed $resource, string $type = null): mixed + public function load(mixed $resource, ?string $type = null): mixed { $path = $this->locator->locate($resource); @@ -70,7 +70,7 @@ return null; } - private function loadXml(\DOMDocument $xml, string $path, \DOMNode $root = null): void + private function loadXml(\DOMDocument $xml, string $path, ?\DOMNode $root = null): void { $defaults = $this->getServiceDefaults($xml, $path, $root); @@ -98,7 +98,7 @@ /** * {@inheritdoc} */ - public function supports(mixed $resource, string $type = null): bool + public function supports(mixed $resource, ?string $type = null): bool { if (!\is_string($resource)) { return false; @@ -111,14 +111,14 @@ return 'xml' === $type; } - private function parseParameters(\DOMDocument $xml, string $file, \DOMNode $root = null) + private function parseParameters(\DOMDocument $xml, string $file, ?\DOMNode $root = null) { if ($parameters = $this->getChildren($root ?? $xml->documentElement, 'parameters')) { $this->container->getParameterBag()->add($this->getArgumentsAsPhp($parameters[0], 'parameter', $file)); } } - private function parseImports(\DOMDocument $xml, string $file, \DOMNode $root = null) + private function parseImports(\DOMDocument $xml, string $file, ?\DOMNode $root = null) { $xpath = new \DOMXPath($xml); $xpath->registerNamespace('container', self::NS); @@ -134,7 +134,7 @@ } } - private function parseDefinitions(\DOMDocument $xml, string $file, Definition $defaults, \DOMNode $root = null) + private function parseDefinitions(\DOMDocument $xml, string $file, Definition $defaults, ?\DOMNode $root = null) { $xpath = new \DOMXPath($xml); $xpath->registerNamespace('container', self::NS); @@ -192,7 +192,7 @@ } } - private function getServiceDefaults(\DOMDocument $xml, string $file, \DOMNode $root = null): Definition + private function getServiceDefaults(\DOMDocument $xml, string $file, ?\DOMNode $root = null): Definition { $xpath = new \DOMXPath($xml); $xpath->registerNamespace('container', self::NS); @@ -415,7 +415,7 @@ /** * Processes anonymous services. */ - private function processAnonymousServices(\DOMDocument $xml, string $file, \DOMNode $root = null) + private function processAnonymousServices(\DOMDocument $xml, string $file, ?\DOMNode $root = null) { $definitions = []; $count = 0; diff -ruN a/Loader/YamlFileLoader.php b/Loader/YamlFileLoader.php --- a/Loader/YamlFileLoader.php 2026-07-15 12:28:17 +++ b/Loader/YamlFileLoader.php 2026-07-15 12:28:17 @@ -116,7 +116,7 @@ /** * {@inheritdoc} */ - public function load(mixed $resource, string $type = null): mixed + public function load(mixed $resource, ?string $type = null): mixed { $path = $this->locator->locate($resource); @@ -183,7 +183,7 @@ /** * {@inheritdoc} */ - public function supports(mixed $resource, string $type = null): bool + public function supports(mixed $resource, ?string $type = null): bool { if (!\is_string($resource)) { return false; diff -ruN a/ServiceLocator.php b/ServiceLocator.php --- a/ServiceLocator.php 2026-07-15 12:28:17 +++ b/ServiceLocator.php 2026-07-15 12:28:17 @@ -130,7 +130,7 @@ return new ServiceCircularReferenceException($id, $path); } - private function formatAlternatives(array $alternatives = null, string $separator = 'and'): string + private function formatAlternatives(?array $alternatives = null, string $separator = 'and'): string { $format = '"%s"%s'; if (null === $alternatives) { diff -ruN a/TypedReference.php b/TypedReference.php --- a/TypedReference.php 2026-07-15 12:28:17 +++ b/TypedReference.php 2026-07-15 12:28:17 @@ -27,7 +27,7 @@ * @param int $invalidBehavior The behavior when the service does not exist * @param string|null $name The name of the argument targeting the service */ - public function __construct(string $id, string $type, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, string $name = null) + public function __construct(string $id, string $type, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, ?string $name = null) { $this->name = $type === $id ? $name : null; parent::__construct($id, $invalidBehavior);