Skip to content

Commit 53d44e6

Browse files
committed
test 2nd class does not inherit previous __construct() scope
1 parent b070193 commit 53d44e6

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

tests/PHPStan/Rules/Constants/ConstantRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ public function testRememberedConstructorScope(): void
9393
38,
9494
'Learn more at https://phpstan.org/user-guide/discovering-symbols',
9595
],
96+
[
97+
'Constant REMEMBERED_FOO not found.',
98+
51,
99+
'Learn more at https://phpstan.org/user-guide/discovering-symbols',
100+
],
96101
]);
97102
}
98103

tests/PHPStan/Rules/Constants/data/remembered-constructor-scope.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,11 @@ public function returnFoo2(): string
4343
return REMEMBERED_FOO;
4444
}
4545
}
46+
47+
48+
class AnotherClass {
49+
public function myFoo(): string
50+
{
51+
return REMEMBERED_FOO; // should error, because this file cannot share the __constructor() scope with HelloWorld-class above.
52+
}
53+
}

0 commit comments

Comments
 (0)