@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | /** |
| 278 | 278 | * Set the MIME type. |
| 279 | 279 | * |
| 280 | - * @param mixed $type The file MIME type. |
|
| 280 | + * @param string $type The file MIME type. |
|
| 281 | 281 | * @throws InvalidArgumentException If the MIME type argument is not a string. |
| 282 | 282 | * @return FileProperty Chainable |
| 283 | 283 | */ |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | * |
| 304 | 304 | * @todo Refactor to support multilingual/multiple files. |
| 305 | 305 | * |
| 306 | - * @return integer Returns the MIME type for the first value. |
|
| 306 | + * @return null|string Returns the MIME type for the first value. |
|
| 307 | 307 | */ |
| 308 | 308 | public function getMimetype() |
| 309 | 309 | { |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | * Extract the MIME type from the given file. |
| 330 | 330 | * |
| 331 | 331 | * @param string $file The file to check. |
| 332 | - * @return integer|null Returns the file's MIME type, |
|
| 332 | + * @return null|string Returns the file's MIME type, |
|
| 333 | 333 | * or NULL in case of an error or the file is missing. |
| 334 | 334 | */ |
| 335 | 335 | public function getMimetypeFor($file) |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | /** |
| 504 | - * @return array |
|
| 504 | + * @return string[] |
|
| 505 | 505 | */ |
| 506 | 506 | public function validationMethods() |
| 507 | 507 | { |
@@ -1148,7 +1148,7 @@ discard block |
||
| 1148 | 1148 | /** |
| 1149 | 1149 | * Generate a unique filename. |
| 1150 | 1150 | * |
| 1151 | - * @param string|array $filename The filename to alter. |
|
| 1151 | + * @param string $filename The filename to alter. |
|
| 1152 | 1152 | * @throws InvalidArgumentException If the given filename is invalid. |
| 1153 | 1153 | * @return string |
| 1154 | 1154 | */ |
@@ -1599,7 +1599,7 @@ discard block |
||
| 1599 | 1599 | * |
| 1600 | 1600 | * @param array $uploadedFiles The non-normalized tree of uploaded file data. |
| 1601 | 1601 | * @param callable $filterCallback If specified, the callback function to used to filter files. |
| 1602 | - * @param mixed $searchKey If specified, then only top-level keys containing these values are returned. |
|
| 1602 | + * @param string $searchKey If specified, then only top-level keys containing these values are returned. |
|
| 1603 | 1603 | * @return array A tree of normalized $_FILE entries. |
| 1604 | 1604 | */ |
| 1605 | 1605 | public static function parseUploadedFiles(array $uploadedFiles, callable $filterCallback = null, $searchKey = null) |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | $factor = floor((strlen($bytes) - 1) / 3); |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | - $unit = [ 'B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB' ]; |
|
| 492 | + $unit = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; |
|
| 493 | 493 | |
| 494 | 494 | $factor = floor((strlen($bytes) - 1) / 3); |
| 495 | 495 | |
@@ -623,12 +623,12 @@ discard block |
||
| 623 | 623 | } |
| 624 | 624 | |
| 625 | 625 | $array = $this->parseValAsMultiple($value); |
| 626 | - array_walk_recursive($array, function ($item) use (&$files) { |
|
| 626 | + array_walk_recursive($array, function($item) use (&$files) { |
|
| 627 | 627 | $array = $this->parseValAsMultiple($item); |
| 628 | 628 | $files = array_merge($files, $array); |
| 629 | 629 | }); |
| 630 | 630 | |
| 631 | - $files = array_filter($files, function ($file) { |
|
| 631 | + $files = array_filter($files, function($file) { |
|
| 632 | 632 | return is_string($file) && isset($file[0]); |
| 633 | 633 | }); |
| 634 | 634 | $files = array_unique($files); |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | { |
| 727 | 727 | // Bag value if singular |
| 728 | 728 | if (!is_array($values) || isset($values['id'])) { |
| 729 | - $values = [ $values ]; |
|
| 729 | + $values = [$values]; |
|
| 730 | 730 | } |
| 731 | 731 | |
| 732 | 732 | $parsed = []; |
@@ -766,7 +766,7 @@ discard block |
||
| 766 | 766 | { |
| 767 | 767 | // Bag value if singular |
| 768 | 768 | if (isset($files['error'])) { |
| 769 | - $files = [ $files ]; |
|
| 769 | + $files = [$files]; |
|
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | $parsed = []; |
@@ -808,7 +808,7 @@ discard block |
||
| 808 | 808 | |
| 809 | 809 | if ($this['multiple']) { |
| 810 | 810 | if (!is_array($values)) { |
| 811 | - $values = empty($values) && !is_numeric($values) ? [] : [ $values ]; |
|
| 811 | + $values = empty($values) && !is_numeric($values) ? [] : [$values]; |
|
| 812 | 812 | } |
| 813 | 813 | } else { |
| 814 | 814 | if (is_array($values)) { |
@@ -1065,7 +1065,7 @@ discard block |
||
| 1065 | 1065 | public function sanitizeFilename($filename) |
| 1066 | 1066 | { |
| 1067 | 1067 | // Remove blacklisted caharacters |
| 1068 | - $blacklist = [ '/', '\\', '\0', '*', ':', '?', '"', '<', '>', '|', '#', '&', '!', '`', ' ' ]; |
|
| 1068 | + $blacklist = ['/', '\\', '\0', '*', ':', '?', '"', '<', '>', '|', '#', '&', '!', '`', ' ']; |
|
| 1069 | 1069 | $filename = str_replace($blacklist, '_', (string)$filename); |
| 1070 | 1070 | |
| 1071 | 1071 | // Avoid hidden file or trailing dot |
@@ -1363,7 +1363,7 @@ discard block |
||
| 1363 | 1363 | if (!file_exists($uploadPath)) { |
| 1364 | 1364 | $this->logger->debug(sprintf( |
| 1365 | 1365 | '[%s] Upload directory [%s] does not exist; attempting to create path', |
| 1366 | - [ get_called_class().'::'.__FUNCTION__ ], |
|
| 1366 | + [get_called_class().'::'.__FUNCTION__], |
|
| 1367 | 1367 | $uploadPath |
| 1368 | 1368 | )); |
| 1369 | 1369 | |
@@ -1581,7 +1581,7 @@ discard block |
||
| 1581 | 1581 | { |
| 1582 | 1582 | $propIdent = $this->ident(); |
| 1583 | 1583 | |
| 1584 | - $filterErrNoFile = function (array $file) { |
|
| 1584 | + $filterErrNoFile = function(array $file) { |
|
| 1585 | 1585 | return $file['error'] !== UPLOAD_ERR_NO_FILE; |
| 1586 | 1586 | }; |
| 1587 | 1587 | $uploadedFiles = static::parseUploadedFiles($_FILES, $filterErrNoFile, $propIdent); |