-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
phpstan/phpstan-src
#394Labels
Milestone
Description
Code snippet that reproduces the problem
interface CommandSubscriber
{
/**
* @return array<class-string, string>
*/
public static function getSubscribedCommands(): array;
}
class Locator
{
/**
* @var array[]
*/
private $command_handler_ids = [];
public function registerSubscriberService(string $service_name, string $class_name): void
{
if (is_a($class_name, CommandSubscriber::class, true)) {
foreach (forward_static_call([$class_name, 'getSubscribedCommands']) as $command_name => $method) {
$this->command_handler_ids[$command_name] = [$service_name, $method];
}
}
}
}https://phpstan.org/r/f1c77d3e-9c47-4665-bd2d-1441fdaf0714
I checked that the variable $class_name belongs to the class that implements the interface CommandSubscriber. The interface has a static method getSubscribedCommands() that i call. This method must be accessible as the interface declares. I see no reason to check it again for callability.
Reactions are currently unavailable