Slamdunk / phpstan-laminas-framework

Laminas Framework 3 extensions for PHPStan
MIT License
16 stars 10 forks source link

Calling MvcEvent::getApplication()->getServiceManager()->get('config') hangs phpstan #31

Open Nowicki opened 2 years ago

Nowicki commented 2 years ago

I have few modules which do someting like this:

class Module
{
    public function onBootstrap(MvcEvent $event): void
    {
        $config = $event->getApplication()->getServiceManager()->get('config');
        // ....
    }
}

This code hangs phpstan for about 5 minutes. Calling $event->getApplication()->getServiceManager()->get('AnyService') works without any issues. Currently I am using a workaround:

use Interop\Container\ContainerInterface;

class Module
{
    public function onBootstrap(MvcEvent $event): void
    {
         /** @var ContainerInterface $serviceManager */
        $serviceManager = $event->getApplication()->getServiceManager();
        $config = $serviceManager->get('config');
        // ....
    }
}

Tested on: PHP 8.0.15 PHPStan 1.4.10 PHPStan Laminas Framework 1.0.0

Slamdunk commented 2 years ago

I have no idea, sorry