|
1 |
| -# PHPStan FileOutput |
2 |
| -An error formatter for [Easy Coding Standard](https://github.com/phpstan/phpstan) that exports analysis result into HTML file |
| 1 | +# Easy Coding Standard FileOutput |
| 2 | +An error formatter for [Easy Coding Standard](https://github.com/Symplify/EasyCodingStandard) that exports analysis result into HTML file |
3 | 3 |
|
4 | 4 | ## Installation
|
5 | 5 | ```
|
6 |
| -composer require noximo/phpstan-fileoutput |
| 6 | +composer require noximo/easycodingstandard-fileoutput |
7 | 7 | ```
|
8 | 8 |
|
9 |
| -## Usage |
10 |
| -Edit or create your phpstan.neon file and register new error formatter. |
11 |
| -First two parameters are mandatory. |
| 9 | +## Setup |
| 10 | +Edit or create your ecs.ym file and register new output formatter. |
| 11 | + |
| 12 | +- $outputFile - path to file where analysis will be outputted (required) |
12 | 13 |
|
13 |
| -- First specifies path to file in which data will be outputed. |
| 14 | +- $defaultFormatter - specifies which other formatter will be used with FileOutput formatter running silently in the background. You can leave it unsetted if you wish to only work with FileOutput-generated files. (optional) |
14 | 15 |
|
15 |
| -- Second specifies which other formatter will be used with FileOutput formatter running silently in the background. You can set it to null if you wish to only work with FileOutput-generated files. |
| 16 | +- $customTemplate - this argument sets custom output template. See [table.phtml](/src/table.phtml) for implementation details and data structure. (optional) |
16 | 17 | ```
|
17 | 18 | services:
|
18 |
| - errorFormatter.fileoutput: # Can be any name after errorFormatter |
19 |
| - class: noximo\FileOutput(./example/phpstan.html, null) |
| 19 | + noximo\EasyCodingStandardFileoutput\FileOutputFormatter: |
| 20 | + autowire: true |
| 21 | + arguments: |
| 22 | + $outputFile: './log/test.html' |
| 23 | + $defaultFormatter: '@Symplify\EasyCodingStandard\Console\Output\TableOutputFormatter' |
| 24 | + $customTemplate: './tests/alternative_table.phtml' |
20 | 25 | ```
|
21 | 26 |
|
22 |
| -You can (and should) specify second parameter to use one of the other formatters as well, so console output will be unaffected: |
23 |
| -``` |
24 |
| -class: noximo\FileOutput(./example/phpstan.html, @errorFormatter.raw) |
25 |
| -``` |
26 |
| -At the time of writing of this readme these formatters were available by default in PHPStan: |
27 |
| -- ```errorFormatter.checkstyle```, |
28 |
| -- ```errorFormatter.json```, |
29 |
| -- ```errorFormatter.prettyJson```, |
30 |
| -- ```errorFormatter.raw```, |
31 |
| -- ```errorFormatter.table``` |
| 27 | +At the time of writing of this readme these formatters were available by default in ecs: |
| 28 | +- ```@Symplify\EasyCodingStandard\Console\Output\TableOutputFormatter```, |
| 29 | +- ```@Symplify\EasyCodingStandard\Console\Output\JsonOutputFormatter``` |
32 | 30 |
|
33 |
| -_Check [PHPStan repository](https://github.com/phpstan/phpstan) for possible updates._ |
| 31 | +_Check [Easy Coding Standard repository](https://github.com/Symplify/EasyCodingStandard) for possible updates._ |
| 32 | + |
| 33 | +## Usage |
| 34 | + |
| 35 | +simply change --output-format argument to *file*: |
34 | 36 |
|
35 |
| -Third parameter sets custom output template. |
36 | 37 | ```
|
37 |
| -class: noximo\FileOutput(./example/phpstan.html, null, ./tests/alternative_table.phtml) |
| 38 | +vendor\bin\ecs check someDir --output-format=file |
38 | 39 | ```
|
39 |
| -See [table.phtml](/src/table.phtml) for implementation details and data structure. |
| 40 | + |
40 | 41 |
|
41 | 42 | ## Output
|
42 |
| -FileOutputer will generate HTML file (assuming default template) with hyperlinks directly into PHP files where errors were encountered. If you want to leverage clickable links, set up your enviromenent according to this article: [https://tracy.nette.org/en/open-files-in-ide](https://tracy.nette.org/en/open-files-in-ide) |
| 43 | +FileOutput will generate HTML file (assuming default template) with hyperlinks directly into PHP files where errors were encountered. If you want to leverage clickable links, set up your enviromenent according to this article: [https://tracy.nette.org/en/open-files-in-ide](https://tracy.nette.org/en/open-files-in-ide) |
43 | 44 |
|
44 |
| -Note: When you fix an error, file structure and line numbers can no longer correspond to line number at the time of analysis. You'll need to re-run PHPStan to regenerate output file. Errors are outputed in descending order (line-number wise) so there's bigger chance that you won't lines out of their current positions. |
| 45 | +Note: When you fix an error, file structure and line numbers can no longer correspond to line number at the time of analysis. You'll need to re-run ecs to regenerate output file. Errors are outputed in descending order (line-number wise) so there's bigger chance that you won't lines out of their current positions. |
0 commit comments