N°8910 - Upgrade Symfony packages (#811)

This commit is contained in:
Benjamin Dalsass
2026-02-23 06:54:26 +01:00
committed by GitHub
parent b91e6c384a
commit 4853ca444e
224 changed files with 4758 additions and 1778 deletions

View File

@@ -38,15 +38,12 @@ class CollectionConfigurator
$this->parentPrefixes = $parentPrefixes;
}
public function __sleep(): array
public function __serialize(): array
{
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
}
/**
* @return void
*/
public function __wakeup()
public function __unserialize(array $data): void
{
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}

View File

@@ -30,15 +30,12 @@ class ImportConfigurator
$this->route = $route;
}
public function __sleep(): array
public function __serialize(): array
{
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
}
/**
* @return void
*/
public function __wakeup()
public function __unserialize(array $data): void
{
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}

View File

@@ -27,10 +27,17 @@ trait PrefixTrait
foreach ($prefix as $locale => $localePrefix) {
$prefix[$locale] = trim(trim($localePrefix), '/');
}
$aliases = [];
foreach ($routes->getAliases() as $name => $alias) {
$aliases[$alias->getId()][] = $name;
}
foreach ($routes->all() as $name => $route) {
if (null === $locale = $route->getDefault('_locale')) {
$priority = $routes->getPriority($name) ?? 0;
$routes->remove($name);
foreach ($aliases[$name] ?? [] as $aliasName) {
$routes->remove($aliasName);
}
foreach ($prefix as $locale => $localePrefix) {
$localizedRoute = clone $route;
$localizedRoute->setDefault('_locale', $locale);
@@ -38,6 +45,9 @@ trait PrefixTrait
$localizedRoute->setDefault('_canonical_route', $name);
$localizedRoute->setPath($localePrefix.(!$trailingSlashOnRoot && '/' === $route->getPath() ? '' : $route->getPath()));
$routes->add($name.'.'.$locale, $localizedRoute, $priority);
foreach ($aliases[$name] ?? [] as $aliasName) {
$routes->addAlias($aliasName.'.'.$locale, $name.'.'.$locale);
}
}
} elseif (!isset($prefix[$locale])) {
throw new \InvalidArgumentException(\sprintf('Route "%s" with locale "%s" is missing a corresponding prefix in its parent collection.', $name, $locale));