Browse Source

DX: update PHPStan

Kuba Werłos 3 years ago
parent
commit
c613bcf0d6
3 changed files with 8 additions and 20 deletions
  1. 2 2
      dev-tools/composer.json
  2. 6 14
      phpstan.neon
  3. 0 4
      src/Fixer/Whitespace/ArrayIndentationFixer.php

+ 2 - 2
dev-tools/composer.json

@@ -9,8 +9,8 @@
         "maglnet/composer-require-checker": "2.0.0",
         "mi-schi/phpmd-extension": "^4.3",
         "phpmd/phpmd": "^2.10",
-        "phpstan/phpstan": "0.12.25",
-        "phpstan/phpstan-phpunit": "0.12.11"
+        "phpstan/phpstan": "^0.12.90",
+        "phpstan/phpstan-phpunit": "^0.12.20"
     },
     "config": {
         "optimize-autoloader": true,

+ 6 - 14
phpstan.neon

@@ -8,19 +8,15 @@ parameters:
     paths:
         - src
         - tests
-    excludes_analyse:
+    excludePaths:
+        - src/Event/Event.php # @TODO remove in PHP CS Fixer 3.0
+        - tests/Event/EventTest.php # @TODO remove in PHP CS Fixer 3.0
         - tests/Fixtures
     ignoreErrors:
         - '/^Return typehint of method PhpCsFixer\\Tests\\Test\\.+::createIsIdenticalStringConstraint\(\) has invalid type PHPUnit_Framework_Constraint_IsIdentical\.$/'
-        - '/^Class (Symfony\\Contracts\\EventDispatcher\\Event|Symfony\\Component\\EventDispatcher\\Event) not found.$/'
-        - '/^Constant T_NAME_(RELATIVE|FULLY_QUALIFIED|QUALIFIED) not found\.$/'
-        - '/assertInstanceOf\(\) expects class-string.*, string given/'
         -
             message: '/^Unsafe usage of new static\(\)\.$/'
             path: src/Config.php
-        -
-            message: '/^Else branch is unreachable because previous condition is always true\.$/'
-            path: src/Event/Event.php
         -
             message: '/^Result of && is always false\.$/'
             path: src/Config.php
@@ -29,13 +25,9 @@ parameters:
             path: src/Config.php
         -
             message: '/^Else branch is unreachable because ternary operator condition is always true\.$/'
-            paths:
-                - src/Config.php
-        -
-            message: '/^Parameter #1 \$function of function register_shutdown_function expects callable\(\): void, array\(\$this\(PhpCsFixer\\FileRemoval\), ''clean''\) given\.$/'
-            path: src/FileRemoval.php
+            path: src/Config.php
         -
-            message: '/^Constant T_ATTRIBUTE not found\.$/'
-            path: src/Tokenizer/Transformer/AttributeTransformer.php
+            message: '/^Dead catch - LogicException is never thrown in the try block\.$/'
+            path: src/Test/AccessibleObject.php
 
     tipsOfTheDay: false

+ 0 - 4
src/Fixer/Whitespace/ArrayIndentationFixer.php

@@ -238,10 +238,6 @@ final class ArrayIndentationFixer extends AbstractFixer implements WhitespacesAw
             if ($this->isNewLineToken($tokens, $index)) {
                 return $this->returnWithUpdateCache($startIndex, $index);
             }
-
-            if ($this->isNewLineToken($tokens, $index)) {
-                return $this->returnWithUpdateCache($startIndex, $index);
-            }
         }
 
         return $this->returnWithUpdateCache($startIndex, null);