Commit 9fd920e2 by Qiang Xue

minor refactoring of FileValidator.

parent bb4a0c70
...@@ -268,7 +268,7 @@ class FileValidator extends Validator ...@@ -268,7 +268,7 @@ class FileValidator extends Validator
*/ */
public function isEmpty($value, $trim = false) public function isEmpty($value, $trim = false)
{ {
$value = is_array($value) && !empty($value) ? $value[0] : $value; $value = is_array($value) ? reset($value) : $value;
return !($value instanceof UploadedFile) || $value->error == UPLOAD_ERR_NO_FILE; return !($value instanceof UploadedFile) || $value->error == UPLOAD_ERR_NO_FILE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment