PHPStan finds bugs in your code without writing tests by using running static analysis on your project's code. This fork of the official phpstan action uses the WordPress extension for PHPStan by Viktor Szépe.
This package was forked from the original phpstan action.
Create your GitHub Workflow configuration in .github/workflows/ci.yml or similar.
name: CI
on: [push]
jobs:
build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ramsey/composer-install@v2 # or alternative dependency management
- uses: dingo-d/phpstan-wp-action@v2
# ... then your own project steps ...By default, adding - uses: dingo-d/phpstan-wp-action@v2 into your workflow will run phpstan analyse, as analyse is the default command name.
You can issue custom commands by passing a command input, like so:
jobs:
phpstan:
...
- name: PHPStan
uses: dingo-d/phpstan-wp-action@v2
with:
command: your-command-hereThe following configuration options are available:
configurationPath to the project configuration filelevelLevel of rule options - the higher the stricterpaths_filePath to a file with a list of paths to run analysis onautoload_fileProject's additional autoload file patherror_formatFormat in which to print the result of the analysisgenerate_baselinePath to a file where the baseline should be savedmemory_limitMemory limit for analysis
The syntax for passing in a custom input is the following:
...
jobs:
phpstan:
...
- name: PHPStan Static Analysis
uses: dingo-d/phpstan-wp-action@v2
with:
configuration: custom/path/to/phpstan.neon
memory_limit: 256M