From 35ffc4efe2ebd59e256eed6edd98f5ef1509d3d7 Mon Sep 17 00:00:00 2001 From: Kirill Nesmeyanov Date: Mon, 5 Aug 2024 10:57:21 +0300 Subject: [PATCH] Fix PHP 8.4 deprecation notices (#34) --- src/UploadedFile.php | 4 ++-- src/UploadedFileFactory.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/UploadedFile.php b/src/UploadedFile.php index 1b9e3d4..0624179 100644 --- a/src/UploadedFile.php +++ b/src/UploadedFile.php @@ -104,8 +104,8 @@ public function __construct( $streamOrFile, int $size, int $error, - string $clientFilename = null, - string $clientMediaType = null + ?string $clientFilename = null, + ?string $clientMediaType = null ) { if (!array_key_exists($error, self::ERRORS)) { throw new InvalidArgumentException(sprintf( diff --git a/src/UploadedFileFactory.php b/src/UploadedFileFactory.php index ad7d658..5238055 100644 --- a/src/UploadedFileFactory.php +++ b/src/UploadedFileFactory.php @@ -17,10 +17,10 @@ final class UploadedFileFactory implements UploadedFileFactoryInterface */ public function createUploadedFile( StreamInterface $stream, - int $size = null, + ?int $size = null, int $error = UPLOAD_ERR_OK, - string $clientFilename = null, - string $clientMediaType = null + ?string $clientFilename = null, + ?string $clientMediaType = null ): UploadedFileInterface { $size = (int) ($size === null ? $stream->getSize() : $size); return new UploadedFile($stream, $size, $error, $clientFilename, $clientMediaType);