File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -213,7 +213,10 @@ private function extractChoices(mixed $choices): array
213213 foreach ($ choices as $ choice ) {
214214 if (is_array ($ choice ) && isset ($ choice ['value ' ])) {
215215 $ value = $ choice ['value ' ];
216- $ displayValues = $ this ->extractLocalizedTexts ($ choice , 'text ' , ['default ' => $ choice ['value ' ]]);
216+ if (!is_scalar ($ value )) {
217+ throw new \InvalidArgumentException ('Values must be scalar, got: ' . print_r ($ choice , true ));
218+ }
219+ $ displayValues = $ this ->extractLocalizedTexts ($ choice , 'text ' , ['default ' => (string ) $ value ]);
217220 } elseif (is_string ($ choice ) || is_int ($ choice )) {
218221 $ value = $ choice ;
219222 $ displayValues = [];
@@ -225,10 +228,8 @@ private function extractChoices(mixed $choices): array
225228
226229 if (is_int ($ value )) {
227230 $ result [] = new IntegerValueOption ($ value , $ displayValues );
228- } elseif (is_scalar ($ value )) {
229- $ result [] = new StringValueOption ((string ) $ value , $ displayValues );
230231 } else {
231- throw new \ InvalidArgumentException ( ' Values must be scalar, got: ' . print_r ( $ choice , true ) );
232+ $ result [] = new StringValueOption (( string ) $ value , $ displayValues );
232233 }
233234 }
234235
You can’t perform that action at this time.
0 commit comments