Skip to content

Commit e7850f1

Browse files
committed
testClassConstFetchOnUnknownClass
1 parent 654734a commit e7850f1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/PHPStan/Analyser/nsrt/bug-8985.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,12 @@ function testClassConstFetch(): void {
100100

101101
assertType("'const_value'", (new Repository())::MY_CONST);
102102
}
103+
104+
function testClassConstFetchOnUnknownClass(string $class, string $anotherClass): void {
105+
assert((new $class())::MY_CONST === 'const_value');
106+
107+
assertType("'const_value'", (new $class())::MY_CONST);
108+
109+
$class = $anotherClass;
110+
assertType("*ERROR*", (new $class())::MY_CONST);
111+
}

0 commit comments

Comments
 (0)