updated composer

This commit is contained in:
2021-05-18 13:47:03 +00:00
parent e248cd036c
commit ba92152daa
1187 changed files with 20804 additions and 22320 deletions

View File

@@ -22,7 +22,10 @@ class MethodNotAllowedException extends \RuntimeException implements ExceptionIn
{
protected $allowedMethods = [];
public function __construct(array $allowedMethods, string $message = null, int $code = 0, \Throwable $previous = null)
/**
* @param string[] $allowedMethods
*/
public function __construct(array $allowedMethods, ?string $message = '', int $code = 0, \Throwable $previous = null)
{
$this->allowedMethods = array_map('strtoupper', $allowedMethods);
@@ -32,7 +35,7 @@ class MethodNotAllowedException extends \RuntimeException implements ExceptionIn
/**
* Gets the allowed HTTP methods.
*
* @return array
* @return string[]
*/
public function getAllowedMethods()
{

View File

@@ -1,4 +1,4 @@
Copyright (c) 2004-2020 Fabien Potencier
Copyright (c) 2004-2021 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

View File

@@ -95,12 +95,10 @@ class AnnotationFileLoader extends FileLoader
$nsTokens = [\T_NS_SEPARATOR => true, \T_STRING => true];
if (\defined('T_NAME_QUALIFIED')) {
$nsTokens[T_NAME_QUALIFIED] = true;
$nsTokens[\T_NAME_QUALIFIED] = true;
}
for ($i = 0; isset($tokens[$i]); ++$i) {
$token = $tokens[$i];
if (!isset($token[1])) {
continue;
}
@@ -122,6 +120,9 @@ class AnnotationFileLoader extends FileLoader
$skipClassToken = false;
for ($j = $i - 1; $j > 0; --$j) {
if (!isset($tokens[$j][1])) {
if ('(' === $tokens[$j] || ',' === $tokens[$j]) {
$skipClassToken = true;
}
break;
}

View File

@@ -38,6 +38,16 @@ class CollectionConfigurator
$this->parentPrefixes = $parentPrefixes;
}
public function __sleep()
{
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
}
public function __wakeup()
{
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}
public function __destruct()
{
if (null === $this->prefixes) {

View File

@@ -30,6 +30,16 @@ class ImportConfigurator
$this->route = $route;
}
public function __sleep()
{
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
}
public function __wakeup()
{
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}
public function __destruct()
{
$this->parent->addCollection($this->route);

View File

@@ -358,7 +358,7 @@ class XmlFileLoader extends FileLoader
/**
* Recursively parses the value of a "default" element.
*
* @return array|bool|float|int|string The parsed value
* @return array|bool|float|int|string|null The parsed value
*
* @throws \InvalidArgumentException when the XML is invalid
*/

View File

@@ -33,7 +33,7 @@ class YamlFileLoader extends FileLoader
use LocalizedRouteTrait;
use PrefixTrait;
private static $availableKeys = [
private const AVAILABLE_KEYS = [
'resource', 'type', 'prefix', 'path', 'host', 'schemes', 'methods', 'defaults', 'requirements', 'options', 'condition', 'controller', 'name_prefix', 'trailing_slash_on_root', 'locale', 'format', 'utf8', 'exclude', 'stateless',
];
private $yamlParser;
@@ -113,9 +113,9 @@ class YamlFileLoader extends FileLoader
*/
protected function parseRoute(RouteCollection $collection, string $name, array $config, string $path)
{
$defaults = isset($config['defaults']) ? $config['defaults'] : [];
$requirements = isset($config['requirements']) ? $config['requirements'] : [];
$options = isset($config['options']) ? $config['options'] : [];
$defaults = $config['defaults'] ?? [];
$requirements = $config['requirements'] ?? [];
$options = $config['options'] ?? [];
foreach ($requirements as $placeholder => $requirement) {
if (\is_int($placeholder)) {
@@ -161,15 +161,15 @@ class YamlFileLoader extends FileLoader
*/
protected function parseImport(RouteCollection $collection, array $config, string $path, string $file)
{
$type = isset($config['type']) ? $config['type'] : null;
$prefix = isset($config['prefix']) ? $config['prefix'] : '';
$defaults = isset($config['defaults']) ? $config['defaults'] : [];
$requirements = isset($config['requirements']) ? $config['requirements'] : [];
$options = isset($config['options']) ? $config['options'] : [];
$host = isset($config['host']) ? $config['host'] : null;
$condition = isset($config['condition']) ? $config['condition'] : null;
$schemes = isset($config['schemes']) ? $config['schemes'] : null;
$methods = isset($config['methods']) ? $config['methods'] : null;
$type = $config['type'] ?? null;
$prefix = $config['prefix'] ?? '';
$defaults = $config['defaults'] ?? [];
$requirements = $config['requirements'] ?? [];
$options = $config['options'] ?? [];
$host = $config['host'] ?? null;
$condition = $config['condition'] ?? null;
$schemes = $config['schemes'] ?? null;
$methods = $config['methods'] ?? null;
$trailingSlashOnRoot = $config['trailing_slash_on_root'] ?? true;
$namePrefix = $config['name_prefix'] ?? null;
$exclude = $config['exclude'] ?? null;
@@ -240,8 +240,8 @@ class YamlFileLoader extends FileLoader
if (!\is_array($config)) {
throw new \InvalidArgumentException(sprintf('The definition of "%s" in "%s" must be a YAML array.', $name, $path));
}
if ($extraKeys = array_diff(array_keys($config), self::$availableKeys)) {
throw new \InvalidArgumentException(sprintf('The routing file "%s" contains unsupported keys for "%s": "%s". Expected one of: "%s".', $path, $name, implode('", "', $extraKeys), implode('", "', self::$availableKeys)));
if ($extraKeys = array_diff(array_keys($config), self::AVAILABLE_KEYS)) {
throw new \InvalidArgumentException(sprintf('The routing file "%s" contains unsupported keys for "%s": "%s". Expected one of: "%s".', $path, $name, implode('", "', $extraKeys), implode('", "', self::AVAILABLE_KEYS)));
}
if (isset($config['resource']) && isset($config['path'])) {
throw new \InvalidArgumentException(sprintf('The routing file "%s" must not specify both the "resource" key and the "path" key for "%s". Choose between an import and a route definition.', $path, $name));

View File

@@ -446,7 +446,7 @@ EOF;
private function getExpressionLanguage(): ExpressionLanguage
{
if (null === $this->expressionLanguage) {
if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) {
if (!class_exists(ExpressionLanguage::class)) {
throw new \LogicException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.');
}
$this->expressionLanguage = new ExpressionLanguage(null, $this->expressionLanguageProviders);

View File

@@ -146,7 +146,7 @@ class TraceableUrlMatcher extends UrlMatcher
$this->addTrace('Route matches!', self::ROUTE_MATCHES, $name, $route);
return $this->getAttributes($route, $name, array_replace($matches, $hostMatches, isset($status[1]) ? $status[1] : []));
return $this->getAttributes($route, $name, array_replace($matches, $hostMatches, $status[1] ?? []));
}
return [];

View File

@@ -192,7 +192,7 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface
continue;
}
return $this->getAttributes($route, $name, array_replace($matches, $hostMatches, isset($status[1]) ? $status[1] : []));
return $this->getAttributes($route, $name, array_replace($matches, $hostMatches, $status[1] ?? []));
}
return [];
@@ -253,7 +253,7 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface
protected function getExpressionLanguage()
{
if (null === $this->expressionLanguage) {
if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) {
if (!class_exists(ExpressionLanguage::class)) {
throw new \LogicException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.');
}
$this->expressionLanguage = new ExpressionLanguage(null, $this->expressionLanguageProviders);
@@ -267,7 +267,7 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface
*/
protected function createRequest(string $pathinfo): ?Request
{
if (!class_exists('Symfony\Component\HttpFoundation\Request')) {
if (!class_exists(Request::class)) {
return null;
}

View File

@@ -293,7 +293,7 @@ class RequestContext
*/
public function getParameter(string $name)
{
return isset($this->parameters[$name]) ? $this->parameters[$name] : null;
return $this->parameters[$name] ?? null;
}
/**

View File

@@ -300,7 +300,7 @@ class Route implements \Serializable
*/
public function getOption(string $name)
{
return isset($this->options[$name]) ? $this->options[$name] : null;
return $this->options[$name] ?? null;
}
/**
@@ -369,7 +369,7 @@ class Route implements \Serializable
*/
public function getDefault(string $name)
{
return isset($this->defaults[$name]) ? $this->defaults[$name] : null;
return $this->defaults[$name] ?? null;
}
/**
@@ -457,7 +457,7 @@ class Route implements \Serializable
*/
public function getRequirement(string $key)
{
return isset($this->requirements[$key]) ? $this->requirements[$key] : null;
return $this->requirements[$key] ?? null;
}
/**
@@ -539,15 +539,15 @@ class Route implements \Serializable
return $pattern;
}
return preg_replace_callback('#\{(!?\w++)(<.*?>)?(\?[^\}]*+)?\}#', function ($m) {
if (isset($m[3][0])) {
$this->setDefault($m[1], '?' !== $m[3] ? substr($m[3], 1) : null);
return preg_replace_callback('#\{(!?)(\w++)(<.*?>)?(\?[^\}]*+)?\}#', function ($m) {
if (isset($m[4][0])) {
$this->setDefault($m[2], '?' !== $m[4] ? substr($m[4], 1) : null);
}
if (isset($m[2][0])) {
$this->setRequirement($m[1], substr($m[2], 1, -1));
if (isset($m[3][0])) {
$this->setRequirement($m[2], substr($m[3], 1, -1));
}
return '{'.$m[1].'}';
return '{'.$m[1].$m[2].'}';
}, $pattern);
}

View File

@@ -114,7 +114,7 @@ class RouteCollection implements \IteratorAggregate, \Countable
*/
public function get(string $name)
{
return isset($this->routes[$name]) ? $this->routes[$name] : null;
return $this->routes[$name] ?? null;
}
/**

View File

@@ -350,11 +350,11 @@ class RouteCollectionBuilder
}
if (null === $resolver = $this->loader->getResolver()) {
throw new LoaderLoadException($resource, null, null, null, $type);
throw new LoaderLoadException($resource, null, 0, null, $type);
}
if (false === $loader = $resolver->resolve($resource, $type)) {
throw new LoaderLoadException($resource, null, null, null, $type);
throw new LoaderLoadException($resource, null, 0, null, $type);
}
$collections = $loader->load($resource, $type);

View File

@@ -102,7 +102,7 @@ class Router implements RouterInterface, RequestMatcherInterface
$this->loader = $loader;
$this->resource = $resource;
$this->logger = $logger;
$this->context = $context ?: new RequestContext();
$this->context = $context ?? new RequestContext();
$this->setOptions($options);
$this->defaultLocale = $defaultLocale;
}

View File

@@ -1,7 +1,7 @@
{
"name": "symfony/routing",
"type": "library",
"description": "Symfony Routing Component",
"description": "Maps an HTTP request to a set of configuration variables",
"keywords": ["routing", "router", "URL", "URI"],
"homepage": "https://symfony.com",
"license": "MIT",
@@ -26,7 +26,7 @@
"symfony/yaml": "^4.4|^5.0",
"symfony/expression-language": "^4.4|^5.0",
"symfony/dependency-injection": "^4.4|^5.0",
"doctrine/annotations": "^1.7",
"doctrine/annotations": "^1.10.4",
"psr/log": "~1.0"
},
"conflict": {
@@ -38,8 +38,7 @@
"symfony/http-foundation": "For using a Symfony Request object",
"symfony/config": "For using the all-in-one router or any loader",
"symfony/yaml": "For using the YAML loader",
"symfony/expression-language": "For using expression matching",
"doctrine/annotations": "For using the annotation loader"
"symfony/expression-language": "For using expression matching"
},
"autoload": {
"psr-4": { "Symfony\\Component\\Routing\\": "" },