Skip to content

False positive with Container::get not nullable #74

@noemi-salaun

Description

@noemi-salaun

Symfony\Component\DependencyInjection\ContainerInterface::get() can return null when using ContainerInterface::NULL_ON_INVALID_REFERENCE

$stack = $container->get('request_stack', ContainerInterface::NULL_ON_INVALID_REFERENCE);
if (null === $stack) {
    return null;
}

Strict comparison using === between null and Symfony\Component\HttpFoundation\RequestStack will always evaluate to false.

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