Skip to content

Commit

Permalink
Changed expected min and max value types to numeric for FileSize crit…
Browse files Browse the repository at this point in the history
…erion
  • Loading branch information
ciastektk committed Dec 12, 2023
1 parent 4315d42 commit 2c520e8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/lib/Server/Input/Parser/Criterion/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private function validateInputArray(array $data): void
*
* @return array{
* mimeTypes?: string|array<string>,
* size?: array{min?: int|null, max?: int|null},
* size?: array{min?: numeric|null, max?: numeric|null},
* width?: array{min?: int|null, max?: int|null},
* height?: array{min?: int|null, max?: int|null},
* orientation?: string|array<string>,
Expand Down
9 changes: 2 additions & 7 deletions src/lib/Server/Input/Parser/Criterion/ImageFileSize.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,8 @@ public function parse(array $data, ParsingDispatcher $parsingDispatcher): ImageF
$this->validateInputArray($data);

$sizeData = $data[self::IMAGE_FILE_SIZE_CRITERION][self::SIZE_KEY];
$minFileSize = isset($sizeData['min'])
? (int) $sizeData['min']
: 0;

$maxFileSize = isset($sizeData['max'])
? (int) $sizeData['max']
: null;
$minFileSize = $sizeData['min'] ?? 0;
$maxFileSize = $sizeData['max'] ?? null;

return new ImageFileSizeCriterion(
$data[self::IMAGE_FILE_SIZE_CRITERION][self::FIELD_DEF_IDENTIFIER_KEY],
Expand Down

0 comments on commit 2c520e8

Please sign in to comment.