Skip to content

Commit 9133e42

Browse files
committed
ClassBlacklistReflectionProvider - check that userland class isn't aliased to the same name as a class from stubs
1 parent ffb36bf commit 9133e42

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Reflection/ReflectionProvider/ClassBlacklistReflectionProvider.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,14 @@ public function __construct(
3838
public function hasClass(string $className): bool
3939
{
4040
if ($this->phpStormStubsSourceStubber->hasClass($className)) {
41-
return false;
41+
// check that userland class isn't aliased to the same name as a class from stubs
42+
if (!class_exists($className, false)) {
43+
return false;
44+
}
45+
$reflection = new \ReflectionClass($className);
46+
if ($reflection->getFileName() === false) {
47+
return false;
48+
}
4249
}
4350

4451
foreach ($this->patterns as $pattern) {

0 commit comments

Comments
 (0)