N°6934 - Symfony 6.4 - upgrade Symfony bundles to 6.4 (#580)

* Update Symfony lib to version ~6.4.0
* Update code missing return type
* Add an iTop general configuration entry to store application secret (Symfony mandatory parameter)
* Use dependency injection in ExceptionListener & UserProvider classes
This commit is contained in:
bdalsass
2023-12-05 13:56:56 +01:00
committed by GitHub
parent 863ab4560c
commit 27ce51ab07
1392 changed files with 44869 additions and 27799 deletions

View File

@@ -29,18 +29,24 @@ class TraceableUrlMatcher extends UrlMatcher
protected $traces;
/**
* @return array
*/
public function getTraces(string $pathinfo)
{
$this->traces = [];
try {
$this->match($pathinfo);
} catch (ExceptionInterface $e) {
} catch (ExceptionInterface) {
}
return $this->traces;
}
/**
* @return array
*/
public function getTracesForRequest(Request $request)
{
$this->request = $request;
@@ -50,7 +56,7 @@ class TraceableUrlMatcher extends UrlMatcher
return $traces;
}
protected function matchCollection(string $pathinfo, RouteCollection $routes)
protected function matchCollection(string $pathinfo, RouteCollection $routes): array
{
// HEAD and GET are equivalent as per RFC
if ('HEAD' === $method = $this->context->getMethod()) {
@@ -99,7 +105,7 @@ class TraceableUrlMatcher extends UrlMatcher
continue;
}
$hasTrailingVar = $trimmedPathinfo !== $pathinfo && preg_match('#\{\w+\}/?$#', $route->getPath());
$hasTrailingVar = $trimmedPathinfo !== $pathinfo && preg_match('#\{[\w\x80-\xFF]+\}/?$#', $route->getPath());
if ($hasTrailingVar && ($hasTrailingSlash || (null === $m = $matches[\count($compiledRoute->getPathVariables())] ?? null) || '/' !== ($m[-1] ?? '/')) && preg_match($regex, $trimmedPathinfo, $m)) {
if ($hasTrailingSlash) {
@@ -115,7 +121,9 @@ class TraceableUrlMatcher extends UrlMatcher
continue;
}
$status = $this->handleRouteRequirements($pathinfo, $name, $route);
$attributes = $this->getAttributes($route, $name, array_replace($matches, $hostMatches));
$status = $this->handleRouteRequirements($pathinfo, $name, $route, $attributes);
if (self::REQUIREMENT_MISMATCH === $status[0]) {
$this->addTrace(sprintf('Condition "%s" does not evaluate to "true"', $route->getCondition()), self::ROUTE_ALMOST_MATCHES, $name, $route);
@@ -146,19 +154,19 @@ class TraceableUrlMatcher extends UrlMatcher
$this->addTrace('Route matches!', self::ROUTE_MATCHES, $name, $route);
return $this->getAttributes($route, $name, array_replace($matches, $hostMatches, $status[1] ?? []));
return array_replace($attributes, $status[1] ?? []);
}
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): void
{
$this->traces[] = [
'log' => $log,
'name' => $name,
'level' => $level,
'path' => null !== $route ? $route->getPath() : null,
'path' => $route?->getPath(),
];
}
}