Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix @param types in UploadedFile #8716

Merged
merged 1 commit into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 12 additions & 18 deletions system/HTTP/Files/UploadedFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
use CodeIgniter\HTTP\Exceptions\HTTPException;
use Config\Mimes;
use Exception;
use InvalidArgumentException;
use RuntimeException;

/**
* Value object representing a single file uploaded through an
Expand Down Expand Up @@ -80,12 +78,12 @@ class UploadedFile extends File implements UploadedFileInterface
/**
* Accepts the file information as would be filled in from the $_FILES array.
*
* @param string $path The temporary location of the uploaded file.
* @param string $originalName The client-provided filename.
* @param string $mimeType The type of file as provided by PHP
* @param int $size The size of the file, in bytes
* @param int $error The error constant of the upload (one of PHP's UPLOADERRXXX constants)
* @param string $clientPath The webkit relative path of the uploaded file.
* @param string $path The temporary location of the uploaded file.
* @param string $originalName The client-provided filename.
* @param string|null $mimeType The type of file as provided by PHP
* @param int|null $size The size of the file, in bytes
* @param int|null $error The error constant of the upload (one of PHP's UPLOADERRXXX constants)
* @param string|null $clientPath The webkit relative path of the uploaded file.
*/
public function __construct(string $path, string $originalName, ?string $mimeType = null, ?int $size = null, ?int $error = null, ?string $clientPath = null)
{
Expand Down Expand Up @@ -122,16 +120,12 @@ public function __construct(string $path, string $originalName, ?string $mimeTyp
* @see http://php.net/is_uploaded_file
* @see http://php.net/move_uploaded_file
*
* @param string $targetPath Path to which to move the uploaded file.
* @param string $name the name to rename the file to.
* @param bool $overwrite State for indicating whether to overwrite the previously generated file with the same
* name or not.
* @param string $targetPath Path to which to move the uploaded file.
* @param string|null $name the name to rename the file to.
* @param bool $overwrite State for indicating whether to overwrite the previously generated file with the same
* name or not.
*
* @return bool
*
* @throws InvalidArgumentException if the $path specified is invalid.
* @throws RuntimeException on any error during the move operation.
* @throws RuntimeException on the second or subsequent call to the method.
*/
public function move(string $targetPath, ?string $name = null, bool $overwrite = false)
{
Expand Down Expand Up @@ -345,8 +339,8 @@ public function isValid(): bool
* By default, upload files are saved in writable/uploads directory. The YYYYMMDD folder
* and random file name will be created.
*
* @param string $folderName the folder name to writable/uploads directory.
* @param string $fileName the name to rename the file to.
* @param string|null $folderName the folder name to writable/uploads directory.
* @param string|null $fileName the name to rename the file to.
*
* @return string file full path
*/
Expand Down
17 changes: 8 additions & 9 deletions system/HTTP/Files/UploadedFileInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ interface UploadedFileInterface
/**
* Accepts the file information as would be filled in from the $_FILES array.
*
* @param string $path The temporary location of the uploaded file.
* @param string $originalName The client-provided filename.
* @param string $mimeType The type of file as provided by PHP
* @param int $size The size of the file, in bytes
* @param int $error The error constant of the upload (one of PHP's UPLOADERRXXX constants)
* @param string $clientPath The webkit relative path of the uploaded file.
* @param string $path The temporary location of the uploaded file.
* @param string $originalName The client-provided filename.
* @param string|null $mimeType The type of file as provided by PHP
* @param int|null $size The size of the file, in bytes
* @param int|null $error The error constant of the upload (one of PHP's UPLOADERRXXX constants)
* @param string|null $clientPath The webkit relative path of the uploaded file.
*/
public function __construct(string $path, string $originalName, ?string $mimeType = null, ?int $size = null, ?int $error = null, ?string $clientPath = null);

Expand All @@ -57,13 +57,12 @@ public function __construct(string $path, string $originalName, ?string $mimeTyp
* @see http://php.net/is_uploaded_file
* @see http://php.net/move_uploaded_file
*
* @param string $targetPath Path to which to move the uploaded file.
* @param string $name the name to rename the file to.
* @param string $targetPath Path to which to move the uploaded file.
* @param string|null $name the name to rename the file to.
*
* @return bool
*
* @throws InvalidArgumentException if the $path specified is invalid.
* @throws RuntimeException on any error during the move operation.
* @throws RuntimeException on the second or subsequent call to the method.
*/
public function move(string $targetPath, ?string $name = null);
Expand Down
Loading