Skip to content

Commit

Permalink
Support UploadedFile validation (#560)
Browse files Browse the repository at this point in the history
* Support validate UploadedFile

* Optimize

* Fix client file and media type properties in ValidatedDTOTest

---------

Co-authored-by: Deeka Wong <[email protected]>
  • Loading branch information
huangdijia and huangdijia committed Feb 7, 2024
1 parent 1dc3ae5 commit 42b40e8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/SimpleDTO.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use Hyperf\Contract\ConfigInterface;
use Hyperf\Contract\ValidatorInterface;
use Hyperf\Database\Model\Model;
use Hyperf\HttpMessage\Upload\UploadedFile;
use Hyperf\Validation\ValidationException;
use ReflectionClass;
use ReflectionProperty;
Expand Down Expand Up @@ -490,7 +491,7 @@ private function isArrayable(mixed $value): bool
|| $value instanceof Collection
|| $value instanceof ValidatedDTO
|| $value instanceof Model
|| is_object($value);
|| (is_object($value) && ! ($value instanceof UploadedFile));
}

private function formatArrayableValue(mixed $value): array|int|string
Expand Down

0 comments on commit 42b40e8

Please sign in to comment.