Skip to content

Commit 6cf48fd

Browse files
Reintroduce static analysis using PHPStan
1 parent 75adae5 commit 6cf48fd

File tree

6 files changed

+71
-3
lines changed

6 files changed

+71
-3
lines changed

.github/CONTRIBUTING.md

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ After this has been started you can execute the test suites by running:
1515
./vendor/bin/behat --strict
1616
./vendor/bin/phpunit
1717

18+
[PHPStan](https://phpstan.org/) is used for static code analysis:
19+
20+
vendor/bin/phpstan
21+
1822
## Documentation
1923

2024
The extension uses [Sphinx](http://www.sphinx-doc.org/en/stable/) for documentation, and all end-user documentation resides in the `docs` directory. To generate the current documentation after checking out your fork simply run the `docs` composer script:

.github/workflows/ci.yml

+3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ jobs:
5050
- name: Run integration tests
5151
run: vendor/bin/behat --strict
5252

53+
- name: Run static code analysis
54+
run: vendor/bin/phpstan
55+
5356
- name: Check coding standard
5457
run: php-cs-fixer fix --dry-run --diff
5558
env:

composer.json

+3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
},
2929
"require-dev": {
3030
"imbo/imbo-coding-standard": "^2.0",
31+
"phpstan/phpstan": "^2.1",
3132
"phpunit/phpunit": "^11.5",
3233
"slim/psr7": "^1.3",
3334
"slim/slim": "^4.7",
@@ -48,6 +49,7 @@
4849
"ci": [
4950
"@phpunit",
5051
"@behat",
52+
"@sa",
5153
"@cs"
5254
],
5355
"test": [
@@ -57,6 +59,7 @@
5759
"phpunit": "vendor/bin/phpunit",
5860
"phpunit:coverage": "vendor/bin/phpunit --coverage-html build/coverage",
5961
"behat": "vendor/bin/behat --strict",
62+
"sa": "vendor/bin/phpstan",
6063
"cs": "php-cs-fixer fix --dry-run --diff",
6164
"dev": "php -S localhost:8080 -t ./features/bootstrap > server.log 2>&1",
6265
"docs": "cd docs; make html"

composer.lock

+59-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/ArrayContainsComparator/Matcher/ArrayLengthTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static function getArraysAndLengths(): array
3838
}
3939

4040
/**
41-
* @return array<array{array:array<int>,maxLength:int,message:string}>
41+
* @return array<array{list:array<int>,maxLength:int,message:string}>
4242
*/
4343
public static function getValuesThatFail(): array
4444
{

tests/Context/ApiContextTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public static function getHttpMethods(): array
9292
}
9393

9494
/**
95-
* @return array<array{code:int,others:array<int>}>
95+
* @return array<array{code:int}>
9696
*/
9797
public static function getResponseCodes(): array
9898
{

0 commit comments

Comments
 (0)