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
This commit is contained in:
commit
46e82299e2
|
@ -202,16 +202,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt
|
|||
$scheme = $this->context->getScheme();
|
||||
|
||||
if ($requiredSchemes) {
|
||||
$schemeMatched = false;
|
||||
foreach ($requiredSchemes as $requiredScheme) {
|
||||
if ($scheme === $requiredScheme) {
|
||||
$schemeMatched = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$schemeMatched) {
|
||||
if (!in_array($scheme, $requiredSchemes, true)) {
|
||||
$referenceType = self::ABSOLUTE_URL;
|
||||
$scheme = current($requiredSchemes);
|
||||
}
|
||||
|
|
Reference in New Issue