Skip to content

Commit c9c669c

Browse files
authored
Add PHPStorm PHPStan set up guide (#37)
1 parent e6898c6 commit c9c669c

File tree

8 files changed

+43
-1
lines changed

8 files changed

+43
-1
lines changed

doc/ideConfig/IdeConfig.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The Coding-Standard incorporates different tools to check and fix your code.
1111
Here are the guides to set up PHPStorm for each tool:
1212

1313
- [PHP Code Sniffer](phpCS/PhpCodeSniffer.md)
14+
- [PHP Stan](phpStan/PhpStan.md)
1415

1516

1617

doc/ideConfig/phpCS/PhpCodeSniffer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ able to see code highlighting and use auto-fixing in your IDE.
55

66
How long will it take: 15 minutes
77

8-
Pre-requisites:
8+
## Pre-requisites
99
- Completed guide: [PHP-Interpreter](../phpInterpreter/PhpInterpreter.md)
1010
- A local composer project, fully installed
1111

-697 Bytes
Loading
-892 Bytes
Loading

doc/ideConfig/phpStan/PhpStan.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Set up PHPStorm for PHPStan
2+
3+
This guide will help you set up PHPStorm to use PHPStan. You will be
4+
able to see code highlighting and use auto-fixing in your IDE.
5+
6+
How long will it take: 15 minutes
7+
8+
## Pre-requisites
9+
- Completed guide: [PHP-Interpreter-Guide](../phpInterpreter/PhpInterpreter.md)
10+
- A local composer project, fully installed
11+
12+
## Steps
13+
14+
1) Open the PHPStorm IDE and load up the project you want to work on.
15+
2) Open the settings dialog by pressing `Ctrl + Alt + S`(Windows + Linux)
16+
`CMD + ,` (macOS).
17+
3) Navigate to "PHP" -> "Quality Tools" -> "PHPStan" and open the
18+
Configuration by clicking on the "..." button.
19+
![PHPStan](php-stan.png)
20+
4) If your [PHP interpreter](#Set-up-the-PHP-interpreter) we set up in [PHP-Interpreter-Guide](../phpInterpreter/PhpInterpreter.md)
21+
is not automatically added to the list click on the "+" button to add it
22+
now.
23+
5) Fill the Dialog as follows
24+
* `PHPStan path` must be `/coding-standard/vendor/bin/phpstan`
25+
26+
![PHPStan Configuration](php-stan-configuration.png)
27+
6) Click on the Folder Icon in `Docker container` and change the Volume bindings
28+
as follows. The only entry allowed here is Hostpath = absolute Path to your
29+
project -> Container path = /app
30+
31+
![PHPStan Configuration](php-stan-configuration-docker.png)
32+
7) Return to "PHP" -> "Quality Tools" -> "PHPStan".
33+
8) Choose your newly added configuration and Switch it on.
34+
9) Now we have to set the options. Please make very sure that you don't miss anything.
35+
* Check Full project run
36+
* Set `Level` to `5`
37+
* Set `Configuration file` to `/coding-standard/config/phpstan/phpstan.neon`
38+
* Set `Autoload file` to `/app/vendor/autoload.php`
39+
40+
![PHPStan Options](php-stan.png)
41+
10) Close dialog. You are done.
38.3 KB
Loading
41.9 KB
Loading

doc/ideConfig/phpStan/php-stan.png

49.2 KB
Loading

0 commit comments

Comments
 (0)