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: README.md
+51-6Lines changed: 51 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,15 +26,60 @@ includes:
26
26
```
27
27
28
28
## Features
29
-
1. The extension adds an class generator for factory & proxy classes similar as Magento does it. When running PHPStan in context of a Magento application this is not needed if you point PHPStan also the the generated files folder. When running Magento in a context of a module, this is required so that PHPStan get's the full picture of all classes needed.
30
-
2. The extension adds an autoloader for "mocked" classes. These are classes that replace the Magento specific implementations to fix problems with type hints or missing methods in interfaces and such. The autoloader will check if a class, interface or trait exists locally in the extension. If so, it will load the local version instead of the one being shipped by Magento. Once those problems are fixed in Magento, those mocks can be removed again.
31
-
3. A type extension was added so that `ObjectManager` calls return the correct return type.
32
-
4. For some classes like the `DataObject` or the `SessionManager` logic was added to be able to support magic method calls.
33
-
5. The extension provides an autoloader for `Magento\TestFramework` classes to let you run PHPStan also against your test classes.
29
+
30
+
### Class generator for factory & proxy classes
31
+
The extension adds a class generator for factory & proxy classes similar as Magento does it. When running PHPStan in
32
+
context of a Magento application this is not needed if you point PHPStan also to the generated files folder. When running
33
+
Magento in the context of a module, this is required so that PHPStan gets the full picture of all classes needed.
34
+
35
+
### Mocked classes autoloader
36
+
The extension adds an autoloader for "mocked" classes. These are classes that replace the Magento specific implementations
37
+
to fix problems with type hints or missing methods in interfaces and such. The autoloader will check if a class, interface,
38
+
or trait exists locally in the extension's folder of mocks. If so, it will load the local version instead of the one being
39
+
shipped by Magento. Once those problems are fixed in Magento, those mocks can be removed again.
40
+
41
+
### TestFramework autoloader
42
+
The extension provides an autoloader for `Magento\TestFramework` classes to let you run PHPStan also against your test classes.
43
+
44
+
### ObjectManager type hints
45
+
A type extension was added so that `ObjectManager` calls return the correct return type.
46
+
47
+
### Support for magic method calls
48
+
For some classes like the `DataObject` or the `SessionManager` logic was added to be able to support magic method calls.
49
+
50
+
### PHPStan rules
51
+
52
+
The following rules are available to run checks against your codebase, e.g. if your implementation adheres to the
53
+
service contracts specification. Each of the rules can be disabled if needed.
54
+
55
+
#### Service contracts
56
+
57
+
Since Magento framework version 100.1.0 entities must not be responsible for their own loading, service contracts should
58
+
be used to persist entities.
59
+
60
+
To disable this rule add the following code to your `phpstan.neon` configuration file:
61
+
```
62
+
parameters:
63
+
magento:
64
+
checkServiceContracts: false
65
+
```
66
+
67
+
#### Collections should be used directly via factory
68
+
69
+
Since Magento framework version 101.0.0 Collections should be used directly via factory instead of calling
To disable this rule add the following code to your `phpstan.neon` configuration file:
73
+
```
74
+
parameters:
75
+
magento:
76
+
checkCollectionViaFactory: false
77
+
```
34
78
35
79
## Contribute
36
80
37
-
Please feel free to fork and extend existing or add new features and send a pull request with your changes! To establish a consistent code quality, please provide unit tests for all your changes and adapt the documentation.
81
+
Please feel free to fork and extend existing or add new features and send a pull request with your changes! To establish
82
+
a consistent code quality, please provide unit tests for all your changes and adapt the documentation.
0 commit comments