Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Conditional $container->get() not evaluated correctly #6

Closed
@alcaeus

Description

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /