Skip to content

Commit 554f614

Browse files
committed
resolve feedback
Addresses phpstan#3613 (comment) Instead of a 4-part if/elseif/else, this builds both lowercase and/or uppercase; then if neither was true, builds what would have been the final else case.
1 parent d068557 commit 554f614

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Type/Php/ParseUrlFunctionDynamicReturnTypeExtension.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,15 +211,19 @@ private function createComponentsArray(bool $urlIsLowercase, bool $urlIsUppercas
211211
foreach ($this->componentTypesPairedStringsForLowercaseString as $componentName => $componentValueType) {
212212
$builder->setOffsetValueType(new ConstantStringType($componentName), $componentValueType, true);
213213
}
214-
} elseif ($urlIsUppercase) {
214+
}
215+
216+
if ($urlIsUppercase) {
215217
if ($this->componentTypesPairedStringsForUppercaseString === null) {
216218
throw new ShouldNotHappenException();
217219
}
218220

219221
foreach ($this->componentTypesPairedStringsForUppercaseString as $componentName => $componentValueType) {
220222
$builder->setOffsetValueType(new ConstantStringType($componentName), $componentValueType, true);
221223
}
222-
} else {
224+
}
225+
226+
if (! $urlIsLowercase && ! $urlIsUppercase) {
223227
if ($this->componentTypesPairedStrings === null) {
224228
throw new ShouldNotHappenException();
225229
}

0 commit comments

Comments
 (0)