@@ -882,12 +882,7 @@ private function verifyTypes($type, $value, array &$invalidTypes)
882
882
return true ;
883
883
}
884
884
885
- $ invalidValues = array_filter ( // Filter out valid values, keeping invalid values in the resulting array
886
- $ value ,
887
- function ($ value ) use ($ type ) {
888
- return !self ::isValueValidType ($ type , $ value );
889
- }
890
- );
885
+ $ invalidValues = $ this ->getInvalidValues ($ value , $ type );
891
886
892
887
if (!$ invalidValues ) {
893
888
return true ;
@@ -937,12 +932,7 @@ private function verifyArrayType($type, array $value, array &$invalidTypes)
937
932
return $ success ;
938
933
}
939
934
940
- $ invalid = array_filter ( // Filter out valid values, keeping invalid values in the resulting array
941
- $ value ,
942
- function ($ value ) use ($ type ) {
943
- return !self ::isValueValidType ($ type , $ value );
944
- }
945
- );
935
+ $ invalid = $ this ->getInvalidValues ($ value , $ type );
946
936
947
937
return !count ($ invalid );
948
938
}
@@ -1118,4 +1108,22 @@ private static function isValueValidType($type, $value)
1118
1108
{
1119
1109
return (function_exists ($ isFunction = 'is_ ' .$ type ) && $ isFunction ($ value )) || $ value instanceof $ t
8000
ype ;
1120
1110
}
1111
+
1112
+ /**
1113
+ * @param array $arrayValues
1114
+ *
1115
+ * @return array
1116
+ */
1117
+ private function getInvalidValues (array $ arrayValues , $ type )
1118
+ {
1119
+ $ invalidValues = array ();
1120
+
1121
+ foreach ($ arrayValues as $ key => $ value ) {
1122
+ if (!self ::isValueValidType ($ type , $ value )) {
1123
+ $ invalidValues [$ key ] = $ value ;
1124
+ }
1125
+ }
1126
+
1127
+ return $ invalidValues ;
3DF2
1128
+ }
1121
1129
}
0 commit comments