Skip to content

Commit

Permalink
Reintroduce static analysis using PHPStan
Browse files Browse the repository at this point in the history
  • Loading branch information
christeredvartsen committed Jan 6, 2025
1 parent 75adae5 commit 6cf48fd
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ After this has been started you can execute the test suites by running:
./vendor/bin/behat --strict
./vendor/bin/phpunit

[PHPStan](https://phpstan.org/) is used for static code analysis:

vendor/bin/phpstan

## Documentation

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:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ jobs:
- name: Run integration tests
run: vendor/bin/behat --strict

- name: Run static code analysis
run: vendor/bin/phpstan

- name: Check coding standard
run: php-cs-fixer fix --dry-run --diff
env:
Expand Down
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
},
"require-dev": {
"imbo/imbo-coding-standard": "^2.0",
"phpstan/phpstan": "^2.1",
"phpunit/phpunit": "^11.5",
"slim/psr7": "^1.3",
"slim/slim": "^4.7",
Expand All @@ -48,6 +49,7 @@
"ci": [
"@phpunit",
"@behat",
"@sa",
"@cs"
],
"test": [
Expand All @@ -57,6 +59,7 @@
"phpunit": "vendor/bin/phpunit",
"phpunit:coverage": "vendor/bin/phpunit --coverage-html build/coverage",
"behat": "vendor/bin/behat --strict",
"sa": "vendor/bin/phpstan",
"cs": "php-cs-fixer fix --dry-run --diff",
"dev": "php -S localhost:8080 -t ./features/bootstrap > server.log 2>&1",
"docs": "cd docs; make html"
Expand Down
60 changes: 59 additions & 1 deletion composer.lock

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

2 changes: 1 addition & 1 deletion tests/ArrayContainsComparator/Matcher/ArrayLengthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static function getArraysAndLengths(): array
}

/**
* @return array<array{array:array<int>,maxLength:int,message:string}>
* @return array<array{list:array<int>,maxLength:int,message:string}>
*/
public static function getValuesThatFail(): array
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Context/ApiContextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static function getHttpMethods(): array
}

/**
* @return array<array{code:int,others:array<int>}>
* @return array<array{code:int}>
*/
public static function getResponseCodes(): array
{
Expand Down

0 comments on commit 6cf48fd

Please sign in to comment.