Skip to content

Keep QueryBuilderType across method calls #266

Closed
@Khartir

Description

@Khartir

I don't know if this is currently even possible, but it would be nice, if Phpstan could determine the type of the QueryBuilder, even if it is defined in another method. Currently something like this results in a mixed return type:

    /**
     * @return array<Entity>
     */
    public function reuseQueryBuilder(): array
    {
        return $this->getQueryBuilder()
            ->getQuery()
            ->getResult();
    }

    private function getQueryBuilder(): QueryBuilder
    {
        return $this->createQueryBuilder('test');
    }

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