diff vendor/symfony/routing/Matcher/Dumper/StaticPrefixCollection.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 1fec387a4317
children
line wrap: on
line diff
--- a/vendor/symfony/routing/Matcher/Dumper/StaticPrefixCollection.php	Tue Jul 10 15:07:59 2018 +0100
+++ b/vendor/symfony/routing/Matcher/Dumper/StaticPrefixCollection.php	Thu Feb 28 13:21:36 2019 +0000
@@ -28,7 +28,7 @@
     /**
      * @var array[]|StaticPrefixCollection[]
      */
-    private $items = array();
+    private $items = [];
 
     /**
      * @var int
@@ -68,8 +68,8 @@
             // When a prefix is exactly the same as the base we move up the match start position.
             // This is needed because otherwise routes that come afterwards have higher precedence
             // than a possible regular expression, which goes against the input order sorting.
-            $this->items[] = array($prefix, $route);
-            $this->matchStart = count($this->items);
+            $this->items[] = [$prefix, $route];
+            $this->matchStart = \count($this->items);
 
             return;
         }
@@ -96,7 +96,7 @@
 
         // No optimised case was found, in this case we simple add the route for possible
         // grouping when new routes are added.
-        $this->items[] = array($prefix, $route);
+        $this->items[] = [$prefix, $route];
     }
 
     /**
@@ -106,7 +106,7 @@
      * @param string                       $prefix
      * @param mixed                        $route
      *
-     * @return null|StaticPrefixCollection
+     * @return StaticPrefixCollection|null
      */
     private function groupWithItem($item, $prefix, $route)
     {
@@ -120,7 +120,7 @@
         $child = new self($commonPrefix);
 
         if ($item instanceof self) {
-            $child->items = array($item);
+            $child->items = [$item];
         } else {
             $child->addRoute($item[0], $item[1]);
         }
@@ -152,9 +152,9 @@
      */
     private function detectCommonPrefix($prefix, $anotherPrefix)
     {
-        $baseLength = strlen($this->prefix);
+        $baseLength = \strlen($this->prefix);
         $commonLength = $baseLength;
-        $end = min(strlen($prefix), strlen($anotherPrefix));
+        $end = min(\strlen($prefix), \strlen($anotherPrefix));
 
         for ($i = $baseLength; $i <= $end; ++$i) {
             if (substr($prefix, 0, $i) !== substr($anotherPrefix, 0, $i)) {
@@ -166,7 +166,7 @@
 
         $commonPrefix = rtrim(substr($prefix, 0, $commonLength), '/');
 
-        if (strlen($commonPrefix) > $baseLength) {
+        if (\strlen($commonPrefix) > $baseLength) {
             return $commonPrefix;
         }
 
@@ -201,7 +201,7 @@
 
     private function shouldBeInlined()
     {
-        if (count($this->items) >= 3) {
+        if (\count($this->items) >= 3) {
             return false;
         }
 
@@ -212,7 +212,7 @@
         }
 
         foreach ($this->items as $item) {
-            if (is_array($item) && $item[0] === $this->prefix) {
+            if (\is_array($item) && $item[0] === $this->prefix) {
                 return false;
             }
         }