Aggiornato Composer
This commit is contained in:
18
vendor/symfony/routing/Annotation/Route.php
vendored
18
vendor/symfony/routing/Annotation/Route.php
vendored
@@ -49,20 +49,20 @@ class Route
|
||||
public function __construct(
|
||||
$data = [],
|
||||
$path = null,
|
||||
string $name = null,
|
||||
?string $name = null,
|
||||
array $requirements = [],
|
||||
array $options = [],
|
||||
array $defaults = [],
|
||||
string $host = null,
|
||||
?string $host = null,
|
||||
$methods = [],
|
||||
$schemes = [],
|
||||
string $condition = null,
|
||||
int $priority = null,
|
||||
string $locale = null,
|
||||
string $format = null,
|
||||
bool $utf8 = null,
|
||||
bool $stateless = null,
|
||||
string $env = null
|
||||
?string $condition = null,
|
||||
?int $priority = null,
|
||||
?string $locale = null,
|
||||
?string $format = null,
|
||||
?bool $utf8 = null,
|
||||
?bool $stateless = null,
|
||||
?string $env = null
|
||||
) {
|
||||
if (\is_string($data)) {
|
||||
$data = ['path' => $data];
|
||||
|
||||
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)
|
||||
{
|
||||
if (null === $message) {
|
||||
trigger_deprecation('symfony/routing', '5.3', 'Passing null as $message to "%s()" is deprecated, pass an empty string instead.', __METHOD__);
|
||||
|
||||
@@ -23,7 +23,7 @@ class CompiledUrlGenerator extends UrlGenerator
|
||||
private $compiledRoutes = [];
|
||||
private $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;
|
||||
|
||||
@@ -82,7 +82,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;
|
||||
@@ -162,11 +162,11 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*
|
||||
* @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route
|
||||
* @throws InvalidParameterException When a parameter value for a placeholder is not correct because
|
||||
* it does not match the requirement
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function doGenerate(array $variables, array $defaults, array $requirements, array $tokens, array $parameters, string $name, int $referenceType, array $hostTokens, array $requiredSchemes = [])
|
||||
{
|
||||
|
||||
2
vendor/symfony/routing/LICENSE
vendored
2
vendor/symfony/routing/LICENSE
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2004-2022 Fabien Potencier
|
||||
Copyright (c) 2004-present Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -85,7 +85,7 @@ abstract class AnnotationClassLoader implements LoaderInterface
|
||||
*/
|
||||
protected $defaultRouteIndex = 0;
|
||||
|
||||
public function __construct(Reader $reader = null, string $env = null)
|
||||
public function __construct(?Reader $reader = null, ?string $env = null)
|
||||
{
|
||||
$this->reader = $reader;
|
||||
$this->env = $env;
|
||||
@@ -108,7 +108,7 @@ abstract class AnnotationClassLoader implements LoaderInterface
|
||||
*
|
||||
* @throws \InvalidArgumentException When route can't be parsed
|
||||
*/
|
||||
public function load($class, string $type = null)
|
||||
public function load($class, ?string $type = null)
|
||||
{
|
||||
if (!class_exists($class)) {
|
||||
throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class));
|
||||
@@ -239,7 +239,7 @@ abstract class AnnotationClassLoader implements LoaderInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports($resource, string $type = null)
|
||||
public function supports($resource, ?string $type = null)
|
||||
{
|
||||
return \is_string($resource) && preg_match('/^(?:\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+$/', $resource) && (!$type || 'annotation' === $type);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class AnnotationDirectoryLoader extends AnnotationFileLoader
|
||||
*
|
||||
* @throws \InvalidArgumentException When the directory does not exist or its routes cannot be parsed
|
||||
*/
|
||||
public function load($path, string $type = null)
|
||||
public function load($path, ?string $type = null)
|
||||
{
|
||||
if (!is_dir($dir = $this->locator->locate($path))) {
|
||||
return parent::supports($path, $type) ? parent::load($path, $type) : new RouteCollection();
|
||||
@@ -74,7 +74,7 @@ class AnnotationDirectoryLoader extends AnnotationFileLoader
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports($resource, string $type = null)
|
||||
public function supports($resource, ?string $type = null)
|
||||
{
|
||||
if ('annotation' === $type) {
|
||||
return true;
|
||||
|
||||
@@ -47,7 +47,7 @@ class AnnotationFileLoader extends FileLoader
|
||||
*
|
||||
* @throws \InvalidArgumentException When the file does not exist or its routes cannot be parsed
|
||||
*/
|
||||
public function load($file, string $type = null)
|
||||
public function load($file, ?string $type = null)
|
||||
{
|
||||
$path = $this->locator->locate($file);
|
||||
|
||||
@@ -70,7 +70,7 @@ class AnnotationFileLoader extends FileLoader
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports($resource, string $type = null)
|
||||
public function supports($resource, ?string $type = null)
|
||||
{
|
||||
return \is_string($resource) && 'php' === pathinfo($resource, \PATHINFO_EXTENSION) && (!$type || 'annotation' === $type);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class ClosureLoader extends Loader
|
||||
*
|
||||
* @return RouteCollection
|
||||
*/
|
||||
public function load($closure, string $type = null)
|
||||
public function load($closure, ?string $type = null)
|
||||
{
|
||||
return $closure($this->env);
|
||||
}
|
||||
@@ -39,7 +39,7 @@ class ClosureLoader extends Loader
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports($resource, string $type = null)
|
||||
public function supports($resource, ?string $type = null)
|
||||
{
|
||||
return $resource instanceof \Closure && (!$type || 'closure' === $type);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class CollectionConfigurator
|
||||
private $parentPrefixes;
|
||||
private $host;
|
||||
|
||||
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;
|
||||
|
||||
@@ -26,7 +26,7 @@ class RoutingConfigurator
|
||||
private $file;
|
||||
private $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($resource, string $type = null, bool $ignoreErrors = false, $exclude = null): ImportConfigurator
|
||||
final public function import($resource, ?string $type = null, bool $ignoreErrors = false, $exclude = null): ImportConfigurator
|
||||
{
|
||||
$this->loader->setCurrentDir(\dirname($this->path));
|
||||
|
||||
|
||||
@@ -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, $path, string $namePrefix = '', array $prefixes = null): RouteCollection
|
||||
final protected function createLocalizedRoute(RouteCollection $collection, string $name, $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,7 +22,7 @@ class ContainerLoader extends ObjectLoader
|
||||
{
|
||||
private $container;
|
||||
|
||||
public function __construct(ContainerInterface $container, string $env = null)
|
||||
public function __construct(ContainerInterface $container, ?string $env = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
parent::__construct($env);
|
||||
@@ -31,7 +31,7 @@ class ContainerLoader extends ObjectLoader
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports($resource, string $type = null)
|
||||
public function supports($resource, ?string $type = null)
|
||||
{
|
||||
return 'service' === $type && \is_string($resource);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class DirectoryLoader extends FileLoader
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load($file, string $type = null)
|
||||
public function load($file, ?string $type = null)
|
||||
{
|
||||
$path = $this->locator->locate($file);
|
||||
|
||||
@@ -49,7 +49,7 @@ class DirectoryLoader extends FileLoader
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports($resource, string $type = null)
|
||||
public function supports($resource, ?string $type = null)
|
||||
{
|
||||
// only when type is forced to directory, not to conflict with AnnotationLoader
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class GlobFileLoader extends FileLoader
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load($resource, string $type = null)
|
||||
public function load($resource, ?string $type = null)
|
||||
{
|
||||
$collection = new RouteCollection();
|
||||
|
||||
@@ -40,7 +40,7 @@ class GlobFileLoader extends FileLoader
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports($resource, string $type = null)
|
||||
public function supports($resource, ?string $type = null)
|
||||
{
|
||||
return 'glob' === $type;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ abstract class ObjectLoader extends Loader
|
||||
*
|
||||
* @return RouteCollection
|
||||
*/
|
||||
public function load($resource, string $type = null)
|
||||
public function load($resource, ?string $type = null)
|
||||
{
|
||||
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'));
|
||||
|
||||
@@ -35,7 +35,7 @@ class PhpFileLoader extends FileLoader
|
||||
*
|
||||
* @return RouteCollection
|
||||
*/
|
||||
public function load($file, string $type = null)
|
||||
public function load($file, ?string $type = null)
|
||||
{
|
||||
$path = $this->locator->locate($file);
|
||||
$this->setCurrentDir(\dirname($path));
|
||||
@@ -62,7 +62,7 @@ class PhpFileLoader extends FileLoader
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports($resource, string $type = null)
|
||||
public function supports($resource, ?string $type = null)
|
||||
{
|
||||
return \is_string($resource) && 'php' === pathinfo($resource, \PATHINFO_EXTENSION) && (!$type || 'php' === $type);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,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($file, string $type = null)
|
||||
public function load($file, ?string $type = null)
|
||||
{
|
||||
$path = $this->locator->locate($file);
|
||||
|
||||
@@ -102,7 +102,7 @@ class XmlFileLoader extends FileLoader
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports($resource, string $type = null)
|
||||
public function supports($resource, ?string $type = null)
|
||||
{
|
||||
return \is_string($resource) && 'xml' === pathinfo($resource, \PATHINFO_EXTENSION) && (!$type || 'xml' === $type);
|
||||
}
|
||||
@@ -195,7 +195,7 @@ class XmlFileLoader extends FileLoader
|
||||
$this->setCurrentDir(\dirname($path));
|
||||
|
||||
/** @var RouteCollection[] $imported */
|
||||
$imported = $this->import($resource, ('' !== $type ? $type : null), false, $file, $exclude) ?: [];
|
||||
$imported = $this->import($resource, '' !== $type ? $type : null, false, $file, $exclude) ?: [];
|
||||
|
||||
if (!\is_array($imported)) {
|
||||
$imported = [$imported];
|
||||
|
||||
@@ -48,7 +48,7 @@ class YamlFileLoader extends FileLoader
|
||||
*
|
||||
* @throws \InvalidArgumentException When a route can't be parsed because YAML is invalid
|
||||
*/
|
||||
public function load($file, string $type = null)
|
||||
public function load($file, ?string $type = null)
|
||||
{
|
||||
$path = $this->locator->locate($file);
|
||||
|
||||
@@ -117,7 +117,7 @@ class YamlFileLoader extends FileLoader
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports($resource, string $type = null)
|
||||
public function supports($resource, ?string $type = null)
|
||||
{
|
||||
return \is_string($resource) && \in_array(pathinfo($resource, \PATHINFO_EXTENSION), ['yml', 'yaml'], true) && (!$type || 'yaml' === $type);
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ EOF;
|
||||
foreach ($staticRoutes as $path => $routes) {
|
||||
$code .= sprintf(" %s => [\n", self::export($path));
|
||||
foreach ($routes as $route) {
|
||||
$code .= sprintf(" [%s, %s, %s, %s, %s, %s, %s],\n", ...array_map([__CLASS__, 'export'], $route));
|
||||
$code .= vsprintf(" [%s, %s, %s, %s, %s, %s, %s],\n", array_map([__CLASS__, 'export'], $route));
|
||||
}
|
||||
$code .= " ],\n";
|
||||
}
|
||||
@@ -151,7 +151,7 @@ EOF;
|
||||
foreach ($dynamicRoutes as $path => $routes) {
|
||||
$code .= sprintf(" %s => [\n", self::export($path));
|
||||
foreach ($routes as $route) {
|
||||
$code .= sprintf(" [%s, %s, %s, %s, %s, %s, %s],\n", ...array_map([__CLASS__, 'export'], $route));
|
||||
$code .= vsprintf(" [%s, %s, %s, %s, %s, %s, %s],\n", array_map([__CLASS__, 'export'], $route));
|
||||
}
|
||||
$code .= " ],\n";
|
||||
}
|
||||
|
||||
@@ -200,6 +200,7 @@ class StaticPrefixCollection
|
||||
|
||||
public static function handleError(int $type, string $msg)
|
||||
{
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,5 +27,5 @@ interface RedirectableUrlMatcherInterface
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function redirect(string $path, string $route, string $scheme = null);
|
||||
public function redirect(string $path, string $route, ?string $scheme = null);
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ class TraceableUrlMatcher extends UrlMatcher
|
||||
return [];
|
||||
}
|
||||
|
||||
private function addTrace(string $log, int $level = self::ROUTE_DOES_NOT_MATCH, string $name = null, Route $route = null)
|
||||
private function addTrace(string $log, int $level = self::ROUTE_DOES_NOT_MATCH, ?string $name = null, ?Route $route = null)
|
||||
{
|
||||
$this->traces[] = [
|
||||
'log' => $log,
|
||||
|
||||
22
vendor/symfony/routing/RouteCollection.php
vendored
22
vendor/symfony/routing/RouteCollection.php
vendored
@@ -89,7 +89,7 @@ class RouteCollection implements \IteratorAggregate, \Countable
|
||||
/**
|
||||
* @param int $priority
|
||||
*/
|
||||
public function add(string $name, Route $route/*, int $priority = 0*/)
|
||||
public function add(string $name, Route $route/* , int $priority = 0 */)
|
||||
{
|
||||
if (\func_num_args() < 3 && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface && !$this instanceof \Mockery\MockInterface) {
|
||||
trigger_deprecation('symfony/routing', '5.1', 'The "%s()" method will have a new "int $priority = 0" argument in version 6.0, not defining it is deprecated.', __METHOD__);
|
||||
@@ -157,9 +157,24 @@ class RouteCollection implements \IteratorAggregate, \Countable
|
||||
*/
|
||||
public function remove($name)
|
||||
{
|
||||
$routes = [];
|
||||
foreach ((array) $name as $n) {
|
||||
if (isset($this->routes[$n])) {
|
||||
$routes[] = $n;
|
||||
}
|
||||
|
||||
unset($this->routes[$n], $this->priorities[$n], $this->aliases[$n]);
|
||||
}
|
||||
|
||||
if (!$routes) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($this->aliases as $k => $alias) {
|
||||
if (\in_array($alias->getId(), $routes, true)) {
|
||||
unset($this->aliases[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -380,4 +395,9 @@ class RouteCollection implements \IteratorAggregate, \Countable
|
||||
{
|
||||
return $this->aliases[$name] ?? null;
|
||||
}
|
||||
|
||||
public function getPriority(string $name): ?int
|
||||
{
|
||||
return $this->priorities[$name] ?? null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class RouteCollectionBuilder
|
||||
private $methods;
|
||||
private $resources = [];
|
||||
|
||||
public function __construct(LoaderInterface $loader = null)
|
||||
public function __construct(?LoaderInterface $loader = null)
|
||||
{
|
||||
$this->loader = $loader;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ class RouteCollectionBuilder
|
||||
*
|
||||
* @throws LoaderLoadException
|
||||
*/
|
||||
public function import($resource, string $prefix = '/', string $type = null)
|
||||
public function import($resource, string $prefix = '/', ?string $type = null)
|
||||
{
|
||||
/** @var RouteCollection[] $collections */
|
||||
$collections = $this->load($resource, $type);
|
||||
@@ -92,7 +92,7 @@ class RouteCollectionBuilder
|
||||
*
|
||||
* @return Route
|
||||
*/
|
||||
public function add(string $path, string $controller, string $name = null)
|
||||
public function add(string $path, string $controller, ?string $name = null)
|
||||
{
|
||||
$route = new Route($path);
|
||||
$route->setDefault('_controller', $controller);
|
||||
@@ -125,7 +125,7 @@ class RouteCollectionBuilder
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addRoute(Route $route, string $name = null)
|
||||
public function addRoute(Route $route, ?string $name = null)
|
||||
{
|
||||
if (null === $name) {
|
||||
// used as a flag to know which routes will need a name later
|
||||
@@ -337,7 +337,7 @@ class RouteCollectionBuilder
|
||||
*
|
||||
* @throws LoaderLoadException If no loader is found
|
||||
*/
|
||||
private function load($resource, string $type = null): array
|
||||
private function load($resource, ?string $type = null): array
|
||||
{
|
||||
if (null === $this->loader) {
|
||||
throw new \BadMethodCallException('Cannot import other routing resources: you must pass a LoaderInterface when constructing RouteCollectionBuilder.');
|
||||
|
||||
10
vendor/symfony/routing/Router.php
vendored
10
vendor/symfony/routing/Router.php
vendored
@@ -97,7 +97,7 @@ class Router implements RouterInterface, RequestMatcherInterface
|
||||
/**
|
||||
* @param mixed $resource The main resource to load
|
||||
*/
|
||||
public function __construct(LoaderInterface $loader, $resource, array $options = [], RequestContext $context = null, LoggerInterface $logger = null, string $defaultLocale = null)
|
||||
public function __construct(LoaderInterface $loader, $resource, array $options = [], ?RequestContext $context = null, ?LoggerInterface $logger = null, ?string $defaultLocale = null)
|
||||
{
|
||||
$this->loader = $loader;
|
||||
$this->resource = $resource;
|
||||
@@ -313,14 +313,12 @@ class Router implements RouterInterface, RequestMatcherInterface
|
||||
|
||||
if (null === $this->options['cache_dir']) {
|
||||
$routes = $this->getRouteCollection();
|
||||
$aliases = [];
|
||||
$compiled = is_a($this->options['generator_class'], CompiledUrlGenerator::class, true);
|
||||
if ($compiled) {
|
||||
$generatorDumper = new CompiledUrlGeneratorDumper($routes);
|
||||
$routes = $generatorDumper->getCompiledRoutes();
|
||||
$aliases = $generatorDumper->getCompiledAliases();
|
||||
$routes = array_merge($generatorDumper->getCompiledRoutes(), $generatorDumper->getCompiledAliases());
|
||||
}
|
||||
$this->generator = new $this->options['generator_class'](array_merge($routes, $aliases), $this->context, $this->logger, $this->defaultLocale);
|
||||
$this->generator = new $this->options['generator_class']($routes, $this->context, $this->logger, $this->defaultLocale);
|
||||
} else {
|
||||
$cache = $this->getConfigCacheFactory()->cache($this->options['cache_dir'].'/url_generating_routes.php',
|
||||
function (ConfigCacheInterface $cache) {
|
||||
@@ -376,7 +374,7 @@ class Router implements RouterInterface, RequestMatcherInterface
|
||||
|
||||
private static function getCompiledRoutes(string $path): array
|
||||
{
|
||||
if ([] === self::$cache && \function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN) && (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) || filter_var(ini_get('opcache.enable_cli'), \FILTER_VALIDATE_BOOLEAN))) {
|
||||
if ([] === self::$cache && \function_exists('opcache_invalidate') && filter_var(\ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN) && (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) || filter_var(\ini_get('opcache.enable_cli'), \FILTER_VALIDATE_BOOLEAN))) {
|
||||
self::$cache = null;
|
||||
}
|
||||
|
||||
|
||||
4
vendor/symfony/routing/composer.json
vendored
4
vendor/symfony/routing/composer.json
vendored
@@ -2,7 +2,7 @@
|
||||
"name": "symfony/routing",
|
||||
"type": "library",
|
||||
"description": "Maps an HTTP request to a set of configuration variables",
|
||||
"keywords": ["routing", "router", "URL", "URI"],
|
||||
"keywords": ["routing", "router", "url", "uri"],
|
||||
"homepage": "https://symfony.com",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
@@ -26,7 +26,7 @@
|
||||
"symfony/yaml": "^4.4|^5.0|^6.0",
|
||||
"symfony/expression-language": "^4.4|^5.0|^6.0",
|
||||
"symfony/dependency-injection": "^4.4|^5.0|^6.0",
|
||||
"doctrine/annotations": "^1.12",
|
||||
"doctrine/annotations": "^1.12|^2",
|
||||
"psr/log": "^1|^2|^3"
|
||||
},
|
||||
"conflict": {
|
||||
|
||||
Reference in New Issue
Block a user