Skip to content

Commit 25f0f00

Browse files
committed
first commit
0 parents  commit 25f0f00

File tree

9 files changed

+4599
-0
lines changed

9 files changed

+4599
-0
lines changed

.github/img/example.png

71.6 KB
Loading

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vendor

.php-cs-fixer.php

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
$rules = [
6+
'@PER-CS2.0' => true,
7+
'@PHP83Migration' => true,
8+
'array_push' => true,
9+
'mb_str_functions' => true,
10+
'no_multiline_whitespace_around_double_arrow' => true,
11+
'whitespace_after_comma_in_array' => true,
12+
'modernize_types_casting' => true,
13+
'explicit_string_variable' => true,
14+
'ordered_types' => [
15+
'case_sensitive' => true,
16+
'sort_algorithm' => 'none',
17+
'null_adjustment' => 'always_last',
18+
],
19+
'no_alternative_syntax' => true,
20+
'native_function_invocation' => [
21+
'include' => ['@internal'],
22+
'scope' => 'all',
23+
'strict' => true,
24+
],
25+
'global_namespace_import' => [
26+
'import_classes' => false,
27+
'import_constants' => true,
28+
'import_functions' => true,
29+
],
30+
'no_unused_imports' => true,
31+
'no_homoglyph_names' => true,
32+
'assign_null_coalescing_to_coalesce_equal' => true,
33+
'ternary_to_null_coalescing' => true,
34+
'unary_operator_spaces' => true,
35+
'long_to_shorthand_operator' => true,
36+
'strict_comparison' => true,
37+
'braces_position' => [
38+
'anonymous_classes_opening_brace' => 'next_line_unless_newline_at_signature_end',
39+
'anonymous_functions_opening_brace' => 'next_line_unless_newline_at_signature_end',
40+
],
41+
'declare_strict_types' => true,
42+
'strict_param' => true,
43+
'no_empty_comment' => true,
44+
'no_empty_phpdoc' => true,
45+
'yoda_style' => true,
46+
'final_class' => true,
47+
];
48+
49+
return (new PhpCsFixer\Config())
50+
->setRiskyAllowed(true)
51+
->setRules($rules)
52+
->setFinder((new PhpCsFixer\Finder())->in(__DIR__ . '/src'));

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024+ https://github.com/NickSdot
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Show PHPStan error identifiers in PhpStorm inspection output
2+
3+
<img src=".github/img/example.png" alt="PHPStan error identifiers in PhpStorm inspection output" />
4+
5+
## Installation
6+
7+
1. Run `composer require nicksdot/phpstan-phpstorm-error-identifiers`
8+
2. Add the formatter to the `services` config in `phpstan.neon`
9+
10+
```neon
11+
services:
12+
errorFormatter.checkstyle:
13+
class: NickSdot\PhpStanPhpStormErrorIdentifiers\CheckstyleErrorFormatterPhpStorm # change to where you pasted it!
14+
```
15+
16+
That's it.
17+
18+
No other changes compared to the [original formatter](https://github.com/phpstan/phpstan-src/blob/5a3990227e64a66b058a96753887e4aa7d411b92/src/Command/ErrorFormatter/CheckstyleErrorFormatter.php#L46) were made. This is a PHPStorm bug, a
19+
PR to PHPStan was [discussed](https://github.com/phpstan/phpstan-src/pull/4416) but decided against.

composer.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "nicksdot/phpstan-phpstorm-error-identifiers",
3+
"description": "Custom PHPStan formatter to show error identifiers in PhpStorm inspection output.",
4+
"license": "MIT",
5+
"authors": [
6+
{
7+
"name": "Nick Sdot",
8+
"email": "[email protected]"
9+
}
10+
],
11+
"require": {
12+
"php": ">=8.3",
13+
"phpstan/phpstan": "^2.0.1"
14+
},
15+
"require-dev": {
16+
"friendsofphp/php-cs-fixer": "^3.59",
17+
"phpstan/phpstan-strict-rules": "^2.0.0",
18+
"phpunit/phpunit": "^9.5"
19+
},
20+
"autoload": {
21+
"psr-4": {
22+
"NickSdot\\PhpStanPhpStormErrorIdentifiers\\": "src"
23+
}
24+
},
25+
"autoload-dev": {
26+
"psr-4": {
27+
"Tests\\": "tests/"
28+
}
29+
},
30+
"scripts": {
31+
"fixer": "vendor/bin/php-cs-fixer --config=./.php-cs-fixer.php --allow-risky=yes",
32+
"test": "phpunit --colors"
33+
},
34+
"minimum-stability": "dev",
35+
"prefer-stable": true
36+
}

0 commit comments

Comments
 (0)