@@ -161,8 +161,8 @@ |
||
| 161 | 161 | private function dateTimeVal($val) |
| 162 | 162 | { |
| 163 | 163 | if ($val === null || |
| 164 | - (is_string($val) && ! strlen(trim($val))) || |
|
| 165 | - (is_array($val) && ! count(array_filter($val, 'strlen'))) |
|
| 164 | + (is_string($val) && !strlen(trim($val))) || |
|
| 165 | + (is_array($val) && !count(array_filter($val, 'strlen'))) |
|
| 166 | 166 | ) { |
| 167 | 167 | return null; |
| 168 | 168 | } |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | /** |
| 273 | - * @return array |
|
| 273 | + * @return string[] |
|
| 274 | 274 | */ |
| 275 | 275 | public function validationMethods() |
| 276 | 276 | { |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | /** |
| 368 | - * @param integer|string $timestamp Timestamp. |
|
| 368 | + * @param integer $timestamp Timestamp. |
|
| 369 | 369 | * @return boolean |
| 370 | 370 | */ |
| 371 | 371 | private function isValidTimeStamp($timestamp) |
@@ -3,7 +3,6 @@ discard block |
||
| 3 | 3 | namespace Charcoal\Property; |
| 4 | 4 | |
| 5 | 5 | use PDO; |
| 6 | -use Exception; |
|
| 7 | 6 | use LogicException; |
| 8 | 7 | use RuntimeException; |
| 9 | 8 | use InvalidArgumentException; |
@@ -11,7 +10,6 @@ discard block |
||
| 11 | 10 | // From PSR-3 |
| 12 | 11 | use Psr\Log\LoggerAwareInterface; |
| 13 | 12 | use Psr\Log\LoggerAwareTrait; |
| 14 | -use Psr\Log\NullLogger; |
|
| 15 | 13 | |
| 16 | 14 | // From Pimple |
| 17 | 15 | use Pimple\Container; |
@@ -741,7 +741,7 @@ |
||
| 741 | 741 | /** |
| 742 | 742 | * Legacy support of active() instead of getActive(). |
| 743 | 743 | * |
| 744 | - * @return string |
|
| 744 | + * @return boolean |
|
| 745 | 745 | */ |
| 746 | 746 | public function active() |
| 747 | 747 | { |
@@ -351,13 +351,13 @@ discard block |
||
| 351 | 351 | return $val; |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | - $val = array_map([ $this, 'parseOne' ], $val); |
|
| 354 | + $val = array_map([$this, 'parseOne'], $val); |
|
| 355 | 355 | } else { |
| 356 | 356 | if ($this['l10n']) { |
| 357 | 357 | $val = $this->parseValAsL10n($val); |
| 358 | 358 | |
| 359 | 359 | if ($val) { |
| 360 | - $val->sanitize([ $this, 'parseOne' ]); |
|
| 360 | + $val->sanitize([$this, 'parseOne']); |
|
| 361 | 361 | } |
| 362 | 362 | } else { |
| 363 | 363 | $val = $this->parseOne($val); |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | public function getLabel() |
| 479 | 479 | { |
| 480 | 480 | if ($this->label === null) { |
| 481 | - return ucwords(str_replace([ '.', '_' ], ' ', $this->ident())); |
|
| 481 | + return ucwords(str_replace(['.', '_'], ' ', $this->ident())); |
|
| 482 | 482 | } |
| 483 | 483 | |
| 484 | 484 | return $this->label; |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Charcoal\Property; |
| 4 | 4 | |
| 5 | -use PDO; |
|
| 6 | 5 | use ArrayAccess; |
| 7 | 6 | use RuntimeException; |
| 8 | 7 | use InvalidArgumentException; |
@@ -570,7 +570,7 @@ |
||
| 570 | 570 | $objs = (array)$this->structureVal($val); |
| 571 | 571 | $val = []; |
| 572 | 572 | if (!empty($objs)) { |
| 573 | - $val = []; |
|
| 573 | + $val = []; |
|
| 574 | 574 | foreach ($objs as $obj) { |
| 575 | 575 | $obj->saveProperties(); |
| 576 | 576 | $val[] = $obj->data(); |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use PDO; |
| 6 | 6 | use InvalidArgumentException; |
| 7 | -use UnexpectedValueException; |
|
| 8 | 7 | |
| 9 | 8 | // From 'charcoal-translator' |
| 10 | 9 | use Charcoal\Translator\Translation; |
@@ -277,7 +277,7 @@ |
||
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | /** |
| 280 | - * @return mixed |
|
| 280 | + * @return string |
|
| 281 | 281 | */ |
| 282 | 282 | public function defaultVal() |
| 283 | 283 | { |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Traversable; |
| 6 | 6 | use RuntimeException; |
| 7 | 7 | use InvalidArgumentException; |
| 8 | - |
|
| 9 | 8 | use PDO; |
| 10 | 9 | |
| 11 | 10 | // From PSR-6 |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | * |
| 62 | 62 | * @param array $propertyIdents Optional. List of property identifiers |
| 63 | 63 | * for retrieving a subset of property objects. |
| 64 | - * @return PropertyInterface[]|\Generator |
|
| 64 | + * @return \Generator |
|
| 65 | 65 | */ |
| 66 | 66 | public function properties(array $propertyIdents = null) |
| 67 | 67 | { |
@@ -271,7 +271,7 @@ |
||
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | /** |
| 274 | - * @return array |
|
| 274 | + * @return string[] |
|
| 275 | 275 | */ |
| 276 | 276 | public function validationMethods() |
| 277 | 277 | { |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | /** |
| 217 | 217 | * Set the MIME type. |
| 218 | 218 | * |
| 219 | - * @param mixed $type The file MIME type. |
|
| 219 | + * @param string|false $type The file MIME type. |
|
| 220 | 220 | * @throws InvalidArgumentException If the MIME type argument is not a string. |
| 221 | 221 | * @return FileProperty Chainable |
| 222 | 222 | */ |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | /** |
| 365 | - * @return array |
|
| 365 | + * @return string[] |
|
| 366 | 366 | */ |
| 367 | 367 | public function validationMethods() |
| 368 | 368 | { |
@@ -888,7 +888,7 @@ discard block |
||
| 888 | 888 | /** |
| 889 | 889 | * Generate a unique filename. |
| 890 | 890 | * |
| 891 | - * @param string|array $filename The filename to alter. |
|
| 891 | + * @param string $filename The filename to alter. |
|
| 892 | 892 | * @throws InvalidArgumentException If the given filename is invalid. |
| 893 | 893 | * @return string |
| 894 | 894 | */ |
@@ -1164,7 +1164,7 @@ discard block |
||
| 1164 | 1164 | * |
| 1165 | 1165 | * @param array $uploadedFiles The non-normalized tree of uploaded file data. |
| 1166 | 1166 | * @param callable $filterCallback If specified, the callback function to used to filter files. |
| 1167 | - * @param mixed $searchKey If specified, then only top-level keys containing these values are returned. |
|
| 1167 | + * @param string $searchKey If specified, then only top-level keys containing these values are returned. |
|
| 1168 | 1168 | * @return array A tree of normalized $_FILE entries. |
| 1169 | 1169 | */ |
| 1170 | 1170 | public static function parseUploadedFiles(array $uploadedFiles, callable $filterCallback = null, $searchKey = null) |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | UPLOAD_ERR_OK => 'There is no error, the file uploaded with success', |
| 31 | 31 | UPLOAD_ERR_INI_SIZE => 'The uploaded file exceeds the upload_max_filesize directive in php.ini', |
| 32 | 32 | UPLOAD_ERR_FORM_SIZE => 'The uploaded file exceeds the MAX_FILE_SIZE directive'. |
| 33 | - 'that was specified in the HTML form', |
|
| 33 | + 'that was specified in the HTML form', |
|
| 34 | 34 | UPLOAD_ERR_PARTIAL => 'The uploaded file was only partially uploaded', |
| 35 | 35 | UPLOAD_ERR_NO_FILE => 'No file was uploaded', |
| 36 | 36 | UPLOAD_ERR_NO_TMP_DIR => 'Missing a temporary folder', |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | { |
| 550 | 550 | // Bag value if singular |
| 551 | 551 | if (!is_array($values) || isset($values['id'])) { |
| 552 | - $values = [ $values ]; |
|
| 552 | + $values = [$values]; |
|
| 553 | 553 | } |
| 554 | 554 | |
| 555 | 555 | $parsed = []; |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | { |
| 578 | 578 | // Bag value if singular |
| 579 | 579 | if (isset($files['error'])) { |
| 580 | - $files = [ $files ]; |
|
| 580 | + $files = [$files]; |
|
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | $parsed = []; |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | |
| 607 | 607 | if ($this['multiple']) { |
| 608 | 608 | if (!is_array($values)) { |
| 609 | - $values = empty($values) && !is_numeric($values) ? [] : [ $values ]; |
|
| 609 | + $values = empty($values) && !is_numeric($values) ? [] : [$values]; |
|
| 610 | 610 | } |
| 611 | 611 | } else { |
| 612 | 612 | if (is_array($values)) { |
@@ -680,7 +680,7 @@ discard block |
||
| 680 | 680 | return null; |
| 681 | 681 | } |
| 682 | 682 | |
| 683 | - $basePath = $this->basePath(); |
|
| 683 | + $basePath = $this->basePath(); |
|
| 684 | 684 | $targetPath = str_replace($basePath, '', $targetPath); |
| 685 | 685 | |
| 686 | 686 | return $targetPath; |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | // @todo: Feedback |
| 774 | 774 | $this->logger->debug( |
| 775 | 775 | 'Path does not exist. Attempting to create path '.$uploadPath.'.', |
| 776 | - [ get_called_class().'::'.__FUNCTION__ ] |
|
| 776 | + [get_called_class().'::'.__FUNCTION__] |
|
| 777 | 777 | ); |
| 778 | 778 | mkdir($uploadPath, 0777, true); |
| 779 | 779 | } |
@@ -847,7 +847,7 @@ discard block |
||
| 847 | 847 | public function sanitizeFilename($filename) |
| 848 | 848 | { |
| 849 | 849 | // Remove blacklisted caharacters |
| 850 | - $blacklist = [ '/', '\\', '\0', '*', ':', '?', '"', '<', '>', '|', '#', '&', '!', '`', ' ' ]; |
|
| 850 | + $blacklist = ['/', '\\', '\0', '*', ':', '?', '"', '<', '>', '|', '#', '&', '!', '`', ' ']; |
|
| 851 | 851 | $filename = str_replace($blacklist, '_', $filename); |
| 852 | 852 | |
| 853 | 853 | // Avoid hidden file |
@@ -1181,7 +1181,7 @@ discard block |
||
| 1181 | 1181 | { |
| 1182 | 1182 | $propIdent = $this->ident(); |
| 1183 | 1183 | |
| 1184 | - $filterErrNoFile = function (array $file) { |
|
| 1184 | + $filterErrNoFile = function(array $file) { |
|
| 1185 | 1185 | return $file['error'] !== UPLOAD_ERR_NO_FILE; |
| 1186 | 1186 | }; |
| 1187 | 1187 | $uploadedFiles = static::parseUploadedFiles($_FILES, $filterErrNoFile, $propIdent); |