Skip to content
This repository was archived by the owner on Mar 29, 2024. It is now read-only.

Commit 8101fac

Browse files
committed
Cleanup default parameter string extracting
1 parent e1f0fa0 commit 8101fac

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Specs/Builder/ParameterSpecBuilder.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ protected function buildDefaultValue(string $definition)
141141
// after this point all expected definition values MUST be at least 2 chars length
142142

143143
if (strlen($definition) < 2) {
144+
// UNEXPECTED
144145
// Less likely we will ever get here because it should fail at a parsing step, but just in case
145146
throw new ParameterSpecBuilderException("Unknown default value format '{$definition}'");
146147
}
@@ -149,11 +150,10 @@ protected function buildDefaultValue(string $definition)
149150
return [];
150151
}
151152

152-
if ('"' == $definition[0] && '"' == $definition[-1]) {
153-
return trim($definition, '"');
154-
}
155-
if ("'" == $definition[0] && "'" == $definition[-1]) {
156-
return trim($definition, "'");
153+
foreach (['"', "'"] as $quote) {
154+
if ($quote == $definition[0] && $quote == $definition[-1]) {
155+
return trim($definition, $quote);
156+
}
157157
}
158158

159159
// Less likely we will ever get here because it should fail at a parsing step, but just in case

0 commit comments

Comments
 (0)