Problem matchers are JSON configuration files that tell GitHub Actions how to parse tool output and surface errors and warnings as inline annotations directly in pull requests and workflow run logs. They map log patterns to file paths and line numbers so reviewers can see issues without leaving the diff.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/shivammathur/setup-php/llms.txt
Use this file to discover all available pages before exploring further.
setup-php ships problem matcher files for PHP and PHPUnit inside the runner’s tool cache. Additional tools like PHPStan and Psalm have native GitHub Actions output formats that work without a separate matcher file.
PHP
The PHP problem matcher catches fatal errors, parse errors, and warnings in PHP output and links them to the corresponding source file and line. Add this step immediately after thesetup-php step:
PHPUnit
The PHPUnit problem matcher highlights failing test cases in the workflow run log and annotates the test file at the failing assertion’s line number. Add this step after thesetup-php step, before you run your tests:
PHPStan
PHPStan has native GitHub Actions support built in. When it detects that it is running inside GitHub Actions it automatically emits annotations without requiring a problem matcher. No additional configuration is needed.Psalm
Psalm supports GitHub Actions output via the--output-format=github flag. This emits annotations for every issue Psalm finds.
Tools with checkstyle support
Several PHP tools can emit results in the checkstyle XML format:phpcs, phpstan, psalm, and php-cs-fixer. You can pipe that output into cs2pr, which converts checkstyle XML into GitHub Actions annotations.
Install cs2pr via the tools input and pipe checkstyle output to it:
phpcs with cs2pr
phpcs with cs2pr
php-cs-fixer with cs2pr
php-cs-fixer with cs2pr
phpstan with cs2pr
phpstan with cs2pr
psalm with cs2pr
psalm with cs2pr
cs2pr exits with a non-zero status code when it finds issues, which causes the workflow step to fail as expected. Refer to the cs2pr documentation for additional options such as filtering by severity or graceful-warnings mode.