symfony / symfony/maker-bundle

Psalm LessSpecificImplementedReturnType error on Repository's `findAll()` docblock

Open
#815 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

DX
Dominant language
PHP
Stars
3.4k
Forks
427
Avg merge
2d 22h
Merged PRs (30d)
20

Description

Psalm is reporting this:

ERROR: LessSpecificImplementedReturnType - src/Repository/LinkRepository.php:8:12 - The inherited return type 'list' for Doctrine\ORM\EntityRepository::findAll is more specific than the implemented return type for Doctrine\ORM\EntityRepository::findall 'array<array-key, App\Entity\Link>' (see https://psalm.dev/166)
/**

  • @method Link|null find($id, $lockMode = null, $lockVersion = null)
  • @method Link|null findOneBy(array $criteria, array $orderBy = null)
  • @method Link[] findAll()
  • @method Link[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
  • @extends ServiceEntityRepository
    */

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/Repository/LinkRepository.php at the reported docblock and compare the findAll() annotation with the inherited Doctrine return type in the Psalm error. Run Psalm against the repository and confirm that the LessSpecificImplementedReturnType error is resolved without introducing new errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.