Skip to content

Commit 8aa91de

Browse files
committed
Move responseType to default options array
1 parent 859e1ca commit 8aa91de

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/Filterer.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,11 @@ final class Filterer
134134
*/
135135
public static function filter(array $spec, array $input, array $options = [])
136136
{
137-
$options += ['allowUnknowns' => false, 'defaultRequired' => false];
137+
$options += ['allowUnknowns' => false, 'defaultRequired' => false, 'responseType' => self::RESPONSE_TYPE_ARRAY];
138138

139139
$allowUnknowns = self::getAllowUnknowns($options);
140140
$defaultRequired = self::getDefaultRequired($options);
141+
$responseType = $options['responseType'];
141142

142143
$inputToFilter = array_intersect_key($input, $spec);
143144
$leftOverSpec = array_diff_key($spec, $input);
@@ -187,8 +188,6 @@ public static function filter(array $spec, array $input, array $options = [])
187188

188189
$errors = self::handleAllowUnknowns($allowUnknowns, $leftOverInput, $errors);
189190

190-
$responseType = $options['responseType'] ?? self::RESPONSE_TYPE_ARRAY;
191-
192191
return self::generateFilterResponse($responseType, $inputToFilter, $errors, $leftOverInput);
193192
}
194193

0 commit comments

Comments
 (0)