We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug UploadedFile::store() could return null:
UploadedFile::store()
null
CodeIgniter4/system/HTTP/Files/UploadedFile.php
Lines 379 to 380 in 7ca2a71
string
Line 373 in 7ca2a71
CodeIgniter 4 version develop branch.
Affected module(s) UploadedFile
Expected behavior, and steps to reproduce if appropriate I'm not sure. If $this->move() fails, what should be returned?
$this->move()
Context
The text was updated successfully, but these errors were encountered:
It is strange phpstan didn't flag this incompatible return. 🤔
Sorry, something went wrong.
I found that $this->move() never returns false. So phpstan does not complains?
false
Line 131 in 7ca2a71
So should it be like this?
--- a/system/HTTP/Files/UploadedFile.php +++ b/system/HTTP/Files/UploadedFile.php @@ -376,8 +376,9 @@ class UploadedFile extends File implements UploadedFileInterface $fileName = $fileName ?? $this->getRandomName(); // Move the uploaded file to a new location. - return ($this->move(WRITEPATH . 'uploads/' . $folderName, $fileName)) ? - $folderName . $this->name : null; + $this->move(WRITEPATH . 'uploads/' . $folderName, $fileName); + + return $folderName . $this->name; } //--------------------------------------------------------------------
I sent PR #4187
Successfully merging a pull request may close this issue.
Describe the bug
UploadedFile::store()
could returnnull
:CodeIgniter4/system/HTTP/Files/UploadedFile.php
Lines 379 to 380 in 7ca2a71
But the return type is
string
.CodeIgniter4/system/HTTP/Files/UploadedFile.php
Line 373 in 7ca2a71
CodeIgniter 4 version
develop branch.
Affected module(s)
UploadedFile
Expected behavior, and steps to reproduce if appropriate
I'm not sure. If
$this->move()
fails, what should be returned?Context
The text was updated successfully, but these errors were encountered: