Skip to content

Commit 812302e

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.5
2 parents 1e00416 + d8ee64b commit 812302e

File tree

2 files changed

+20
-27
lines changed

2 files changed

+20
-27
lines changed

system/HTTP/Files/UploadedFile.php

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
use CodeIgniter\HTTP\Exceptions\HTTPException;
1818
use Config\Mimes;
1919
use Exception;
20-
use InvalidArgumentException;
21-
use RuntimeException;
2220

2321
/**
2422
* Value object representing a single file uploaded through an
@@ -82,12 +80,12 @@ class UploadedFile extends File implements UploadedFileInterface
8280
/**
8381
* Accepts the file information as would be filled in from the $_FILES array.
8482
*
85-
* @param string $path The temporary location of the uploaded file.
86-
* @param string $originalName The client-provided filename.
87-
* @param string $mimeType The type of file as provided by PHP
88-
* @param int $size The size of the file, in bytes
89-
* @param int $error The error constant of the upload (one of PHP's UPLOADERRXXX constants)
90-
* @param string $clientPath The webkit relative path of the uploaded file.
83+
* @param string $path The temporary location of the uploaded file.
84+
* @param string $originalName The client-provided filename.
85+
* @param string|null $mimeType The type of file as provided by PHP
86+
* @param int|null $size The size of the file, in bytes
87+
* @param int|null $error The error constant of the upload (one of PHP's UPLOADERRXXX constants)
88+
* @param string|null $clientPath The webkit relative path of the uploaded file.
9189
*/
9290
public function __construct(string $path, string $originalName, ?string $mimeType = null, ?int $size = null, ?int $error = null, ?string $clientPath = null)
9391
{
@@ -124,16 +122,12 @@ public function __construct(string $path, string $originalName, ?string $mimeTyp
124122
* @see http://php.net/is_uploaded_file
125123
* @see http://php.net/move_uploaded_file
126124
*
127-
* @param string $targetPath Path to which to move the uploaded file.
128-
* @param string $name the name to rename the file to.
129-
* @param bool $overwrite State for indicating whether to overwrite the previously generated file with the same
130-
* name or not.
125+
* @param string $targetPath Path to which to move the uploaded file.
126+
* @param string|null $name the name to rename the file to.
127+
* @param bool $overwrite State for indicating whether to overwrite the previously generated file with the same
128+
* name or not.
131129
*
132130
* @return bool
133-
*
134-
* @throws InvalidArgumentException if the $path specified is invalid.
135-
* @throws RuntimeException on any error during the move operation.
136-
* @throws RuntimeException on the second or subsequent call to the method.
137131
*/
138132
public function move(string $targetPath, ?string $name = null, bool $overwrite = false)
139133
{
@@ -347,8 +341,8 @@ public function isValid(): bool
347341
* By default, upload files are saved in writable/uploads directory. The YYYYMMDD folder
348342
* and random file name will be created.
349343
*
350-
* @param string $folderName the folder name to writable/uploads directory.
351-
* @param string $fileName the name to rename the file to.
344+
* @param string|null $folderName the folder name to writable/uploads directory.
345+
* @param string|null $fileName the name to rename the file to.
352346
*
353347
* @return string file full path
354348
*/

system/HTTP/Files/UploadedFileInterface.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ interface UploadedFileInterface
2828
/**
2929
* Accepts the file information as would be filled in from the $_FILES array.
3030
*
31-
* @param string $path The temporary location of the uploaded file.
32-
* @param string $originalName The client-provided filename.
33-
* @param string $mimeType The type of file as provided by PHP
34-
* @param int $size The size of the file, in bytes
35-
* @param int $error The error constant of the upload (one of PHP's UPLOADERRXXX constants)
36-
* @param string $clientPath The webkit relative path of the uploaded file.
31+
* @param string $path The temporary location of the uploaded file.
32+
* @param string $originalName The client-provided filename.
33+
* @param string|null $mimeType The type of file as provided by PHP
34+
* @param int|null $size The size of the file, in bytes
35+
* @param int|null $error The error constant of the upload (one of PHP's UPLOADERRXXX constants)
36+
* @param string|null $clientPath The webkit relative path of the uploaded file.
3737
*/
3838
public function __construct(string $path, string $originalName, ?string $mimeType = null, ?int $size = null, ?int $error = null, ?string $clientPath = null);
3939

@@ -59,13 +59,12 @@ public function __construct(string $path, string $originalName, ?string $mimeTyp
5959
* @see http://php.net/is_uploaded_file
6060
* @see http://php.net/move_uploaded_file
6161
*
62-
* @param string $targetPath Path to which to move the uploaded file.
63-
* @param string $name the name to rename the file to.
62+
* @param string $targetPath Path to which to move the uploaded file.
63+
* @param string|null $name the name to rename the file to.
6464
*
6565
* @return bool
6666
*
6767
* @throws InvalidArgumentException if the $path specified is invalid.
68-
* @throws RuntimeException on any error during the move operation.
6968
* @throws RuntimeException on the second or subsequent call to the method.
7069
*/
7170
public function move(string $targetPath, ?string $name = null);

0 commit comments

Comments
 (0)