Skip to content

Commit d8ee64b

Browse files
authored
Merge pull request #8716 from kenjis/docs-fix-UploadedFile-types
docs: fix @param types in UploadedFile
2 parents 3bfe413 + f9ed5a6 commit d8ee64b

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
@@ -15,8 +15,6 @@
1515
use CodeIgniter\HTTP\Exceptions\HTTPException;
1616
use Config\Mimes;
1717
use Exception;
18-
use InvalidArgumentException;
19-
use RuntimeException;
2018

2119
/**
2220
* Value object representing a single file uploaded through an
@@ -80,12 +78,12 @@ class UploadedFile extends File implements UploadedFileInterface
8078
/**
8179
* Accepts the file information as would be filled in from the $_FILES array.
8280
*
83-
* @param string $path The temporary location of the uploaded file.
84-
* @param string $originalName The client-provided filename.
85-
* @param string $mimeType The type of file as provided by PHP
86-
* @param int $size The size of the file, in bytes
87-
* @param int $error The error constant of the upload (one of PHP's UPLOADERRXXX constants)
88-
* @param string $clientPath The webkit relative path of the uploaded file.
81+
* @param string $path The temporary location of the uploaded file.
82+
* @param string $originalName The client-provided filename.
83+
* @param string|null $mimeType The type of file as provided by PHP
84+
* @param int|null $size The size of the file, in bytes
85+
* @param int|null $error The error constant of the upload (one of PHP's UPLOADERRXXX constants)
86+
* @param string|null $clientPath The webkit relative path of the uploaded file.
8987
*/
9088
public function __construct(string $path, string $originalName, ?string $mimeType = null, ?int $size = null, ?int $error = null, ?string $clientPath = null)
9189
{
@@ -122,16 +120,12 @@ public function __construct(string $path, string $originalName, ?string $mimeTyp
122120
* @see http://php.net/is_uploaded_file
123121
* @see http://php.net/move_uploaded_file
124122
*
125-
* @param string $targetPath Path to which to move the uploaded file.
126-
* @param string $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.
123+
* @param string $targetPath Path to which to move the uploaded file.
124+
* @param string|null $name the name to rename the file to.
125+
* @param bool $overwrite State for indicating whether to overwrite the previously generated file with the same
126+
* name or not.
129127
*
130128
* @return bool
131-
*
132-
* @throws InvalidArgumentException if the $path specified is invalid.
133-
* @throws RuntimeException on any error during the move operation.
134-
* @throws RuntimeException on the second or subsequent call to the method.
135129
*/
136130
public function move(string $targetPath, ?string $name = null, bool $overwrite = false)
137131
{
@@ -345,8 +339,8 @@ public function isValid(): bool
345339
* By default, upload files are saved in writable/uploads directory. The YYYYMMDD folder
346340
* and random file name will be created.
347341
*
348-
* @param string $folderName the folder name to writable/uploads directory.
349-
* @param string $fileName the name to rename the file to.
342+
* @param string|null $folderName the folder name to writable/uploads directory.
343+
* @param string|null $fileName the name to rename the file to.
350344
*
351345
* @return string file full path
352346
*/

system/HTTP/Files/UploadedFileInterface.php

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

@@ -57,13 +57,12 @@ public function __construct(string $path, string $originalName, ?string $mimeTyp
5757
* @see http://php.net/is_uploaded_file
5858
* @see http://php.net/move_uploaded_file
5959
*
60-
* @param string $targetPath Path to which to move the uploaded file.
61-
* @param string $name the name to rename the file to.
60+
* @param string $targetPath Path to which to move the uploaded file.
61+
* @param string|null $name the name to rename the file to.
6262
*
6363
* @return bool
6464
*
6565
* @throws InvalidArgumentException if the $path specified is invalid.
66-
* @throws RuntimeException on any error during the move operation.
6766
* @throws RuntimeException on the second or subsequent call to the method.
6867
*/
6968
public function move(string $targetPath, ?string $name = null);

0 commit comments

Comments
 (0)