Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Add PHPStan #811

Merged
merged 1 commit into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 unit tests
run: composer test

- name: Run static analysis
run: composer phpstan -- --error-format=github

test-compiled:
runs-on: ubuntu-latest

Expand Down
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.19 || ^3.8",
"mf2/mf2": "^0.5.0",
"phpstan/phpstan": "^1.10",
"psr/simple-cache": "^1 || ^2 || ^3",
"yoast/phpunit-polyfills": "^1.0.1"
},
Expand Down Expand Up @@ -63,6 +64,7 @@
"scripts": {
"cs": "php-cs-fixer fix --verbose --dry-run --diff",
"fix": "php-cs-fixer fix --verbose --diff",
"phpstan": "phpstan analyze --memory-limit 512M",
"test": "phpunit"
}
}
20 changes: 20 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
parameters:
level: 2

paths:
- library/
- src/
- tests/

ignoreErrors:
# Not used since https://github.com/simplepie/simplepie/commit/b2eb0134d53921e75f0fa70b1cf901ed82b988b1 but cannot be removed due to BC.
- '(Constructor of class SimplePie\\Enclosure has an unused parameter \$javascript\.)'

# Testing legacy dynamic property usage.
- '(Access to an undefined property SimplePie.IRI::\$nonexistant_prop\.)'

# PHPStan stubs bug https://github.com/phpstan/phpstan/issues/8629
-
message: '(^Access to an undefined property XMLReader::\$\w+\.$)'
# Only occurs on PHP ≥ 8.2
reportUnmatched: false