8000 Added array type-hint and return early when types have errors · symfony/symfony@897081a · GitHub
[go: up one dir, main page]

Skip to content

Commit 897081a

Browse files
committed
Added array type-hint and return early when types have errors
1 parent 14a0707 commit 897081a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Symfony/Component/OptionsResolver/OptionsResolver.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -893,12 +893,12 @@ public function offsetGet($option)
893893
*
894894
* @return bool
895895
*/
896-
private function verifyTypes($type, $value, &$invalidTypes = array())
896+
private function verifyTypes($type, $value, array &$invalidTypes = array())
897897
{
898898
if ('[]' === substr($type, -2) && is_array($value)) {
899899
$originalType = $type;
900900
$type = substr($type, 0, -2);
901-
$invalidValues = array_filter( // Filter out valid values, keeping invalid values in the resulting arrays
901+
$invalidValues = array_filter( // Filter out valid values, keeping invalid values in the resulting array
902902
$value,
903903
function ($value) use ($type) {
904904
return (function_exists($isFunction = 'is_'.$type) && !$isFunction($value)) || !$value instanceof $type;
@@ -910,6 +910,8 @@ function ($value) use ($type) {
910910
}
911911

912912
$invalidTypes[] = $this->formatTypeOf($value, $originalType);
913+
914+
return false;
913915
}
914916

915917
if ((function_exists($isFunction = 'is_'.$type) && $isFunction($value)) || $value instanceof $type) {
@@ -919,6 +921,8 @@ function ($value) use ($type) {
919921
if (!$invalidTypes) {
920922
$invalidTypes[] = $this->formatTypeOf($value, null);
921923
}
924+
925+
return false;
922926
}
923927

924928
/**

0 commit comments

Comments
 (0)
0