From b475a03f7c1cab0928232eb802232844b7d2d20f Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Mon, 24 Jul 2023 11:05:55 +0200 Subject: [PATCH] IBX-6195: Made `URL_ALIAS_ROUTE_NAME` calls inside URL Alias Routers static (#246) For more details see https://issues.ibexa.co/browse/IBX-6195 and https://github.com/ibexa/core/pull/246 * Made `URL_ALIAS_ROUTE_NAME` calls inside `MVC\Symfony\Routing\UrlAliasRouter` static * Made `URL_ALIAS_ROUTE_NAME` call inside `MVC\Symfony\Routing\UrlWildcardRouter` static --- src/lib/MVC/Symfony/Routing/UrlAliasRouter.php | 6 +++--- src/lib/MVC/Symfony/Routing/UrlWildcardRouter.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/MVC/Symfony/Routing/UrlAliasRouter.php b/src/lib/MVC/Symfony/Routing/UrlAliasRouter.php index 3779381bed..e65c821831 100644 --- a/src/lib/MVC/Symfony/Routing/UrlAliasRouter.php +++ b/src/lib/MVC/Symfony/Routing/UrlAliasRouter.php @@ -109,7 +109,7 @@ public function matchRequest(Request $request) } $params = [ - '_route' => self::URL_ALIAS_ROUTE_NAME, + '_route' => static::URL_ALIAS_ROUTE_NAME, ]; switch ($urlAlias->type) { case URLAlias::LOCATION: @@ -305,7 +305,7 @@ public function generate(string $name, array $parameters = [], int $referenceTyp } // Normal route name - if ($name === self::URL_ALIAS_ROUTE_NAME) { + if ($name === static::URL_ALIAS_ROUTE_NAME) { if (isset($parameters['location']) || isset($parameters['locationId'])) { // Check if location is a valid Location object if (isset($parameters['location']) && !$parameters['location'] instanceof Location) { @@ -379,7 +379,7 @@ public function match($pathinfo) */ public function supports($name) { - return $name === self::URL_ALIAS_ROUTE_NAME || $this->supportsObject($name); + return $name === static::URL_ALIAS_ROUTE_NAME || $this->supportsObject($name); } private function supportsObject($object): bool diff --git a/src/lib/MVC/Symfony/Routing/UrlWildcardRouter.php b/src/lib/MVC/Symfony/Routing/UrlWildcardRouter.php index d1412622c4..4b83a27ca7 100644 --- a/src/lib/MVC/Symfony/Routing/UrlWildcardRouter.php +++ b/src/lib/MVC/Symfony/Routing/UrlWildcardRouter.php @@ -151,7 +151,7 @@ public function match($pathinfo): array */ public function supports($name): bool { - return $name === self::URL_ALIAS_ROUTE_NAME; + return $name === static::URL_ALIAS_ROUTE_NAME; } /**