Skip to content

Commit 9935ae6

Browse files
derrabusnicolas-grekas
authored andcommitted
Fix inconsistent return points.
1 parent 166342c commit 9935ae6

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

Generator/UrlGenerator.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ public function generate($name, $parameters = [], $referenceType = self::ABSOLUT
123123
* @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route
124124
* @throws InvalidParameterException When a parameter value for a placeholder is not correct because
125125
* it does not match the requirement
126+
*
127+
* @return string|null
126128
*/
127129
protected function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, array $requiredSchemes = [])
128130
{
@@ -150,7 +152,7 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa
150152
$this->logger->error($message, ['parameter' => $token[3], 'route' => $name, 'expected' => $token[2], 'given' => $mergedParams[$token[3]]]);
151153
}
152154

153-
return;
155+
return null;
154156
}
155157

156158
$url = $token[1].$mergedParams[$token[3]].$url;
@@ -205,7 +207,7 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa
205207
$this->logger->error($message, ['parameter' => $token[3], 'route' => $name, 'expected' => $token[2], 'given' => $mergedParams[$token[3]]]);
206208
}
207209

208-
return;
210+
return null;
209211
}
210212

211213
$routeHost = $token[1].$mergedParams[$token[3]].$routeHost;

Generator/UrlGeneratorInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ interface UrlGeneratorInterface extends RequestContextAwareInterface
7575
* @param mixed[] $parameters An array of parameters
7676
* @param int $referenceType The type of reference to be generated (one of the constants)
7777
*
78-
* @return string The generated URL
78+
* @return string|null The generated URL
7979
*
8080
* @throws RouteNotFoundException If the named route doesn't exist
8181
* @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route

Matcher/Dumper/StaticPrefixCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ private function groupWithItem($item, $prefix, $route)
114114
$commonPrefix = $this->detectCommonPrefix($prefix, $itemPrefix);
115115

116116
if (!$commonPrefix) {
117-
return;
117+
return null;
118118
}
119119

120120
$child = new self($commonPrefix);

Matcher/TraceableUrlMatcher.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ protected function matchCollection($pathinfo, RouteCollection $routes)
127127

128128
return true;
129129
}
130+
131+
return [];
130132
}
131133

132134
private function addTrace($log, $level = self::ROUTE_DOES_NOT_MATCH, $name = null, $route = null)

0 commit comments

Comments
 (0)