🔧
This commit is contained in:
12
vendor/symfony/routing/Attribute/Route.php
vendored
12
vendor/symfony/routing/Attribute/Route.php
vendored
@@ -20,8 +20,6 @@ namespace Symfony\Component\Routing\Attribute;
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Alexander M. Turek <me@derrabus.de>
|
||||
*
|
||||
* @final since Symfony 6.4
|
||||
*/
|
||||
#[\Attribute(\Attribute::IS_REPEATABLE | \Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD)]
|
||||
class Route
|
||||
@@ -37,7 +35,7 @@ class Route
|
||||
* @param string[]|string $schemes
|
||||
*/
|
||||
public function __construct(
|
||||
string|array $path = null,
|
||||
string|array|null $path = null,
|
||||
private ?string $name = null,
|
||||
private array $requirements = [],
|
||||
private array $options = [],
|
||||
@@ -47,10 +45,10 @@ class Route
|
||||
array|string $schemes = [],
|
||||
private ?string $condition = null,
|
||||
private ?int $priority = null,
|
||||
string $locale = null,
|
||||
string $format = null,
|
||||
bool $utf8 = null,
|
||||
bool $stateless = null,
|
||||
?string $locale = null,
|
||||
?string $format = null,
|
||||
?bool $utf8 = null,
|
||||
?bool $stateless = null,
|
||||
private ?string $env = null
|
||||
) {
|
||||
if (\is_array($path)) {
|
||||
|
||||
2
vendor/symfony/routing/CompiledRoute.php
vendored
2
vendor/symfony/routing/CompiledRoute.php
vendored
@@ -37,7 +37,7 @@ class CompiledRoute implements \Serializable
|
||||
* @param array $hostVariables An array of host variables
|
||||
* @param array $variables An array of variables (variables defined in the path and in the host patterns)
|
||||
*/
|
||||
public function __construct(string $staticPrefix, string $regex, array $tokens, array $pathVariables, string $hostRegex = null, array $hostTokens = [], array $hostVariables = [], array $variables = [])
|
||||
public function __construct(string $staticPrefix, string $regex, array $tokens, array $pathVariables, ?string $hostRegex = null, array $hostTokens = [], array $hostVariables = [], array $variables = [])
|
||||
{
|
||||
$this->staticPrefix = $staticPrefix;
|
||||
$this->regex = $regex;
|
||||
|
||||
@@ -25,7 +25,7 @@ class MethodNotAllowedException extends \RuntimeException implements ExceptionIn
|
||||
/**
|
||||
* @param string[] $allowedMethods
|
||||
*/
|
||||
public function __construct(array $allowedMethods, string $message = '', int $code = 0, \Throwable $previous = null)
|
||||
public function __construct(array $allowedMethods, string $message = '', int $code = 0, ?\Throwable $previous = null)
|
||||
{
|
||||
$this->allowedMethods = array_map('strtoupper', $allowedMethods);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class MissingMandatoryParametersException extends \InvalidArgumentException impl
|
||||
* @param string[] $missingParameters
|
||||
* @param int $code
|
||||
*/
|
||||
public function __construct(string $routeName = '', $missingParameters = null, $code = 0, \Throwable $previous = null)
|
||||
public function __construct(string $routeName = '', $missingParameters = null, $code = 0, ?\Throwable $previous = null)
|
||||
{
|
||||
if (\is_array($missingParameters)) {
|
||||
$this->routeName = $routeName;
|
||||
|
||||
@@ -23,7 +23,7 @@ class CompiledUrlGenerator extends UrlGenerator
|
||||
private array $compiledRoutes = [];
|
||||
private ?string $defaultLocale;
|
||||
|
||||
public function __construct(array $compiledRoutes, RequestContext $context, LoggerInterface $logger = null, string $defaultLocale = null)
|
||||
public function __construct(array $compiledRoutes, RequestContext $context, ?LoggerInterface $logger = null, ?string $defaultLocale = null)
|
||||
{
|
||||
$this->compiledRoutes = $compiledRoutes;
|
||||
$this->context = $context;
|
||||
|
||||
@@ -83,7 +83,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt
|
||||
'%7C' => '|',
|
||||
];
|
||||
|
||||
public function __construct(RouteCollection $routes, RequestContext $context, LoggerInterface $logger = null, string $defaultLocale = null)
|
||||
public function __construct(RouteCollection $routes, RequestContext $context, ?LoggerInterface $logger = null, ?string $defaultLocale = null)
|
||||
{
|
||||
$this->routes = $routes;
|
||||
$this->context = $context;
|
||||
|
||||
@@ -111,7 +111,7 @@ abstract class AttributeClassLoader implements LoaderInterface
|
||||
/**
|
||||
* @throws \InvalidArgumentException When route can't be parsed
|
||||
*/
|
||||
public function load(mixed $class, string $type = null): RouteCollection
|
||||
public function load(mixed $class, ?string $type = null): RouteCollection
|
||||
{
|
||||
if (!class_exists($class)) {
|
||||
throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class));
|
||||
@@ -267,7 +267,7 @@ abstract class AttributeClassLoader implements LoaderInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function supports(mixed $resource, string $type = null): bool
|
||||
public function supports(mixed $resource, ?string $type = null): bool
|
||||
{
|
||||
if ('annotation' === $type) {
|
||||
trigger_deprecation('symfony/routing', '6.4', 'The "annotation" route type is deprecated, use the "attribute" route type instead.');
|
||||
|
||||
@@ -26,7 +26,7 @@ class AttributeDirectoryLoader extends AttributeFileLoader
|
||||
/**
|
||||
* @throws \InvalidArgumentException When the directory does not exist or its routes cannot be parsed
|
||||
*/
|
||||
public function load(mixed $path, string $type = null): ?RouteCollection
|
||||
public function load(mixed $path, ?string $type = null): ?RouteCollection
|
||||
{
|
||||
if (!is_dir($dir = $this->locator->locate($path))) {
|
||||
return parent::supports($path, $type) ? parent::load($path, $type) : new RouteCollection();
|
||||
@@ -61,7 +61,7 @@ class AttributeDirectoryLoader extends AttributeFileLoader
|
||||
return $collection;
|
||||
}
|
||||
|
||||
public function supports(mixed $resource, string $type = null): bool
|
||||
public function supports(mixed $resource, ?string $type = null): bool
|
||||
{
|
||||
if (!\is_string($resource)) {
|
||||
return false;
|
||||
|
||||
@@ -43,7 +43,7 @@ class AttributeFileLoader extends FileLoader
|
||||
*
|
||||
* @throws \InvalidArgumentException When the file does not exist or its routes cannot be parsed
|
||||
*/
|
||||
public function load(mixed $file, string $type = null): ?RouteCollection
|
||||
public function load(mixed $file, ?string $type = null): ?RouteCollection
|
||||
{
|
||||
$path = $this->locator->locate($file);
|
||||
|
||||
@@ -63,7 +63,7 @@ class AttributeFileLoader extends FileLoader
|
||||
return $collection;
|
||||
}
|
||||
|
||||
public function supports(mixed $resource, string $type = null): bool
|
||||
public function supports(mixed $resource, ?string $type = null): bool
|
||||
{
|
||||
if ('annotation' === $type) {
|
||||
trigger_deprecation('symfony/routing', '6.4', 'The "annotation" route type is deprecated, use the "attribute" route type instead.');
|
||||
@@ -82,7 +82,7 @@ class AttributeFileLoader extends FileLoader
|
||||
$tokens = token_get_all(file_get_contents($file));
|
||||
|
||||
if (1 === \count($tokens) && \T_INLINE_HTML === $tokens[0][0]) {
|
||||
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain PHP code. Did you forgot to add the "<?php" start tag at the beginning of the file?', $file));
|
||||
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain PHP code. Did you forget to add the "<?php" start tag at the beginning of the file?', $file));
|
||||
}
|
||||
|
||||
$nsTokens = [\T_NS_SEPARATOR => true, \T_STRING => true];
|
||||
|
||||
@@ -26,12 +26,12 @@ class ClosureLoader extends Loader
|
||||
/**
|
||||
* Loads a Closure.
|
||||
*/
|
||||
public function load(mixed $closure, string $type = null): RouteCollection
|
||||
public function load(mixed $closure, ?string $type = null): RouteCollection
|
||||
{
|
||||
return $closure($this->env);
|
||||
}
|
||||
|
||||
public function supports(mixed $resource, string $type = null): bool
|
||||
public function supports(mixed $resource, ?string $type = null): bool
|
||||
{
|
||||
return $resource instanceof \Closure && (!$type || 'closure' === $type);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class CollectionConfigurator
|
||||
private ?array $parentPrefixes;
|
||||
private string|array|null $host = null;
|
||||
|
||||
public function __construct(RouteCollection $parent, string $name, self $parentConfigurator = null, array $parentPrefixes = null)
|
||||
public function __construct(RouteCollection $parent, string $name, ?self $parentConfigurator = null, ?array $parentPrefixes = null)
|
||||
{
|
||||
$this->parent = $parent;
|
||||
$this->name = $name;
|
||||
|
||||
@@ -24,7 +24,7 @@ class RouteConfigurator
|
||||
|
||||
protected $parentConfigurator;
|
||||
|
||||
public function __construct(RouteCollection $collection, RouteCollection $route, string $name = '', CollectionConfigurator $parentConfigurator = null, array $prefixes = null)
|
||||
public function __construct(RouteCollection $collection, RouteCollection $route, string $name = '', ?CollectionConfigurator $parentConfigurator = null, ?array $prefixes = null)
|
||||
{
|
||||
$this->collection = $collection;
|
||||
$this->route = $route;
|
||||
@@ -42,7 +42,14 @@ class RouteConfigurator
|
||||
*/
|
||||
final public function host(string|array $host): static
|
||||
{
|
||||
$previousRoutes = clone $this->route;
|
||||
$this->addHost($this->route, $host);
|
||||
foreach ($previousRoutes as $name => $route) {
|
||||
if (!$this->route->get($name)) {
|
||||
$this->collection->remove($name);
|
||||
}
|
||||
}
|
||||
$this->collection->addCollection($this->route);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ class RoutingConfigurator
|
||||
private string $file;
|
||||
private ?string $env;
|
||||
|
||||
public function __construct(RouteCollection $collection, PhpFileLoader $loader, string $path, string $file, string $env = null)
|
||||
public function __construct(RouteCollection $collection, PhpFileLoader $loader, string $path, string $file, ?string $env = null)
|
||||
{
|
||||
$this->collection = $collection;
|
||||
$this->loader = $loader;
|
||||
@@ -38,7 +38,7 @@ class RoutingConfigurator
|
||||
/**
|
||||
* @param string|string[]|null $exclude Glob patterns to exclude from the import
|
||||
*/
|
||||
final public function import(string|array $resource, string $type = null, bool $ignoreErrors = false, string|array $exclude = null): ImportConfigurator
|
||||
final public function import(string|array $resource, ?string $type = null, bool $ignoreErrors = false, string|array|null $exclude = null): ImportConfigurator
|
||||
{
|
||||
$this->loader->setCurrentDir(\dirname($this->path));
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ trait HostTrait
|
||||
|
||||
foreach ($routes->all() as $name => $route) {
|
||||
if (null === $locale = $route->getDefault('_locale')) {
|
||||
$priority = $routes->getPriority($name) ?? 0;
|
||||
$routes->remove($name);
|
||||
foreach ($hosts as $locale => $host) {
|
||||
$localizedRoute = clone $route;
|
||||
@@ -35,14 +36,14 @@ trait HostTrait
|
||||
$localizedRoute->setRequirement('_locale', preg_quote($locale));
|
||||
$localizedRoute->setDefault('_canonical_route', $name);
|
||||
$localizedRoute->setHost($host);
|
||||
$routes->add($name.'.'.$locale, $localizedRoute);
|
||||
$routes->add($name.'.'.$locale, $localizedRoute, $priority);
|
||||
}
|
||||
} elseif (!isset($hosts[$locale])) {
|
||||
throw new \InvalidArgumentException(sprintf('Route "%s" with locale "%s" is missing a corresponding host in its parent collection.', $name, $locale));
|
||||
} else {
|
||||
$route->setHost($hosts[$locale]);
|
||||
$route->setRequirement('_locale', preg_quote($locale));
|
||||
$routes->add($name, $route);
|
||||
$routes->add($name, $route, $routes->getPriority($name) ?? 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ trait LocalizedRouteTrait
|
||||
*
|
||||
* @param string|array $path the path, or the localized paths of the route
|
||||
*/
|
||||
final protected function createLocalizedRoute(RouteCollection $collection, string $name, string|array $path, string $namePrefix = '', array $prefixes = null): RouteCollection
|
||||
final protected function createLocalizedRoute(RouteCollection $collection, string $name, string|array $path, string $namePrefix = '', ?array $prefixes = null): RouteCollection
|
||||
{
|
||||
$paths = [];
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ trait PrefixTrait
|
||||
}
|
||||
foreach ($routes->all() as $name => $route) {
|
||||
if (null === $locale = $route->getDefault('_locale')) {
|
||||
$priority = $routes->getPriority($name) ?? 0;
|
||||
$routes->remove($name);
|
||||
foreach ($prefix as $locale => $localePrefix) {
|
||||
$localizedRoute = clone $route;
|
||||
@@ -36,13 +37,13 @@ trait PrefixTrait
|
||||
$localizedRoute->setRequirement('_locale', preg_quote($locale));
|
||||
$localizedRoute->setDefault('_canonical_route', $name);
|
||||
$localizedRoute->setPath($localePrefix.(!$trailingSlashOnRoot && '/' === $route->getPath() ? '' : $route->getPath()));
|
||||
$routes->add($name.'.'.$locale, $localizedRoute);
|
||||
$routes->add($name.'.'.$locale, $localizedRoute, $priority);
|
||||
}
|
||||
} elseif (!isset($prefix[$locale])) {
|
||||
throw new \InvalidArgumentException(sprintf('Route "%s" with locale "%s" is missing a corresponding prefix in its parent collection.', $name, $locale));
|
||||
} else {
|
||||
$route->setPath($prefix[$locale].(!$trailingSlashOnRoot && '/' === $route->getPath() ? '' : $route->getPath()));
|
||||
$routes->add($name, $route);
|
||||
$routes->add($name, $route, $routes->getPriority($name) ?? 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,13 +22,13 @@ class ContainerLoader extends ObjectLoader
|
||||
{
|
||||
private ContainerInterface $container;
|
||||
|
||||
public function __construct(ContainerInterface $container, string $env = null)
|
||||
public function __construct(ContainerInterface $container, ?string $env = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
parent::__construct($env);
|
||||
}
|
||||
|
||||
public function supports(mixed $resource, string $type = null): bool
|
||||
public function supports(mixed $resource, ?string $type = null): bool
|
||||
{
|
||||
return 'service' === $type && \is_string($resource);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ use Symfony\Component\Routing\RouteCollection;
|
||||
|
||||
class DirectoryLoader extends FileLoader
|
||||
{
|
||||
public function load(mixed $file, string $type = null): mixed
|
||||
public function load(mixed $file, ?string $type = null): mixed
|
||||
{
|
||||
$path = $this->locator->locate($file);
|
||||
|
||||
@@ -43,7 +43,7 @@ class DirectoryLoader extends FileLoader
|
||||
return $collection;
|
||||
}
|
||||
|
||||
public function supports(mixed $resource, string $type = null): bool
|
||||
public function supports(mixed $resource, ?string $type = null): bool
|
||||
{
|
||||
// only when type is forced to directory, not to conflict with AttributeLoader
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ use Symfony\Component\Routing\RouteCollection;
|
||||
*/
|
||||
class GlobFileLoader extends FileLoader
|
||||
{
|
||||
public function load(mixed $resource, string $type = null): mixed
|
||||
public function load(mixed $resource, ?string $type = null): mixed
|
||||
{
|
||||
$collection = new RouteCollection();
|
||||
|
||||
@@ -34,7 +34,7 @@ class GlobFileLoader extends FileLoader
|
||||
return $collection;
|
||||
}
|
||||
|
||||
public function supports(mixed $resource, string $type = null): bool
|
||||
public function supports(mixed $resource, ?string $type = null): bool
|
||||
{
|
||||
return 'glob' === $type;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ abstract class ObjectLoader extends Loader
|
||||
/**
|
||||
* Calls the object method that will load the routes.
|
||||
*/
|
||||
public function load(mixed $resource, string $type = null): RouteCollection
|
||||
public function load(mixed $resource, ?string $type = null): RouteCollection
|
||||
{
|
||||
if (!preg_match('/^[^\:]+(?:::(?:[^\:]+))?$/', $resource)) {
|
||||
throw new \InvalidArgumentException(sprintf('Invalid resource "%s" passed to the %s route loader: use the format "object_id::method" or "object_id" if your object class has an "__invoke" method.', $resource, \is_string($type) ? '"'.$type.'"' : 'object'));
|
||||
|
||||
@@ -30,7 +30,7 @@ class PhpFileLoader extends FileLoader
|
||||
/**
|
||||
* Loads a PHP file.
|
||||
*/
|
||||
public function load(mixed $file, string $type = null): RouteCollection
|
||||
public function load(mixed $file, ?string $type = null): RouteCollection
|
||||
{
|
||||
$path = $this->locator->locate($file);
|
||||
$this->setCurrentDir(\dirname($path));
|
||||
@@ -54,7 +54,7 @@ class PhpFileLoader extends FileLoader
|
||||
return $collection;
|
||||
}
|
||||
|
||||
public function supports(mixed $resource, string $type = null): bool
|
||||
public function supports(mixed $resource, ?string $type = null): bool
|
||||
{
|
||||
return \is_string($resource) && 'php' === pathinfo($resource, \PATHINFO_EXTENSION) && (!$type || 'php' === $type);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ final class Psr4DirectoryLoader extends Loader implements DirectoryAwareLoaderIn
|
||||
/**
|
||||
* @param array{path: string, namespace: string} $resource
|
||||
*/
|
||||
public function load(mixed $resource, string $type = null): ?RouteCollection
|
||||
public function load(mixed $resource, ?string $type = null): ?RouteCollection
|
||||
{
|
||||
$path = $this->locator->locate($resource['path'], $this->currentDirectory);
|
||||
if (!is_dir($path)) {
|
||||
@@ -46,7 +46,7 @@ final class Psr4DirectoryLoader extends Loader implements DirectoryAwareLoaderIn
|
||||
return $this->loadFromDirectory($path, trim($resource['namespace'], '\\'));
|
||||
}
|
||||
|
||||
public function supports(mixed $resource, string $type = null): bool
|
||||
public function supports(mixed $resource, ?string $type = null): bool
|
||||
{
|
||||
return ('attribute' === $type || 'annotation' === $type) && \is_array($resource) && isset($resource['path'], $resource['namespace']);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class XmlFileLoader extends FileLoader
|
||||
* @throws \InvalidArgumentException when the file cannot be loaded or when the XML cannot be
|
||||
* parsed because it does not validate against the scheme
|
||||
*/
|
||||
public function load(mixed $file, string $type = null): RouteCollection
|
||||
public function load(mixed $file, ?string $type = null): RouteCollection
|
||||
{
|
||||
$path = $this->locator->locate($file);
|
||||
|
||||
@@ -94,7 +94,7 @@ class XmlFileLoader extends FileLoader
|
||||
}
|
||||
}
|
||||
|
||||
public function supports(mixed $resource, string $type = null): bool
|
||||
public function supports(mixed $resource, ?string $type = null): bool
|
||||
{
|
||||
return \is_string($resource) && 'xml' === pathinfo($resource, \PATHINFO_EXTENSION) && (!$type || 'xml' === $type);
|
||||
}
|
||||
@@ -135,7 +135,7 @@ class XmlFileLoader extends FileLoader
|
||||
throw new \InvalidArgumentException(sprintf('The <route> element in file "%s" must not have both a "path" attribute and <path> child nodes.', $path));
|
||||
}
|
||||
|
||||
$routes = $this->createLocalizedRoute($collection, $id, $paths ?: $node->getAttribute('path'));
|
||||
$routes = $this->createLocalizedRoute(new RouteCollection(), $id, $paths ?: $node->getAttribute('path'));
|
||||
$routes->addDefaults($defaults);
|
||||
$routes->addRequirements($requirements);
|
||||
$routes->addOptions($options);
|
||||
@@ -146,6 +146,8 @@ class XmlFileLoader extends FileLoader
|
||||
if (null !== $hosts) {
|
||||
$this->addHost($routes, $hosts);
|
||||
}
|
||||
|
||||
$collection->addCollection($routes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,7 +41,7 @@ class YamlFileLoader extends FileLoader
|
||||
/**
|
||||
* @throws \InvalidArgumentException When a route can't be parsed because YAML is invalid
|
||||
*/
|
||||
public function load(mixed $file, string $type = null): RouteCollection
|
||||
public function load(mixed $file, ?string $type = null): RouteCollection
|
||||
{
|
||||
$path = $this->locator->locate($file);
|
||||
|
||||
@@ -105,7 +105,7 @@ class YamlFileLoader extends FileLoader
|
||||
return $collection;
|
||||
}
|
||||
|
||||
public function supports(mixed $resource, string $type = null): bool
|
||||
public function supports(mixed $resource, ?string $type = null): bool
|
||||
{
|
||||
return \is_string($resource) && \in_array(pathinfo($resource, \PATHINFO_EXTENSION), ['yml', 'yaml'], true) && (!$type || 'yaml' === $type);
|
||||
}
|
||||
@@ -157,7 +157,7 @@ class YamlFileLoader extends FileLoader
|
||||
$defaults['_stateless'] = $config['stateless'];
|
||||
}
|
||||
|
||||
$routes = $this->createLocalizedRoute($collection, $name, $config['path']);
|
||||
$routes = $this->createLocalizedRoute(new RouteCollection(), $name, $config['path']);
|
||||
$routes->addDefaults($defaults);
|
||||
$routes->addRequirements($requirements);
|
||||
$routes->addOptions($options);
|
||||
@@ -168,6 +168,8 @@ class YamlFileLoader extends FileLoader
|
||||
if (isset($config['host'])) {
|
||||
$this->addHost($routes, $config['host']);
|
||||
}
|
||||
|
||||
$collection->addCollection($routes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -198,6 +198,7 @@ class StaticPrefixCollection
|
||||
|
||||
public static function handleError(int $type, string $msg): bool
|
||||
{
|
||||
return str_contains($msg, 'Compilation failed: lookbehind assertion is not fixed length');
|
||||
return str_contains($msg, 'Compilation failed: lookbehind assertion is not fixed length')
|
||||
|| str_contains($msg, 'Compilation failed: length of lookbehind assertion is not limited');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,5 +25,5 @@ interface RedirectableUrlMatcherInterface
|
||||
* @param string $route The route name that matched
|
||||
* @param string|null $scheme The URL scheme (null to keep the current one)
|
||||
*/
|
||||
public function redirect(string $path, string $route, string $scheme = null): array;
|
||||
public function redirect(string $path, string $route, ?string $scheme = null): array;
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ class TraceableUrlMatcher extends UrlMatcher
|
||||
return [];
|
||||
}
|
||||
|
||||
private function addTrace(string $log, int $level = self::ROUTE_DOES_NOT_MATCH, string $name = null, Route $route = null): void
|
||||
private function addTrace(string $log, int $level = self::ROUTE_DOES_NOT_MATCH, ?string $name = null, ?Route $route = null): void
|
||||
{
|
||||
$this->traces[] = [
|
||||
'log' => $log,
|
||||
|
||||
@@ -23,7 +23,7 @@ enum Requirement
|
||||
public const POSITIVE_INT = '[1-9][0-9]*';
|
||||
public const UID_BASE32 = '[0-9A-HJKMNP-TV-Z]{26}';
|
||||
public const UID_BASE58 = '[1-9A-HJ-NP-Za-km-z]{22}';
|
||||
public const UID_RFC4122 = '[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}';
|
||||
public const UID_RFC4122 = '[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}'; // RFC 9562 obsoleted RFC 4122 but the format is the same
|
||||
public const ULID = '[0-7][0-9A-HJKMNP-TV-Z]{25}';
|
||||
public const UUID = '[0-9a-f]{8}-[0-9a-f]{4}-[13-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}';
|
||||
public const UUID_V1 = '[0-9a-f]{8}-[0-9a-f]{4}-1[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}';
|
||||
|
||||
5
vendor/symfony/routing/RouteCollection.php
vendored
5
vendor/symfony/routing/RouteCollection.php
vendored
@@ -407,4 +407,9 @@ class RouteCollection implements \IteratorAggregate, \Countable
|
||||
{
|
||||
return $this->aliases[$name] ?? null;
|
||||
}
|
||||
|
||||
public function getPriority(string $name): ?int
|
||||
{
|
||||
return $this->priorities[$name] ?? null;
|
||||
}
|
||||
}
|
||||
|
||||
4
vendor/symfony/routing/Router.php
vendored
4
vendor/symfony/routing/Router.php
vendored
@@ -91,7 +91,7 @@ class Router implements RouterInterface, RequestMatcherInterface
|
||||
|
||||
private static ?array $cache = [];
|
||||
|
||||
public function __construct(LoaderInterface $loader, mixed $resource, array $options = [], RequestContext $context = null, LoggerInterface $logger = null, string $defaultLocale = null)
|
||||
public function __construct(LoaderInterface $loader, mixed $resource, array $options = [], ?RequestContext $context = null, ?LoggerInterface $logger = null, ?string $defaultLocale = null)
|
||||
{
|
||||
$this->loader = $loader;
|
||||
$this->resource = $resource;
|
||||
@@ -272,6 +272,7 @@ class Router implements RouterInterface, RequestMatcherInterface
|
||||
}
|
||||
|
||||
$cache->write($dumper->dump(), $this->getRouteCollection()->getResources());
|
||||
unset(self::$cache[$cache->getPath()]);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -301,6 +302,7 @@ class Router implements RouterInterface, RequestMatcherInterface
|
||||
$dumper = $this->getGeneratorDumperInstance();
|
||||
|
||||
$cache->write($dumper->dump(), $this->getRouteCollection()->getResources());
|
||||
unset(self::$cache[$cache->getPath()]);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user