Browse Source

Fix errors reported by phpstan.

ADmad 6 years ago
parent
commit
8fa12e53da
2 changed files with 10 additions and 8 deletions
  1. 7 1
      phpstan.neon
  2. 3 7
      src/Command/I18nExtractCommand.php

+ 7 - 1
phpstan.neon

@@ -58,8 +58,14 @@ parameters:
             message: '#Call to an undefined method Cake\\ORM\\Association::junction\(\).#'
             path: 'src/View/Form/EntityContext.php'
         -
+            message: '#Parameter \#1 \$var_array of function extract is passed by reference, so it expects variables only#'
+            path: 'src/Command/I18nExtractCommand.php'
+        -
+            message: '#Strict comparison using !== between null and null will always evaluate to false#'
+            path: 'src/Command/I18nExtractCommand.php'
+        -
             message: '#Result of || is always true#'
-            path: 'src/Shell/Task/ExtractTask.php'
+            path: 'src/Command/I18nExtractCommand.php'
         -
             message: '#Result of || is always true#'
             path: 'src/Utility/Hash.php'

+ 3 - 7
src/Command/I18nExtractCommand.php

@@ -220,7 +220,7 @@ class I18nExtractCommand extends Command
                 if (strtoupper($response) === 'Q') {
                     $io->err('Extract Aborted');
 
-                    return static::CODE_ERR0R;
+                    return static::CODE_ERROR;
                 }
                 if ($this->_isPathUsable($response)) {
                     $this->_output = $response . DIRECTORY_SEPARATOR;
@@ -484,12 +484,8 @@ class I18nExtractCommand extends Command
                 $strings = $this->_getStrings($position, $mapCount);
 
                 if ($mapCount === count($strings)) {
-                    $singular = $plural = $context = null;
-                    /**
-                     * @var string $singular
-                     * @var string|null $plural
-                     * @var string|null $context
-                     */
+                    $singular = '';
+                    $plural = $context = null;
                     extract(array_combine($map, $strings));
                     $domain = $domain ?? 'default';
                     $details = [