Skip to content

Commit

Permalink
Merge pull request #3 from pixeloven/adding-php-stan
Browse files Browse the repository at this point in the history
Adding php stan
  • Loading branch information
ductiletoaster authored Sep 24, 2021
2 parents a68f931 + 57abb76 commit 90baedf
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 10 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ We utilizes PHPCodesniffer for all liniting needs.
docker-compose run php-7.4 composer lint
```

#### Static Analysis
We utilizes PHPStan for all static analysis needs.
```
docker-compose run php-7.4 composer stan
```
Currently our configuration is set to level 5 with one ignored error in our baseline. Our goal will be to maintain a strict baseline with as few ignored errors as possible. As our source catches up with PHP 7.4+ features we will tighted our level to address our increasing complexity.

#### Formatting
We utilizes PHPFixer for all formatting needs. This cmd will write changes to disk.
```
Expand Down
3 changes: 3 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ steps:
- script: composer format:dry-run
displayName: 'Format dry run'

- script: composer stan
displayName: 'Static Analysis'

- script: composer test
displayName: 'Test'
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"friendsofphp/php-cs-fixer": "^2.18",
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.6.0",
"phpcompatibility/php-compatibility": "^9.3.5"
"phpcompatibility/php-compatibility": "^9.3.5",
"phpstan/phpstan": "^0.12.99"
},
"autoload": {
"psr-4": {
Expand All @@ -43,6 +44,8 @@
"format:dry-run": "vendor/bin/php-cs-fixer fix --config=\"phpcs.php\" --allow-risky=\"yes\" --verbose --dry-run",
"lint": "vendor/bin/phpcs --standard=phpcs.xml",
"lint:fix": "vendor/bin/phpcbf --standard=phpcs.xml",
"stan": "vendor/bin/phpstan --memory-limit=8g analyse -c phpstan.neon",
"stan:generate-baseline": "vendor/bin/phpstan --memory-limit=8g analyse -c phpstan.neon --generate-baseline",
"test": "vendor/bin/phpunit"
}
}
83 changes: 74 additions & 9 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
parameters:
ignoreErrors:
-
message: "#^Call to function is_null\\(\\) with string will always evaluate to false\\.$#"
count: 1
path: src/PixelOven/Http/Model.php

8 changes: 8 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
includes:
- phpstan-baseline.neon

parameters:
level: 5
paths:
- src
- tests

0 comments on commit 90baedf

Please sign in to comment.