From 2c520e88bbb167bc6ddb8e4ec2a21790e1a092b3 Mon Sep 17 00:00:00 2001 From: Tomasz Kryszan Date: Tue, 12 Dec 2023 13:23:29 +0100 Subject: [PATCH] Changed expected min and max value types to numeric for FileSize criterion --- src/lib/Server/Input/Parser/Criterion/Image.php | 2 +- src/lib/Server/Input/Parser/Criterion/ImageFileSize.php | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/lib/Server/Input/Parser/Criterion/Image.php b/src/lib/Server/Input/Parser/Criterion/Image.php index 8572a15c..4dce3fc3 100644 --- a/src/lib/Server/Input/Parser/Criterion/Image.php +++ b/src/lib/Server/Input/Parser/Criterion/Image.php @@ -70,7 +70,7 @@ private function validateInputArray(array $data): void * * @return array{ * mimeTypes?: string|array, - * 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, diff --git a/src/lib/Server/Input/Parser/Criterion/ImageFileSize.php b/src/lib/Server/Input/Parser/Criterion/ImageFileSize.php index 093a262c..fd3cd7a5 100644 --- a/src/lib/Server/Input/Parser/Criterion/ImageFileSize.php +++ b/src/lib/Server/Input/Parser/Criterion/ImageFileSize.php @@ -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],