upgraded dependencies
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\Routing\Generator\Dumper;
|
||||
|
||||
use Symfony\Component\Routing\Exception\RouteCircularReferenceException;
|
||||
use Symfony\Component\Routing\Exception\RouteNotFoundException;
|
||||
use Symfony\Component\Routing\Matcher\Dumper\CompiledUrlMatcherDumper;
|
||||
|
||||
/**
|
||||
@@ -35,12 +37,57 @@ class CompiledUrlGeneratorDumper extends GeneratorDumper
|
||||
$compiledRoute->getTokens(),
|
||||
$compiledRoute->getHostTokens(),
|
||||
$route->getSchemes(),
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
return $compiledRoutes;
|
||||
}
|
||||
|
||||
public function getCompiledAliases(): array
|
||||
{
|
||||
$routes = $this->getRoutes();
|
||||
$compiledAliases = [];
|
||||
foreach ($routes->getAliases() as $name => $alias) {
|
||||
$deprecations = $alias->isDeprecated() ? [$alias->getDeprecation($name)] : [];
|
||||
$currentId = $alias->getId();
|
||||
$visited = [];
|
||||
while (null !== $alias = $routes->getAlias($currentId) ?? null) {
|
||||
if (false !== $searchKey = array_search($currentId, $visited)) {
|
||||
$visited[] = $currentId;
|
||||
|
||||
throw new RouteCircularReferenceException($currentId, \array_slice($visited, $searchKey));
|
||||
}
|
||||
|
||||
if ($alias->isDeprecated()) {
|
||||
$deprecations[] = $deprecation = $alias->getDeprecation($currentId);
|
||||
trigger_deprecation($deprecation['package'], $deprecation['version'], $deprecation['message']);
|
||||
}
|
||||
|
||||
$visited[] = $currentId;
|
||||
$currentId = $alias->getId();
|
||||
}
|
||||
|
||||
if (null === $target = $routes->get($currentId)) {
|
||||
throw new RouteNotFoundException(sprintf('Target route "%s" for alias "%s" does not exist.', $currentId, $name));
|
||||
}
|
||||
|
||||
$compiledTarget = $target->compile();
|
||||
|
||||
$compiledAliases[$name] = [
|
||||
$compiledTarget->getVariables(),
|
||||
$target->getDefaults(),
|
||||
$target->getRequirements(),
|
||||
$compiledTarget->getTokens(),
|
||||
$compiledTarget->getHostTokens(),
|
||||
$target->getSchemes(),
|
||||
$deprecations,
|
||||
];
|
||||
}
|
||||
|
||||
return $compiledAliases;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -68,6 +115,10 @@ EOF;
|
||||
$routes .= sprintf("\n '%s' => %s,", $name, CompiledUrlMatcherDumper::export($properties));
|
||||
}
|
||||
|
||||
foreach ($this->getCompiledAliases() as $alias => $properties) {
|
||||
$routes .= sprintf("\n '%s' => %s,", $alias, CompiledUrlMatcherDumper::export($properties));
|
||||
}
|
||||
|
||||
return $routes;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user