Skip to content

Infering getResult as list #381

@janedbal

Description

@janedbal

Hi, I'm currently testing upcoming version of phpstan (1.9.x-dev) where you cannot pass array<Foo> argument to list<Foo> parameter. Currently, simple queries like this

$list = $qb->select('e')->from(Entity::class, 'e')->getResult();

are infered as array<mixed, Entity> (source) even though it is actually a list. This is getting problematic in phpstan 1.9, would it be possible to return it as list when no indexBy is used? Or is there any blocker?

I assume, this is mainly question for @arnaud-lb
Thank you

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