10000 minor #18227 [Routing] small refactoring for scheme requirement (Tobion) · symfony/symfony@46e8229 · GitHub
[go: up one dir, main page]

Skip to content

Commit 46e8229

Browse files
committed
minor #18227 [Routing] small refactoring for scheme requirement (Tobion)
This PR was merged into the 2.7 branch. Discussion ---------- [Routing] small refactoring for scheme requirement | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | refactoring | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #18106 | License | MIT | Doc PR | Commits ------- 85f5e01 [Routing] small refactoring for scheme requirement
2 parents 66f54ff + 85f5e01 commit 46e8229

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

src/Symfony/Component/Routing/Generator/UrlGenerator.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -202,16 +202,7 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa
202202
$scheme = $this->context->getScheme();
203203

204204
if ($requiredSchemes) {
205-
$schemeMatched = false;
206-
foreach ($requiredSchemes as $requiredScheme) {
207-
if ($scheme === $requiredScheme) {
208-
$schemeMatched = true;
209-
210-
break;
211-
}
212-
}
213-
214-
if (!$schemeMatched) {
205+
if (!in_array($scheme, $requiredSchemes, true)) {
215206
$referenceType = self::ABSOLUTE_URL;
216207
$scheme = current($requiredSchemes);
217208
}

0 commit comments

Comments
 (0)
0