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-here
The following configuration options are available:
configuration
Path to the project configuration filelevel
Level of rule options - the higher the stricterpaths_file
Path to a file with a list of paths to run analysis onautoload_file
Project's additional autoload file patherror_format
Format in which to print the result of the analysisgenerate_baseline
Path to a file where the baseline should be savedmemory_limit
Memory 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