|
| 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 | +  |
| 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 | +  |
| 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 | +  |
| 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 | +  |
| 41 | +10) Close dialog. You are done. |
0 commit comments