diff --git a/core/lib/Drupal/Core/Routing/UrlMatcher.php b/core/lib/Drupal/Core/Routing/UrlMatcher.php
index bc9a63f5f6ee5b9a3c8f3d4edc084156d0d9af8b..b6852824e143023226ba87893a6e1a655915b108 100644
--- a/core/lib/Drupal/Core/Routing/UrlMatcher.php
+++ b/core/lib/Drupal/Core/Routing/UrlMatcher.php
@@ -45,7 +45,7 @@ public function finalMatch(RouteCollection $collection, Request $request) {
   /**
    * {@inheritdoc}
    */
-  protected function getAttributes(Route $route, $name, array $attributes) {
+  protected function getAttributes(Route $route, $name, array $attributes): array {
     if ($route instanceof RouteObjectInterface && is_string($route->getRouteKey())) {
       $name = $route->getRouteKey();
     }