Skip to content

Commit

Permalink
Fix psalm errors: remove override of template type
Browse files Browse the repository at this point in the history
See doctrine/collections#368 for the same
issue in doctrine/collections which has been fixed there.

The issue happens when using ->contains(). Running psalm emits

  > InvalidArgument - Argument 1 of Doctrine\ORM\PersistentCollection::contains
  > expects
  > TMaybeContained:fn-doctrine\common\collections\readablecollection::contains
  > as mixed, but … provided.

We should either not define @template TMaybeContained or re-define
the psalm docblock from ReadableCollection completely.
  • Loading branch information
tantegerda1 committed Mar 20, 2024
1 parent 55c4845 commit 0ff2a4f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/LazyCriteriaCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ public function isEmpty(): bool
* {@inheritDoc}
*
* Do an optimized search of an element
*
* @template TMaybeContained
*/
public function contains(mixed $element): bool
{
Expand Down
2 changes: 0 additions & 2 deletions src/PersistentCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,6 @@ public function containsKey(mixed $key): bool

/**

Check failure on line 353 in src/PersistentCollection.php

View workflow job for this annotation

GitHub Actions / coding-standards / Coding Standards (8.2)

Useless documentation comment with @inheritdoc.
* {@inheritDoc}
*
* @template TMaybeContained
*/
public function contains(mixed $element): bool
{
Expand Down

0 comments on commit 0ff2a4f

Please sign in to comment.