Skip to content

Wrong type inference for QueryBuilder::update and QueryBuilder::delete. #259

Closed
@VincentLanglet

Description

@VincentLanglet

The following code

$result = $this->getEntityManager()
            ->getRepository(ProductCrossSell::class)
            ->createQueryBuilder('pcs')
            ->where('pcs.id IN (:ids)')
            ->setParameter('ids', $ids)
            ->delete()
            ->getQuery()
            ->getResult();

\PHPStan\dumpType($result);

Is considering $result as an array. But it's an int: the number of deleted elements. Same with update()

It was introduce by #232 cc @arnaud-lb

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