jdecool/phpstan-report

Enhance PHPStan analysis by providing report analysis

Installs: 16 650

Dependents: 0

Suggesters: 0

Security: 0

Stars: 7

Watchers: 1

Forks: 0

Open Issues: 1

Type:project

0.12.0 2025-07-08 19:46 UTC

README

Build Status License Latest Stable Version Latest Unstable Version

A simple wrapper around PHPStan to extends PHPStan's functionality by providing a customizable report generation feature. It allows you to run PHPStan analysis and generate reports on ignored errors in various formats.

Installation

You can install the package via composer:

composer require --dev jdecool/phpstan-report

Usage

This package provides two main commands:

Analyze Command

The analyze command runs PHPStan analysis and generates reports on ignored errors:

php vendor/bin/phpstan-report analyze

Options

  • --report-output-format: Specify the output format for the report
  • --report-without-analyze: Generate a report without running the PHPStan analysis
  • --report-continue-on-error: Continue report generation even if the analysis fails
  • --report-maximum-allowed-errors: Set the maximum number of allowed errors
  • --report-sort-by: Sort the report results (options: identifier, occurrence)
  • --report-exclude-identifier: Identifier to exclude from the report (accepts multiple values)
  • --report-file-<format>: Export report in an output file for a particular format
  • --report-http-target-url: The target URL to send the report to (available only if output format is http)
  • --report-http-add-header: Add a header to the HTTP request (available only if output format is http)

Available formats are: text, html, http, json, gitlab and heatmap.

For a full list of options, run:

php vendor/bin/phpstan-report analyze --help

View Command

The view command displays detailed information about specific ignored errors from the PHPStan result cache:

php vendor/bin/phpstan-report view <identifier> [<identifier>...]

This command allows you to examine specific error identifiers without running a new analysis.

Options

The view command takes error identifiers as arguments and displays detailed information about those errors in a table format showing:

  • Error identifier
  • Error message
  • File path
  • Line number

For help with the view command, run:

php vendor/bin/phpstan-report view --help

Examples

Run analysis and generate a text report:

php vendor/bin/phpstan-report analyze src tests

Generate an HTML report without running analysis:

php vendor/bin/phpstan-report analyze --report-without-analyze --report-output-format=html

Run analysis, continue on error, and save report to a file:

php vendor/bin/phpstan-report analyze --report-continue-on-error --report-file-json=report.json src

Generate a heatmap report of files with most ignored errors:

php vendor/bin/phpstan-report analyze --report-file-heatmap=heatmap.svg src

View Command Examples

View details about a specific error identifier:

php vendor/bin/phpstan-report view "missingType.iterableValue"

View details about multiple error identifiers:

php vendor/bin/phpstan-report view "missingType.iterableValue" "nullCoalesce.expr"