Skip to content

Commit

Permalink
IEntityFactory: createCollection() returns iterable<Entity>
Browse files Browse the repository at this point in the history
  • Loading branch information
janpecha committed Apr 8, 2024
1 parent 09f98c0 commit 58c3513
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 19 deletions.
15 changes: 0 additions & 15 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,6 @@ parameters:
count: 2
path: src/LeanMapper/Entity.php

-
message: "#^Method LeanMapper\\\\Entity\\:\\:getBelongsToManyValue\\(\\) should return array\\<LeanMapper\\\\Entity\\> but returns mixed\\.$#"
count: 1
path: src/LeanMapper/Entity.php

-
message: "#^Method LeanMapper\\\\Entity\\:\\:getHasManyValue\\(\\) should return array\\<LeanMapper\\\\Entity\\> but returns mixed\\.$#"
count: 1
path: src/LeanMapper/Entity.php

-
message: "#^Parameter \\#1 \\$entityFactory of method LeanMapper\\\\Entity\\:\\:setEntityFactory\\(\\) expects LeanMapper\\\\IEntityFactory, LeanMapper\\\\IEntityFactory\\|null given\\.$#"
count: 1
Expand Down Expand Up @@ -240,11 +230,6 @@ parameters:
count: 1
path: src/LeanMapper/Reflection/PropertyValuesEnum.php

-
message: "#^Method LeanMapper\\\\Repository\\:\\:createEntities\\(\\) should return array\\<LeanMapper\\\\Entity\\> but returns mixed\\.$#"
count: 1
path: src/LeanMapper/Repository.php

-
message: "#^Parameter \\#1 \\$id of method LeanMapper\\\\Entity\\:\\:attach\\(\\) expects int\\|string, mixed given\\.$#"
count: 1
Expand Down
4 changes: 2 additions & 2 deletions src/LeanMapper/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ private function getHasOneValue(Property $property, Relationship\HasOne $relatio


/**
* @return Entity[]
* @return iterable<Entity>
* @throws InvalidValueException
*/
private function getHasManyValue(
Expand Down Expand Up @@ -951,7 +951,7 @@ private function getBelongsToOneValue(Property $property, Relationship\BelongsTo


/**
* @return Entity[]
* @return iterable<Entity>
*/
private function getBelongsToManyValue(Property $property, Relationship\BelongsToMany $relationship, ?Filtering $filtering = null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/LeanMapper/IEntityFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function createEntity(string $entityClass, $arg = null): Entity;
* Allows wrap set of entities in custom collection
*
* @param Entity[] $entities
* @return mixed
* @return iterable<Entity>
*/
function createCollection(array $entities);

Expand Down
2 changes: 1 addition & 1 deletion src/LeanMapper/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ protected function createEntity(DibiRow $dibiRow, ?string $entityClass = null, ?
* Creates new set of Entity's instances from given array of \Dibi\Row instances
*
* @param \Dibi\Row[] $rows
* @return Entity[]
* @return iterable<Entity>
*/
protected function createEntities(array $rows, ?string $entityClass = null, ?string $table = null)
{
Expand Down

0 comments on commit 58c3513

Please sign in to comment.