Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Rules/Api/RuntimeReflectionFunctionRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public function processNode(Node $node, Scope $scope): array
if (!in_array($functionReflection->getName(), [
'is_a',
'is_subclass_of',
'get_declared_classes',
'class_parents',
'class_implements',
'class_uses',
Expand Down
4 changes: 4 additions & 0 deletions tests/PHPStan/Rules/Api/RuntimeReflectionFunctionRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ public function testRule(): void
'Function class_uses() is a runtime reflection concept that might not work in PHPStan because it uses fully static reflection engine. Use objects retrieved from ReflectionProvider instead.',
51,
],
[
'Function get_declared_classes() is a runtime reflection concept that might not work in PHPStan because it uses fully static reflection engine. Use objects retrieved from ReflectionProvider instead.',
52,
],
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function doFoo(object $o): void
$p = class_parents($o);
$i = class_implements($o);
$t = class_uses($o);
$d = get_declared_classes();
}

}