diff --git a/core/lib/Drupal/Core/Routing/RouteProvider.php b/core/lib/Drupal/Core/Routing/RouteProvider.php
index 937cff7..13fc0eb 100644
--- a/core/lib/Drupal/Core/Routing/RouteProvider.php
+++ b/core/lib/Drupal/Core/Routing/RouteProvider.php
@@ -246,7 +246,7 @@ public function getRoutesByNames($names) {
    * @return array
    *   An array of outlines that could match the specified path parts.
    */
-  public function getCandidateOutlines(array $parts) {
+  protected function getCandidateOutlines(array $parts) {
     $number_parts = count($parts);
     $ancestors = array();
     $length = $number_parts - 1;
@@ -343,7 +343,14 @@ protected function getRoutesByPath($path) {
       ->fetchAll(\PDO::FETCH_ASSOC);
 
     // We sort by fit and name in PHP to avoid a SQL filesort.
-    usort($routes, array($this, 'routeProviderRouteCompare'));
+    usort($routes, function(array $a, array $b) {
+      if ($a['fit'] == $b['fit']) {
+        return strcmp($a['name'], $b['name']);
+      }
+      // Reverse sort from highest to lowest fit. PHP should cast to int, but
+      // the explicit cast makes this sort more robust against unexpected input.
+      return (int) $a['fit'] < (int) $b['fit'] ? 1 : -1;
+    });
 
     foreach ($routes as $row) {
       $collection->add($row['name'], unserialize($row['route']));
@@ -353,18 +360,6 @@ protected function getRoutesByPath($path) {
   }
 
   /**
-   * Comparison function for usort on routes.
-   */
-  public function routeProviderRouteCompare(array $a, array $b) {
-    if ($a['fit'] == $b['fit']) {
-      return strcmp($a['name'], $b['name']);
-    }
-    // Reverse sort from highest to lowest fit. PHP should cast to int, but
-    // the explicit cast makes this sort more robust against unexpected input.
-    return (int) $a['fit'] < (int) $b['fit'] ? 1 : -1;
-  }
-
-  /**
    * {@inheritdoc}
    */
   public function getAllRoutes() {
diff --git a/core/modules/system/src/Tests/Routing/RouteProviderTest.php b/core/modules/system/src/Tests/Routing/RouteProviderTest.php
index c1d24ff..cbe8b09 100644
--- a/core/modules/system/src/Tests/Routing/RouteProviderTest.php
+++ b/core/modules/system/src/Tests/Routing/RouteProviderTest.php
@@ -115,7 +115,7 @@ protected function tearDown() {
   public function testCandidateOutlines() {
 
     $connection = Database::getConnection();
-    $provider = new RouteProvider($connection, $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes');
+    $provider = new TestRouteProvider($connection, $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes');
 
     $parts = array('node', '5', 'edit');
 
@@ -532,7 +532,7 @@ public function testRouteByName() {
    */
   public function testGetRoutesByPatternWithLongPatterns() {
     $connection = Database::getConnection();
-    $provider = new RouteProvider($connection, $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes');
+    $provider = new TestRouteProvider($connection, $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes');
 
     $this->fixtures->createTables($connection);
     // This pattern has only 3 parts, so we will get candidates, but no routes,
@@ -613,3 +613,11 @@ public function testGetRoutesPaged() {
   }
 
 }
+
+class TestRouteProvider extends RouteProvider {
+
+  public function getCandidateOutlines(array $parts) {
+    return parent::getCandidateOutlines($parts);
+  }
+
+}
