Skip to content

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

@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
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions