First off, is there a way to test the Symfony extension in the PHPStan Playground? In absence of that, here is the classic way of explaining the problem. We have a couple of conditional get calls to the service container like so:
if ($container->has('doctrine.orm.entity_manager')) {
$em = $container->get('doctrine.orm.entity_manager');
// ...
}
Unfortunately, this conditional is not properly evaluated:
Service "doctrine.orm.entity_manager" is not registered in the container.
In this case, the get should not cause an error since it will not be reached if there's no such service.