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
Now lean back and rely on PHPStan in CI pipelines, git hooks or IDE integrations;
22
+
If somebody introduces a rogue factory:
23
+
```php
24
+
<?php
25
+
// […]
26
+
27
+
class FailingFactory
28
+
{
29
+
public function create(): OnlyViaFactory
30
+
{
31
+
return new OnlyViaFactory();
32
+
}
33
+
}
34
+
```
35
+
…that is supposed to fail, when you run PHPStan.
36
+
37
+
## Deprecated usage with `ebln/phpstan-factory-mark`
38
+
39
+
Require this extention and [the package containing the marking interface](https://github.com/ebln/phpstan-factory-mark) via [Composer](https://getcomposer.org/) alongside with PHPStan:
40
+
```shell
41
+
composer require ebln/phpstan-factory-mark
42
+
composer require --dev ebln/phpstan-factory-rule
43
+
```
9
44
10
45
Implement `\Ebln\PHPStan\EnforceFactory\ForceFactoryInterface` with the DTO you want to protect.
11
46
```php
@@ -42,10 +77,10 @@ class FailingFactory
42
77
43
78
## Installation
44
79
45
-
Require this extention and [the package containing the interface](https://github.com/ebln/phpstan-factory-mark)via [Composer](https://getcomposer.org/):
80
+
Require this extention via [Composer](https://getcomposer.org/):
0 commit comments