From 58d811e81b07ffc9ab63559c5fafa071c781a651 Mon Sep 17 00:00:00 2001 From: Zachary Lund Date: Thu, 28 May 2026 07:46:29 -0500 Subject: [PATCH] Update ServiceEntityRepository stub Add new methods in doctrine/doctrine-bundle v3. --- stubs/ServiceEntityRepository.stub | 66 +++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/stubs/ServiceEntityRepository.stub b/stubs/ServiceEntityRepository.stub index 9c538d45..42a9b4d5 100644 --- a/stubs/ServiceEntityRepository.stub +++ b/stubs/ServiceEntityRepository.stub @@ -1,11 +1,73 @@ */ -class ServiceEntityRepository extends EntityRepository { +class ServiceEntityRepository extends EntityRepository +{ + + /** + * @phpstan-param mixed $id + * @phpstan-param int|null $lockMode + * @phpstan-param int|null $lockVersion + * @phpstan-return T|null + * @phpstan-impure + */ + public function find($id, $lockMode = null, $lockVersion = null); + + /** + * @phpstan-param array $criteria + * @phpstan-param array|null $orderBy + * @phpstan-param int|null $limit + * @phpstan-param int|null $offset + * @phpstan-return list + * @phpstan-impure + */ + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null); + + /** + * @phpstan-param array $criteria The criteria. + * @phpstan-param array|null $orderBy + * @phpstan-return T|null + * @phpstan-impure + */ + public function findOneBy(array $criteria, ?array $orderBy = null); + + /** + * @phpstan-return class-string + */ + protected function getEntityName(); + + /** + * @param Criteria $criteria + * + * @phpstan-return AbstractLazyCollection&Selectable + */ + public function matching(Criteria $criteria); + + /** + * @param __doctrine-literal-string $alias + * @param __doctrine-literal-string|null $indexBy + * + * @return QueryBuilder + */ + public function createQueryBuilder($alias, $indexBy = null); + + /** + * @param array $criteria + * + * @return int<0, max> + * + * @phpstan-impure + */ + public function count(array $criteria); + }