jdecool/phpstan-report
最新稳定版本:0.13.0
Composer 安装命令:
composer create-project jdecool/phpstan-report
包简介
Enhance PHPStan analysis by providing report analysis
README 文档
README
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 ishttp)--report-http-add-header: Add a header to the HTTP request (available only if output format ishttp)--report-gitlab-severity-mapping: JSON string mapping error identifiers to GitLab severity levels (available only if output format isgitlab)
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
--refresh-cache: Refresh PHPStan cache by running a new analysis before viewing errors
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
Generate a GitLab report with custom severity mapping:
php vendor/bin/phpstan-report analyze --report-output-format=gitlab \
--report-gitlab-severity-mapping='{"missingType.property":"info","argument.type":"critical"}' src
For more details on GitLab severity mapping, see docs/gitlab-severity-mapping.md.
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"
统计信息
- 总下载量: 26.64k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-21