Skip to content

Commit

Permalink
Merge pull request #700 from jdreesen/update-phpstan
Browse files Browse the repository at this point in the history
Upgrade PHPStan to v0.12
  • Loading branch information
mnapoli committed Dec 15, 2019
2 parents e7507cd + 502f2e4 commit 969aebe
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -34,7 +34,7 @@ before_script:
script:
- if [[ $(phpenv version-name) == '7.2' ]]; then vendor/bin/phpunit --coverage-clover clover.xml ; fi
- if [[ $(phpenv version-name) != '7.2' ]]; then vendor/bin/phpunit ; fi
- if [[ $(phpenv version-name) == '7.2' ]]; then vendor/bin/phpstan analyse -l 6 -c phpstan.neon src ; fi
- if [[ $(phpenv version-name) == '7.3' ]]; then vendor/bin/phpstan analyse -l 5 -c phpstan.neon src ; fi

after_script:
- if [[ $(phpenv version-name) == '7.2' ]]; then php vendor/bin/coveralls -v ; fi
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -22,7 +22,7 @@
"scripts": {
"test": "phpunit",
"format-code": "php-cs-fixer fix --allow-risky=yes",
"phpstan": "phpstan analyse -l 6 -c phpstan.neon src"
"phpstan": "phpstan analyse -l 5 -c phpstan.neon src"
},
"require": {
"php": ">=7.2.0",
Expand All @@ -38,7 +38,7 @@
"doctrine/annotations": "~1.2",
"ocramius/proxy-manager": "~2.0.2",
"friendsofphp/php-cs-fixer": "^2.4",
"phpstan/phpstan": "^0.9.2"
"phpstan/phpstan": "^0.12"
},
"provide": {
"psr/container-implementation": "^1.0"
Expand Down
62 changes: 62 additions & 0 deletions phpstan-baseline.neon
@@ -0,0 +1,62 @@
parameters:
ignoreErrors:
-
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
count: 1
path: src\CompiledContainer.php

-
message: "#^Negated boolean expression is always false\\.$#"
count: 1
path: src\CompiledContainer.php

-
message: "#^Negated boolean expression is always false\\.$#"
count: 2
path: src\Compiler\Compiler.php

-
message: "#^If condition is always false\\.$#"
count: 1
path: src\Compiler\Compiler.php

-
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
count: 2
path: src\Container.php

-
message: "#^Negated boolean expression is always false\\.$#"
count: 1
path: src\Container.php

-
message: "#^Result of && is always false\\.$#"
count: 1
path: src\ContainerBuilder.php

-
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
count: 1
path: src\ContainerBuilder.php

-
message: "#^Negated boolean expression is always false\\.$#"
count: 1
path: src\Definition\ArrayDefinitionExtension.php

-
message: "#^Parameter \\#1 \\$definition \\(DI\\\\Definition\\\\InstanceDefinition\\) of method DI\\\\Definition\\\\Resolver\\\\InstanceInjector\\:\\:resolve\\(\\) should be compatible with parameter \\$definition \\(DI\\\\Definition\\\\ObjectDefinition\\) of method DI\\\\Definition\\\\Resolver\\\\ObjectCreator\\:\\:resolve\\(\\)$#"
count: 1
path: src\Definition\Resolver\InstanceInjector.php

-
message: "#^Instanceof between DI\\\\Definition\\\\Definition and DI\\\\Definition\\\\AutowireDefinition will always evaluate to false\\.$#"
count: 1
path: src\Definition\Source\SourceCache.php

-
message: "#^Parameter \\#1 \\$autoload_function of function spl_autoload_register expects callable\\(string\\)\\: void, ProxyManager\\\\Autoloader\\\\AutoloaderInterface given\\.$#"
count: 1
path: src\Proxy\ProxyFactory.php

6 changes: 5 additions & 1 deletion phpstan.neon
@@ -1,7 +1,11 @@
includes:
- phpstan-baseline.neon

parameters:
excludes_analyse:
- %rootDir%/../../../src/Compiler/Template.php
- src/Compiler/Template.php
ignoreErrors:
- '#Access to undefined constant DI\\CompiledContainer::METHOD_MAPPING.#'
- '#Function apcu_.* not found.#'
reportUnmatchedIgnoredErrors: false
inferPrivatePropertyTypeFromConstructor: true

0 comments on commit 969aebe

Please sign in to comment.