Skip to content

Commit f74d0ea

Browse files
Merge branch 'master' into profuel-patch-4
2 parents d5218d5 + 5c2c6f7 commit f74d0ea

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

docs/dg/dev/sdks/sdk/development-tools/phpstan.md

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,35 +36,47 @@ related:
3636

3737
[PHPStan](https://github.com/phpstan/phpstan) is a static code analyzer that introspects the code without running it and catches various classes of bugs prior to unit testing.
3838

39-
## Installation
40-
41-
To install PHPStan, run the following command:
39+
## Install PHPStan
4240

4341
```bash
4442
composer require --dev phpstan/phpstan
4543
```
4644

47-
## Usage
45+
## Use PHPStan
46+
47+
1. Generate autocompletion and prevent any error messages that might occur because of incomplete classes:
48+
49+
```bash
50+
vendor/bin/console dev:ide:generate-auto-completion
51+
```
52+
53+
2. Start analyzing:
54+
55+
```bash
56+
php -d memory_limit=2048M vendor/bin/phpstan analyze -l 6 -c phpstan.neon src/`
57+
```
4858

49-
1. Run the following command to generate autocompletion and prevent any error messages that might occur because of the incomplete classes:
50-
`vendor/bin/console dev:ide:generate-auto-completion`
51-
2. Run this command to start analyzing:
52-
`php -d memory_limit=2048M vendor/bin/phpstan analyze -c vendor/spryker/spryker/phpstan.neon vendor/<spryker | spryker-eco | spryker-middleware>/<MODULE>/ -l 2`
5359

5460
{% info_block errorBox %}
5561

56-
Note that running this command with the level 2 key (**-l 2**) and having no errors is obligatory, and having no errors with level 5 (**-l 5**) is highly recommended.
62+
Demo shops are by default configured with PHPStan at level 6 in `phpstan.neon`. We highly recommend this configuration.
5763

5864
{% endinfo_block %}
5965

60-
## Additional functionality
66+
## Baseline
67+
68+
If you need to raise the level, add new rules or extensions, you can generate a baseline and enable it for future changes.
69+
70+
71+
For more information, see [PHPStan baseline](https://phpstan.org/user-guide/baseline).
72+
6173

62-
**Main configuration file inheritance**
74+
## Main configuration file inheritance
6375

64-
To avoid duplicated code while specifying a different configuration in the _parameters_ section of the `phpstat.neon` file, it's possible to extend this file and determine only the changes needed for a particular configuration of a module.
76+
You can extend `phpstat.neon` and define per-module configuration in the `parameters` section to reuse the matching configuration.
6577

66-
### ./[ROOT]/phpstan.neon
6778

79+
**./[ROOT]/phpstan.neon**
6880
```php
6981
parameters:
7082
excludes_analyse:
@@ -81,7 +93,7 @@ services:
8193
...
8294
```
8395

84-
### ./[Module]/phpstan.neon
96+
**./[Module]/phpstan.neon**
8597

8698
```php
8799
parameters:

0 commit comments

Comments
 (0)