-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
Add UploadedFileInterface
to valid types of $value
parameter of MimeType::isValid()
#236
Add UploadedFileInterface
to valid types of $value
parameter of MimeType::isValid()
#236
Conversation
The $value parameter is passed to FileInformationTrait::getFileInfo() which takes string|array|object, so isValid()'s $value should accept the same types. Signed-off-by: Rob Allen <rob@akrabat.com>
5590fc3
to
a0ef89e
Compare
This needs to match MimeType::isValid(). Signed-off-by: Rob Allen <rob@akrabat.com>
@akrabat should the baseline be reduced, given your explanation? 🤔 |
@Ocramius I don't think we can as the fallback if return $this->getFileBasedFileInfo($value, $hasType, $hasBasename); Within |
I'm pretty sure any object that has a Perhaps we should limit to |
Thanks @Ocramius. I've checked the code in a little more detail and it turns out that Updated to limit to this. |
3a84259
to
1ca7652
Compare
Investigating the code in more detail shows that $value can only be a string, an array or an instance of UploadedFileInterface. It cannot be an object that's Stringable as we call basename() which only supports real strings. Signed-off-by: Rob Allen <rob@akrabat.com>
Signed-off-by: Rob Allen <rob@akrabat.com>
1ca7652
to
bec5e0e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @akrabat!
UploadedFileInterface
to valid types of $value
parameter of MimeType::isValid()
The
$value
parameter ofMimeType::isValid()
is passed toFileInformationTrait::getFileInfo()
which takesstring|array|object
, soisValid()
's$value
should accept the same types.