diff --git a/core/lib/Drupal/Core/Url.php b/core/lib/Drupal/Core/Url.php
index de047eaa2cef926a5ac4a7f6eac3ce2bbd69ad50..6d25ded5a8360f27ef63b18eab52b4c280910058 100644
--- a/core/lib/Drupal/Core/Url.php
+++ b/core/lib/Drupal/Core/Url.php
@@ -515,6 +515,7 @@ protected function setUnrouted() {
     // Set empty route name and parameters.
     $this->routeName = NULL;
     $this->routeParameters = array();
+    return $this;
   }
 
   /**