Skip to content

Commit c151993

Browse files
committed
Move local $requestForMatching variable initialization outside loop.
1 parent 3518d67 commit c151993

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

ChainRouter.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,14 @@ private function doMatch($url, Request $request = null)
164164
{
165165
$methodNotAllowed = null;
166166

167+
$requestForMatching = $request;
167168
foreach ($this->all() as $router) {
168169
try {
169170
// the request/url match logic is the same as in Symfony/Component/HttpKernel/EventListener/RouterListener.php
170171
// matching requests is more powerful than matching URLs only, so try that first
171172
if ($router instanceof RequestMatcherInterface) {
172-
if (null === $request) {
173+
if (empty($requestForMatching)) {
173174
$requestForMatching = Request::create($url);
174-
} else {
175-
$requestForMatching = $request;
176175
}
177176

178177
return $router->matchRequest($requestForMatching);

0 commit comments

Comments
 (0)