-
-
Notifications
You must be signed in to change notification settings - Fork 931
Open
Labels
Description
Bug report
Given following collector, rule and file:
class AnonCollector implements Collector
{
public function getNodeType(): string {
return InClassNode::class;
}
public function processNode(Node $node, Scope $scope): ?array {
return [$node->getClassReflection()->getName()];
}
}
class AnonRule implements Rule
{
public function __construct(private ReflectionProvider $reflectionProvider) {}
public function getNodeType(): string {
return CollectedDataNode::class;
}
public function processNode(Node $node, Scope $scope): array
{
$data = $node->get(AnonCollector::class);
foreach ($data as $dataInFile) {
foreach ($dataInFile as $fileData) {
foreach ($fileData as $classString) {
$this->reflectionProvider->getClass($classString);
}
}
}
return [];
}
}
// anon.php
$foo = new class {};
Causes following failure when executed by vendor/bin/phpstan analyse anon.php
:
------ --------------------------------------
Line N/A
------ --------------------------------------
-1 Class AnonymousClass6d87bc9b4fb4c41ce505d40f5dd1e5f5 was not found while trying to analyse it - discovering symbols is probably not configured properly.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
------ --------------------------------------
Related code. Everything is working when single process used for analysis by vendor/bin/phpstan analyse --debug anon.php
Code snippet that reproduces the problem
vendor/bin/phpstan analyse anon.php
Expected output
No error.