We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 27f95cc commit bb3f89cCopy full SHA for bb3f89c
tests/PHPStan/Rules/Classes/data/remember-class-exists-from-constructor.php
@@ -3,8 +3,9 @@
3
namespace RememberClassExistsFromConstructor;
4
5
use SomeUnknownClass;
6
+use SomeUnknownInterface;
7
-class User
8
+class UserWithClass
9
{
10
public function __construct(
11
) {
@@ -22,3 +23,22 @@ public function doFoo($m): bool
22
23
}
24
25
26
+
27
+class UserWithInterface
28
+{
29
+ public function __construct(
30
+ ) {
31
+ if (!interface_exists('SomeUnknownInterface')) {
32
+ throw new \LogicException();
33
+ }
34
35
36
+ public function doFoo($m): bool
37
+ {
38
+ if ($m instanceof SomeUnknownInterface) {
39
+ return false;
40
41
+ return true;
42
43
44
+}
0 commit comments