Skip to content

Commit 6af91cd

Browse files
committed
init
1 parent 9594f11 commit 6af91cd

11 files changed

+3533
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/.idea/*
2+
/vendor/*

README.md

+29
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,31 @@
11
# PHPStan FileOutput
22
An error formatter for PHPStan that exports analysis result into HTML file
3+
4+
## Installation
5+
```
6+
composer require noximo/phpstan-fileoutput
7+
```
8+
9+
## Usage
10+
Edit or create your phpstan.neon file and register new error formatter.
11+
First parameter is mandatory and specifies path to file in which data will be outputed.
12+
```
13+
services:
14+
errorFormatter.fileoutput: # Can be any name after errorFormatter
15+
class: noximo\FileOutput(./example/phpstan.html)
16+
```
17+
18+
You can add second parameter to use one of the other formatters as well, so console output can be unaffected:
19+
```
20+
class: noximo\FileOutput(./example/phpstan.html, @errorFormatter.raw)
21+
```
22+
Third parameter sets custom output template.
23+
```
24+
class: noximo\FileOutput(./example/phpstan.html, null, ./tests/alternative_table.phtml)
25+
```
26+
See [table.phtml](/src/table.phtml) for implementation details and data structure.
27+
28+
## Output
29+
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)
30+
31+
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.

composer.json

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"name": "noximo/phpstan-fileoutput",
3+
"description": "An error formatter for PHPStan that exports analysis result into HTML file",
4+
"keywords": [
5+
"PHPStan",
6+
"Error formatter",
7+
"File output"
8+
],
9+
"type": "library",
10+
"authors": [
11+
{
12+
"name": "Tomas Pospisil",
13+
"email": "[email protected]"
14+
}
15+
],
16+
"autoload": {
17+
"psr-4": {
18+
"noximo\\": [
19+
"src/",
20+
"tests/"
21+
]
22+
}
23+
},
24+
"require": {
25+
"php": "^7.1",
26+
"phpstan/phpstan": "^0.10"
27+
},
28+
"license": "MIT",
29+
"require-dev": {
30+
"symplify/easy-coding-standard": "^5.1"
31+
},
32+
"scripts": {
33+
"check": [
34+
"@check-cs",
35+
"@phpstan"
36+
],
37+
"check-cs": "ecs check src",
38+
"fix-cs": "ecs check src --fix",
39+
"phpstan": "phpstan analyse src --level max --error-format=fileoutput",
40+
"phpstan-test": "phpstan analyse src tests --level max --error-format=fileoutput --no-progress"
41+
}
42+
}

0 commit comments

Comments
 (0)