diff --git a/src/Autocomplete/src/Form/AutocompleteChoiceTypeExtension.php b/src/Autocomplete/src/Form/AutocompleteChoiceTypeExtension.php index b510d3fd47d..fcc9dccf05f 100644 --- a/src/Autocomplete/src/Form/AutocompleteChoiceTypeExtension.php +++ b/src/Autocomplete/src/Form/AutocompleteChoiceTypeExtension.php @@ -124,9 +124,9 @@ private function hasUrlParameters(string $url): bool private function validateExtraOptions(array $extraOptions): void { - foreach ($extraOptions as $option) { + foreach ($extraOptions as $optionKey => $option) { if (!\is_scalar($option) && !\is_array($option) && null !== $option) { - throw new \InvalidArgumentException(sprintf('Extra option "%s" must be a scalar value, an array or null. Got "%s".', $option, get_debug_type($option))); + throw new \InvalidArgumentException(sprintf('Extra option with key "%s" must be a scalar value, an array or null. Got "%s".', $optionKey, get_debug_type($option))); } if (\is_array($option)) {