Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
*
* @author Tim <me@justim.net>
*
* @psalm-template TEntity of Entity
* @template-covariant TEntity of Entity
* @template-implements \ArrayAccess<int, TEntity>
* @template-implements \IteratorAggregate<int, TEntity>
*/
class Collection implements \ArrayAccess, \Countable, \IteratorAggregate

Check failure on line 35 in src/Collection.php

View workflow job for this annotation

GitHub Actions / Lint (8.3, highest)

InvalidTemplateParam

src/Collection.php:35:29: InvalidTemplateParam: Cannot extend an invariant template param TValue into a covariant context (see https://psalm.dev/183)
{
/**
* @var Database
Expand Down Expand Up @@ -63,7 +63,7 @@

/**
* @param iterable<Entity> $iterable List of entities
* @psalm-param iterable<TEntity> $iterable List of entities

Check failure on line 66 in src/Collection.php

View workflow job for this annotation

GitHub Actions / Lint (8.3, highest)

InvalidTemplateParam

src/Collection.php:66:21: InvalidTemplateParam: Template param TEntity of Access\Collection is marked covariant and cannot be used here (see https://psalm.dev/183)
*/
public function fromIterable(iterable $iterable): void
{
Expand All @@ -80,7 +80,7 @@
* Add a entity to the collection
*
* @param Entity $entity
* @psalm-param TEntity $entity

Check failure on line 83 in src/Collection.php

View workflow job for this annotation

GitHub Actions / Lint (8.3, highest)

InvalidTemplateParam

src/Collection.php:83:21: InvalidTemplateParam: Template param TEntity of Access\Collection is marked covariant and cannot be used here (see https://psalm.dev/183)
*/
public function addEntity(Entity $entity): void
{
Expand Down Expand Up @@ -192,7 +192,7 @@
/**
* Find the first entity in a collection
*
* @psalm-param callable(TEntity): bool $finder Return entity when $finder returns `true`

Check failure on line 195 in src/Collection.php

View workflow job for this annotation

GitHub Actions / Lint (8.3, highest)

InvalidTemplateParam

src/Collection.php:195:21: InvalidTemplateParam: Template param TEntity of Access\Collection is marked covariant and cannot be used here (see https://psalm.dev/183)
* @param callable $finder Return entity when $finder returns `true`
* @psalm-return TEntity|null
* @return Entity|null
Expand Down Expand Up @@ -243,8 +243,8 @@
/**
* Group collection by a specified index
*
* @psalm-param callable(TEntity): array-key $groupIndexMapper

Check failure on line 246 in src/Collection.php

View workflow job for this annotation

GitHub Actions / Lint (8.3, highest)

InvalidTemplateParam

src/Collection.php:246:21: InvalidTemplateParam: Template param TEntity of Access\Collection is marked covariant and cannot be used here (see https://psalm.dev/183)
* @psalm-return GroupedCollection<TEntity>

Check failure on line 247 in src/Collection.php

View workflow job for this annotation

GitHub Actions / Lint (8.3, highest)

InvalidTemplateParam

src/Collection.php:247:22: InvalidTemplateParam: Template param TEntity of Access\Collection is marked covariant and cannot be used here (see https://psalm.dev/183)
* @param callable $groupIndexMapper Should return the index of the group
* @return GroupedCollection
*/
Expand Down Expand Up @@ -274,7 +274,7 @@
* NOTE: uses `usort` with $comparer as compare function
* NOTE: no new collection is created
*
* @psalm-param OrderByInterface|callable(TEntity, TEntity): int $comparer

Check failure on line 277 in src/Collection.php

View workflow job for this annotation

GitHub Actions / Lint (8.3, highest)

InvalidTemplateParam

src/Collection.php:277:21: InvalidTemplateParam: Template param TEntity of Access\Collection is marked covariant and cannot be used here (see https://psalm.dev/183)
* @param callable $comparer Function to sort/compare with
* @return $this
*/
Expand All @@ -293,7 +293,7 @@
* Map over collection
*
* @psalm-template T
* @psalm-param callable(TEntity): T $mapper

Check failure on line 296 in src/Collection.php

View workflow job for this annotation

GitHub Actions / Lint (8.3, highest)

InvalidTemplateParam

src/Collection.php:296:21: InvalidTemplateParam: Template param TEntity of Access\Collection is marked covariant and cannot be used here (see https://psalm.dev/183)
* @psalm-return T[]
* @param callable $mapper Function to call for every entity
* @return mixed[] Your mapped values
Expand All @@ -307,7 +307,7 @@
* Reduce collection to something different
*
* @psalm-template T
* @psalm-param callable(T, TEntity): T $reducer

Check failure on line 310 in src/Collection.php

View workflow job for this annotation

GitHub Actions / Lint (8.3, highest)

InvalidTemplateParam

src/Collection.php:310:21: InvalidTemplateParam: Template param TEntity of Access\Collection is marked covariant and cannot be used here (see https://psalm.dev/183)
* @psalm-param T $initial
* @psalm-return T
* @param callable $reducer Function to call for every entity
Expand All @@ -328,7 +328,7 @@
/**
* Create a new filtered collection
*
* @psalm-param callable(TEntity): scalar $finder Include entity when $finder returns `true`

Check failure on line 331 in src/Collection.php

View workflow job for this annotation

GitHub Actions / Lint (8.3, highest)

InvalidTemplateParam

src/Collection.php:331:21: InvalidTemplateParam: Template param TEntity of Access\Collection is marked covariant and cannot be used here (see https://psalm.dev/183)
* @param callable $finder Include entity when $finder returns `true`
* @return Collection<TEntity> Newly created, and filtered, collection
*/
Expand Down