Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Nowicki opened this issue Mar 18, 2022 · 1 comment

Comments

@Nowicki
Copy link

Nowicki commented Mar 18, 2022

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
Copy link
Owner

I have no idea, sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants