Skip to content

Commit

Permalink
Apply stricter PHPStan rules
Browse files Browse the repository at this point in the history
  • Loading branch information
sanmai committed Mar 3, 2020
1 parent dd6627f commit a87d2d8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .phpstan.neon
@@ -1,3 +1,7 @@
parameters:
excludes_analyse:
- %currentWorkingDirectory%/tests/ErrorsTest.php
level: 4
paths:
- src
- tests
10 changes: 10 additions & 0 deletions .phpstan.src.neon
@@ -0,0 +1,10 @@
parameters:
checkGenericClassInNonGenericObjectType: false
inferPrivatePropertyTypeFromConstructor: true
checkMissingIterableValueType: false
level: max
paths:
- src
ignoreErrors:
- '#Strict comparison .* between array\(\) and iterable .* false#'
- '#should return \$this.* but returns Pipeline.Standard#'
9 changes: 6 additions & 3 deletions Makefile
Expand Up @@ -29,7 +29,8 @@ export PHAN_DISABLE_XDEBUG_WARN=1

# PHPStan
PHPSTAN=vendor/bin/phpstan
PHPSTAN_ARGS=analyse src tests --level=2 -c .phpstan.neon
PHPSTAN_ARGS_TESTS=analyse src tests --level=2 -c .phpstan.neon
PHPSTAN_ARGS_SRC=analyse -c .phpstan.src.neon

# Psalm
PSALM=vendor/bin/psalm
Expand Down Expand Up @@ -68,7 +69,8 @@ ci-phan: ci-cs
$(SILENT) $(PHP) $(PHAN) $(PHAN_ARGS)

ci-phpstan: ci-cs .phpstan.neon
$(SILENT) $(PHP) $(PHPSTAN) $(PHPSTAN_ARGS) --no-progress
$(SILENT) $(PHP) $(PHPSTAN) $(PHPSTAN_ARGS_SRC) --no-progress
$(SILENT) $(PHP) $(PHPSTAN) $(PHPSTAN_ARGS_TESTS) --no-progress

ci-psalm: ci-cs psalm.xml
$(SILENT) $(PHP) $(PSALM) $(PSALM_ARGS) --no-cache --shepherd
Expand All @@ -95,7 +97,8 @@ phpunit: cs

analyze: cs .phpstan.neon psalm.xml
$(SILENT) $(PHP) $(PHAN) $(PHAN_ARGS) --color
$(SILENT) $(PHP) $(PHPSTAN) $(PHPSTAN_ARGS)
$(SILENT) $(PHP) $(PHPSTAN) $(PHPSTAN_ARGS_SRC)
$(SILENT) $(PHP) $(PHPSTAN) $(PHPSTAN_ARGS_TESTS)
$(SILENT) $(PHP) $(PSALM) $(PSALM_ARGS)

cs: test-prerequisites
Expand Down

0 comments on commit a87d2d8

Please sign in to comment.