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

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 7a779792577d
children
line wrap: on
line diff
--- a/vendor/symfony/routing/Matcher/TraceableUrlMatcher.php	Tue Jul 10 15:07:59 2018 +0100
+++ b/vendor/symfony/routing/Matcher/TraceableUrlMatcher.php	Thu Feb 28 13:21:36 2019 +0000
@@ -31,7 +31,7 @@
 
     public function getTraces($pathinfo)
     {
-        $this->traces = array();
+        $this->traces = [];
 
         try {
             $this->match($pathinfo);
@@ -57,7 +57,7 @@
 
             if (!preg_match($compiledRoute->getRegex(), $pathinfo, $matches)) {
                 // does it match without any requirements?
-                $r = new Route($route->getPath(), $route->getDefaults(), array(), $route->getOptions());
+                $r = new Route($route->getPath(), $route->getDefaults(), [], $route->getOptions());
                 $cr = $r->compile();
                 if (!preg_match($cr->getRegex(), $pathinfo)) {
                     $this->addTrace(sprintf('Path "%s" does not match', $route->getPath()), self::ROUTE_DOES_NOT_MATCH, $name, $route);
@@ -66,10 +66,10 @@
                 }
 
                 foreach ($route->getRequirements() as $n => $regex) {
-                    $r = new Route($route->getPath(), $route->getDefaults(), array($n => $regex), $route->getOptions());
+                    $r = new Route($route->getPath(), $route->getDefaults(), [$n => $regex], $route->getOptions());
                     $cr = $r->compile();
 
-                    if (in_array($n, $cr->getVariables()) && !preg_match($cr->getRegex(), $pathinfo)) {
+                    if (\in_array($n, $cr->getVariables()) && !preg_match($cr->getRegex(), $pathinfo)) {
                         $this->addTrace(sprintf('Requirement for "%s" does not match (%s)', $n, $regex), self::ROUTE_ALMOST_MATCHES, $name, $route);
 
                         continue 2;
@@ -80,7 +80,7 @@
             }
 
             // check host requirement
-            $hostMatches = array();
+            $hostMatches = [];
             if ($compiledRoute->getHostRegex() && !preg_match($compiledRoute->getHostRegex(), $this->context->getHost(), $hostMatches)) {
                 $this->addTrace(sprintf('Host "%s" does not match the requirement ("%s")', $this->context->getHost(), $route->getHost()), self::ROUTE_ALMOST_MATCHES, $name, $route);
 
@@ -94,7 +94,7 @@
                     $method = 'GET';
                 }
 
-                if (!in_array($method, $requiredMethods)) {
+                if (!\in_array($method, $requiredMethods)) {
                     $this->allow = array_merge($this->allow, $requiredMethods);
 
                     $this->addTrace(sprintf('Method "%s" does not match any of the required methods (%s)', $this->context->getMethod(), implode(', ', $requiredMethods)), self::ROUTE_ALMOST_MATCHES, $name, $route);
@@ -105,7 +105,7 @@
 
             // check condition
             if ($condition = $route->getCondition()) {
-                if (!$this->getExpressionLanguage()->evaluate($condition, array('context' => $this->context, 'request' => $this->request ?: $this->createRequest($pathinfo)))) {
+                if (!$this->getExpressionLanguage()->evaluate($condition, ['context' => $this->context, 'request' => $this->request ?: $this->createRequest($pathinfo)])) {
                     $this->addTrace(sprintf('Condition "%s" does not evaluate to "true"', $condition), self::ROUTE_ALMOST_MATCHES, $name, $route);
 
                     continue;
@@ -131,11 +131,11 @@
 
     private function addTrace($log, $level = self::ROUTE_DOES_NOT_MATCH, $name = null, $route = null)
     {
-        $this->traces[] = array(
+        $this->traces[] = [
             'log' => $log,
             'name' => $name,
             'level' => $level,
             'path' => null !== $route ? $route->getPath() : null,
-        );
+        ];
     }
 }