Repository: symfony/symfony
File: src/Symfony/Component/Cache/DependencyInjection/CachePoolPass.php (PHP)

Code before:
                        ->addArgument(new Reference($tags[0]['early_expiration_message_bus']))
                        ->addArgument(new Reference('reverse_container'))
                        ->addArgument((new Definition('callable'))
                            ->setFactory([new Reference($id), 'setCallbackWrapper'])
                            ->addArgument(null)
                        ),
                    ]);
                    $pool->addTag('container.reversible');
                } elseif ('pruneable' === $attr) {
                    // no-op
                } elseif ('namespace' !== $attr || !\in_array($class, [ArrayAdapter::class, NullAdapter::class, TagAwareAdapter::class], true)) {
                    $argument = $tags[0][$attr];

                    if ('default_lifetime' === $attr && !is_numeric($argument)) {
                        $argument = (new Definition('int', [$argument]))
                            ->setFactory([ParameterNormalizer::class, 'normalizeDuration']);
                    }

                    $pool->replaceArgument($i++, $argument);
                }
                unset($tags[0][$attr]);
            }

            if (null !== $marshallerServiceId && ChainAdapter::class !== $class) {
                $marshallerIndex = $this->findDefaultMarshallerArgumentIndex($adapter);
                if (null === $marshallerIndex) {
                    throw new InvalidArgumentException(\sprintf('The "marshaller" attribute of the "cache.pool" tag for service "%s" is not supported by adapter "%s".', $id, $class));
                }
                $pool->replaceArgument($marshallerIndex, new Reference($marshallerServiceId));
            }

            if (!empty($tags[0])) {
                throw new InvalidArgumentException(\sprintf('Invalid "cache.pool" tag for service "%s": accepted attributes are "clearer", "provider", "name", "namespace", "default_lifetime", "early_expiration_message_bus", "reset", "pruneable" and "marshaller", found "%s".', $id, implode('", "', array_keys($tags[0]))));
            }

            if (null !== $clearer) {
                $clearers[$clearer][$name] = new Reference($id, $container::IGNORE_ON_UNINITIALIZED_REFERENCE);
            }

            $poolTags = $pool->getTags();
            $poolTags['cache.pool'][0]['pruneable'] ??= $pruneable;
            $pool->setTags($poolTags);

            $allPools[$name] = new Reference($id, $container::IGNORE_ON_UNINITIALIZED_REFERENCE);
        }

        if (!$needsMessageHandler) {
            $container->removeDefinition('cache.early_expiration_handler');
        }

        $notAliasedCacheClearerId = 'cache.global_clearer';

Review comment (suggestion):
```suggestion
                if (null === $marshallerIndex = $this->findDefaultMarshallerArgumentIndex($adapter)) {
```

Code after:
                        ->addArgument(new Reference('reverse_container'))
                        ->addArgument((new Definition('callable'))
                            ->setFactory([new Reference($id), 'setCallbackWrapper'])
                            ->addArgument(null)
                        ),
                    ]);
                    $pool->addTag('container.reversible');
                } elseif ('pruneable' === $attr) {
                    // no-op
                } elseif ('namespace' !== $attr || !\in_array($class, [ArrayAdapter::class, NullAdapter::class, TagAwareAdapter::class], true)) {
                    $argument = $tags[0][$attr];

                    if ('default_lifetime' === $attr && !is_numeric($argument)) {
                        $argument = (new Definition('int', [$argument]))
                            ->setFactory([ParameterNormalizer::class, 'normalizeDuration']);
                    }

                    $pool->replaceArgument($i++, $argument);
                }
                unset($tags[0][$attr]);
            }

            if (null !== $marshallerServiceId && ChainAdapter::class !== $class) {
                if (null === $marshallerIndex = $this->findDefaultMarshallerArgumentIndex($adapter)) {
                    throw new InvalidArgumentException(\sprintf('The "marshaller" attribute of the "cache.pool" tag for service "%s" is not supported by adapter "%s".', $id, $class));
                }
                $pool->replaceArgument($marshallerIndex, new Reference($marshallerServiceId));
            }

            if (!empty($tags[0])) {
                throw new InvalidArgumentException(\sprintf('Invalid "cache.pool" tag for service "%s": accepted attributes are "clearer", "provider", "name", "namespace", "default_lifetime", "early_expiration_message_bus", "reset", "pruneable" and "marshaller", found "%s".', $id, implode('", "', array_keys($tags[0]))));
            }

            if (null !== $clearer) {
                $clearers[$clearer][$name] = new Reference($id, $container::IGNORE_ON_UNINITIALIZED_REFERENCE);
            }

            $poolTags = $pool->getTags();
            $poolTags['cache.pool'][0]['pruneable'] ??= $pruneable;
            $pool->setTags($poolTags);

            $allPools[$name] = new Reference($id, $container::IGNORE_ON_UNINITIALIZED_REFERENCE);
        }

        if (!$needsMessageHandler) {
            $container->removeDefinition('cache.early_expiration_handler');
        }

        $notAliasedCacheClearerId = 'cache.global_clearer';
        while ($container->hasAlias($notAliasedCacheClearerId)) {
            $notAliasedCacheClearerId = (string) $container->getAlias($notAliasedCacheClearerId);