框架升级及修复升级后的bug

This commit is contained in:
Dev
2026-10-16 18:13:09 +08:00
parent dafb0c96c0
commit 2d342bcbd7
537 changed files with 49836 additions and 40933 deletions
@@ -84,8 +84,7 @@ class CachePoolPass implements CompilerPassInterface
} else {
$clearer = null;
}
$marshallerServiceId = $tags[0]['marshaller'] ?? null;
unset($tags[0]['clearer'], $tags[0]['name'], $tags[0]['marshaller']);
unset($tags[0]['clearer'], $tags[0]['name']);
if (isset($tags[0]['provider'])) {
$tags[0]['provider'] = new Reference(static::getServiceProvider($container, $tags[0]['provider']));
@@ -138,14 +137,6 @@ class CachePoolPass implements CompilerPassInterface
$chainedPool->replaceArgument($i++, $defaultLifetime);
}
if (null !== $marshallerServiceId) {
if (null !== $marshallerIndex = $this->findDefaultMarshallerArgumentIndex($adapter)) {
$chainedPool->replaceArgument($marshallerIndex, new Reference($marshallerServiceId));
} elseif (!\in_array($chainedClass, [ArrayAdapter::class, NullAdapter::class], true)) {
throw new InvalidArgumentException(\sprintf('The "marshaller" attribute of the "cache.pool" tag for service "%s" is not supported by chained adapter "%s".', $id, $chainedClass));
}
}
$adapters[] = $chainedPool;
}
@@ -188,16 +179,8 @@ class CachePoolPass implements CompilerPassInterface
}
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"; its service definition must wire "cache.default_marshaller" as one of its arguments.', $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]))));
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" and "pruneable", found "%s".', $id, implode('", "', array_keys($tags[0]))));
}
if (null !== $clearer) {
@@ -273,15 +256,4 @@ class CachePoolPass implements CompilerPassInterface
return $name;
}
private function findDefaultMarshallerArgumentIndex(Definition $definition): int|string|null
{
foreach ($definition->getArguments() as $index => $argument) {
if ($argument instanceof Reference && 'cache.default_marshaller' === (string) $argument) {
return \is_int($index) ? $index : (str_starts_with($index, 'index_') ? (int) substr($index, 6) : $index);
}
}
return null;
}
}