Skip to content

Commit 26916bc

Browse files
Set strict parameter of in_array to true where possible
1 parent b365985 commit 26916bc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Matcher/TraceableUrlMatcher.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ protected function matchCollection(string $pathinfo, RouteCollection $routes): a
125125
}
126126

127127
if ('/' !== $pathinfo && !$hasTrailingVar && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
128-
if ($supportsTrailingSlash && (!$requiredMethods || \in_array('GET', $requiredMethods))) {
128+
if ($supportsTrailingSlash && (!$requiredMethods || \in_array('GET', $requiredMethods, true))) {
129129
$this->addTrace('Route matches!', self::ROUTE_MATCHES, $name, $route);
130130

131131
return $this->allow = $this->allowSchemes = [];
@@ -140,7 +140,7 @@ protected function matchCollection(string $pathinfo, RouteCollection $routes): a
140140
continue;
141141
}
142142

143-
if ($requiredMethods && !\in_array($method, $requiredMethods)) {
143+
if ($requiredMethods && !\in_array($method, $requiredMethods, true)) {
144144
$this->allow = array_merge($this->allow, $requiredMethods);
145145
$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);
146146
continue;

Matcher/UrlMatcher.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ protected function matchCollection(string $pathinfo, RouteCollection $routes): a
163163
}
164164

165165
if ('/' !== $pathinfo && !$hasTrailingVar && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
166-
if ($supportsTrailingSlash && (!$requiredMethods || \in_array('GET', $requiredMethods))) {
166+
if ($supportsTrailingSlash && (!$requiredMethods || \in_array('GET', $requiredMethods, true))) {
167167
return $this->allow = $this->allowSchemes = [];
168168
}
169169
continue;
@@ -174,7 +174,7 @@ protected function matchCollection(string $pathinfo, RouteCollection $routes): a
174174
continue;
175175
}
176176

177-
if ($requiredMethods && !\in_array($method, $requiredMethods)) {
177+
if ($requiredMethods && !\in_array($method, $requiredMethods, true)) {
178178
$this->allow = array_merge($this->allow, $requiredMethods);
179179
continue;
180180
}

0 commit comments

Comments
 (0)