You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/dg/dev/sdks/sdk/development-tools/phpstan.md
+26-14Lines changed: 26 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -36,35 +36,47 @@ related:
36
36
37
37
[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.
38
38
39
-
## Installation
40
-
41
-
To install PHPStan, run the following command:
39
+
## Install PHPStan
42
40
43
41
```bash
44
42
composer require --dev phpstan/phpstan
45
43
```
46
44
47
-
## Usage
45
+
## Use PHPStan
46
+
47
+
1. Generate autocompletion and prevent any error messages that might occur because of incomplete classes:
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.
57
63
58
64
{% endinfo_block %}
59
65
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
+
61
73
62
-
**Main configuration file inheritance**
74
+
## Main configuration file inheritance
63
75
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.
0 commit comments