Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/backendtea/phpstan-multiple-error-formatter
https://github.com/backendtea/phpstan-multiple-error-formatter
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/backendtea/phpstan-multiple-error-formatter
- Owner: BackEndTea
- Created: 2024-11-27T08:43:00.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-27T09:24:27.000Z (about 2 months ago)
- Last Synced: 2024-11-27T09:31:19.655Z (about 2 months ago)
- Language: PHP
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Multiple error formatters for PHPStan
This project was born form a need to have multiple outputs from a PHPStan run. Its goal is to provide a way to direct outputs to multiple locations, without having to run PHPStan multiple times.
## Installation
```bash
composer require --dev backendtea/phpstan-multiple-error-formatter
```If you also install [phpstan/extension-installer](https://github.com/phpstan/extension-installer) then you're all set!
Manual installation
If you don't want to use `phpstan/extension-installer`, include extension.neon in your project's PHPStan config:
```
includes:
- vendor/backendtea/phpstan-multiple-error-formatter/config.neon
```## Usage
This package provides the 'multiple' error formatter. Generally you want to use this in CI by adding the `--error-format multiple` flag.
The `multiple` error formatter wil look for the `errorFormatters.formatters` configuration option, where you can define the outputs you are looking for
This package defines the following formatters to output to a file:
* jsonFile : prints a json file
* prettyJsonFile: prints a pretty json file (with whitespaces for human readability)
* gitlabFile: outputs a file for gitlab code quality inspectionsYou can configure the file location it should output to with the `errorFormatters.jsonFile` and `errorFromatters.gitlabFile` configuration options:
An example where we want to write a pretty json file, a gitlab file, and output to a table in stdOut would look like this:
```yaml
parameters:
errorFormatters:
formatters:
- table
- gitlabFile
- prettyJsonFile
jsonFile: %currentWorkingDirectory%/phpstan.json
gitlabFile: %currentWorkingDirectory%/phpstan-gitlab.json
# other config...
```