migration symfony 5 4 (#300)

* symfony 5.4 (diff dev)

* symfony 5.4 (working)

* symfony 5.4 (update autoload)

* symfony 5.4 (remove swiftmailer mailer implementation)

* symfony 5.4 (php doc and split Global accessor class)


### Impacted packages:

composer require php:">=7.2.5 <8.0.0" symfony/console:5.4.* symfony/dotenv:5.4.* symfony/framework-bundle:5.4.* symfony/twig-bundle:5.4.* symfony/yaml:5.4.* --update-with-dependencies

composer require symfony/stopwatch:5.4.* symfony/web-profiler-bundle:5.4.* --dev --update-with-dependencies
This commit is contained in:
bdalsass
2022-06-16 09:13:24 +02:00
committed by GitHub
parent abb13b70b9
commit 79da71ecf8
2178 changed files with 87439 additions and 59451 deletions

View File

@@ -11,6 +11,7 @@
namespace Symfony\Bundle\WebProfilerBundle\Controller;
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\DataCollector\RequestDataCollector;
@@ -23,9 +24,9 @@ use Symfony\Component\Routing\RouterInterface;
use Twig\Environment;
/**
* RouterController.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @internal
*/
class RouterController
{
@@ -34,24 +35,26 @@ class RouterController
private $matcher;
private $routes;
public function __construct(Profiler $profiler = null, Environment $twig, UrlMatcherInterface $matcher = null, RouteCollection $routes = null)
/**
* @var ExpressionFunctionProviderInterface[]
*/
private $expressionLanguageProviders = [];
public function __construct(Profiler $profiler = null, Environment $twig, UrlMatcherInterface $matcher = null, RouteCollection $routes = null, iterable $expressionLanguageProviders = [])
{
$this->profiler = $profiler;
$this->twig = $twig;
$this->matcher = $matcher;
$this->routes = (null === $routes && $matcher instanceof RouterInterface) ? $matcher->getRouteCollection() : $routes;
$this->expressionLanguageProviders = $expressionLanguageProviders;
}
/**
* Renders the profiler panel for the given token.
*
* @param string $token The profiler token
*
* @return Response A Response instance
*
* @throws NotFoundHttpException
*/
public function panelAction($token)
public function panelAction(string $token): Response
{
if (null === $this->profiler) {
throw new NotFoundHttpException('The profiler must be enabled.');
@@ -77,17 +80,13 @@ class RouterController
/**
* Returns the routing traces associated to the given request.
*
* @param string $method
*
* @return array
*/
private function getTraces(RequestDataCollector $request, $method)
private function getTraces(RequestDataCollector $request, string $method): array
{
$traceRequest = Request::create(
$request->getPathInfo(),
$request->getRequestServer(true)->get('REQUEST_METHOD'),
[],
\in_array($request->getMethod(), ['DELETE', 'PATCH', 'POST', 'PUT'], true) ? $request->getRequestRequest()->all() : $request->getRequestQuery()->all(),
$request->getRequestCookies(true)->all(),
[],
$request->getRequestServer(true)->all()
@@ -96,6 +95,9 @@ class RouterController
$context = $this->matcher->getContext();
$context->setMethod($method);
$matcher = new TraceableUrlMatcher($this->routes, $context);
foreach ($this->expressionLanguageProviders as $provider) {
$matcher->addExpressionLanguageProvider($provider);
}
return $matcher->getTracesForRequest($traceRequest);
}