Skip to content

Commit 93057dd

Browse files
committed
feature #1040 [make:entity] Change getter PHPDoc return type on Collection (mehdibo)
This PR was squashed before being merged into the 1.0-dev branch. Discussion ---------- [make:entity] Change getter PHPDoc return type on Collection Improves #979 Commits ------- 64b0799 [make:entity] Change getter PHPDoc return type on Collection
2 parents 3b50e81 + 64b0799 commit 93057dd

File tree

18 files changed

+20
-20
lines changed

18 files changed

+20
-20
lines changed

src/Util/ClassSourceManipulator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ private function addCollectionRelation(BaseCollectionRelation $relation): void
682682
$collectionTypeHint,
683683
false,
684684
// add @return that advertises this as a collection of specific objects
685-
[sprintf('@return %s|%s[]', $collectionTypeHint, $typeHint)]
685+
[sprintf('@return %s<int, %s>', $collectionTypeHint, $typeHint)]
686686
);
687687

688688
$argName = Str::pluralCamelCaseToSingular($relation->getPropertyName());

tests/Doctrine/fixtures/expected_no_overwrite/src/Entity/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function setApiKey(string $apiKey): self
6161
}
6262

6363
/**
64-
* @return Collection|Tag[]
64+
* @return Collection<int, Tag>
6565
*/
6666
public function getTags(): Collection
6767
{

tests/Doctrine/fixtures/expected_no_overwrite/src/Entity/User.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function setUserProfile(?UserProfile $userProfile)
5656
}
5757

5858
/**
59-
* @return Collection|UserAvatar[]
59+
* @return Collection<int, UserAvatar>
6060
*/
6161
public function getAvatars(): Collection
6262
{
@@ -91,7 +91,7 @@ public function getUserProfile(): ?UserProfile
9191
}
9292

9393
/**
94-
* @return Collection|Tag[]
94+
* @return Collection<int, Tag>
9595
*/
9696
public function getTags(): Collection
9797
{

tests/Doctrine/fixtures/expected_overwrite/src/Entity/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function setApiKey(string $apiKey): self
6161
}
6262

6363
/**
64-
* @return Collection|Tag[]
64+
* @return Collection<int, Tag>
6565
*/
6666
public function getTags(): Collection
6767
{

tests/Doctrine/fixtures/expected_overwrite/src/Entity/User.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function setUserProfile(?UserProfile $userProfile): self
6767
}
6868

6969
/**
70-
* @return Collection|UserAvatar[]
70+
* @return Collection<int, UserAvatar>
7171
*/
7272
public function getAvatars(): Collection
7373
{
@@ -102,7 +102,7 @@ public function getUserProfile(): ?UserProfile
102102
}
103103

104104
/**
105-
* @return Collection|Tag[]
105+
* @return Collection<int, Tag>
106106
*/
107107
public function getTags(): Collection
108108
{

tests/Doctrine/fixtures/expected_xml/src/Entity/UserXml.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function setName(string $name): self
3737
}
3838

3939
/**
40-
* @return Collection|UserAvatar[]
40+
* @return Collection<int, UserAvatar>
4141
*/
4242
public function getAvatars(): Collection
4343
{

tests/Util/fixtures/add_many_to_many_relation/User_simple_inverse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function getId(): ?int
2828
}
2929

3030
/**
31-
* @return Collection|Recipe[]
31+
* @return Collection<int, Recipe>
3232
*/
3333
public function getRecipes(): Collection
3434
{

tests/Util/fixtures/add_many_to_many_relation/User_simple_no_inverse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function getId(): ?int
2828
}
2929

3030
/**
31-
* @return Collection|Recipe[]
31+
* @return Collection<int, Recipe>
3232
*/
3333
public function getRecipes(): Collection
3434
{

tests/Util/fixtures/add_many_to_many_relation/User_simple_owning.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function getId(): ?int
2828
}
2929

3030
/**
31-
* @return Collection|Recipe[]
31+
* @return Collection<int, Recipe>
3232
*/
3333
public function getRecipes(): Collection
3434
{

tests/Util/fixtures/add_many_to_many_relation/legacy/User_simple_inverse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function getId(): ?int
3434
}
3535

3636
/**
37-
* @return Collection|Recipe[]
37+
* @return Collection<int, Recipe>
3838
*/
3939
public function getRecipes(): Collection
4040
{

tests/Util/fixtures/add_many_to_many_relation/legacy/User_simple_no_inverse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function getId(): ?int
3434
}
3535

3636
/**
37-
* @return Collection|Recipe[]
37+
* @return Collection<int, Recipe>
3838
*/
3939
public function getRecipes(): Collection
4040
{

tests/Util/fixtures/add_many_to_many_relation/legacy/User_simple_owning.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function getId(): ?int
3434
}
3535

3636
/**
37-
* @return Collection|Recipe[]
37+
* @return Collection<int, Recipe>
3838
*/
3939
public function getRecipes(): Collection
4040
{

tests/Util/fixtures/add_one_to_many_relation/User_simple.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function getId(): ?int
2828
}
2929

3030
/**
31-
* @return Collection|UserAvatarPhoto[]
31+
* @return Collection<int, UserAvatarPhoto>
3232
*/
3333
public function getAvatarPhotos(): Collection
3434
{

tests/Util/fixtures/add_one_to_many_relation/User_simple_orphan_removal.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function getId(): ?int
2828
}
2929

3030
/**
31-
* @return Collection|UserAvatarPhoto[]
31+
* @return Collection<int, UserAvatarPhoto>
3232
*/
3333
public function getAvatarPhotos(): Collection
3434
{

tests/Util/fixtures/add_one_to_many_relation/User_with_use_statements.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function getId(): ?int
3030
}
3131

3232
/**
33-
* @return Collection|UserAvatarPhoto[]
33+
* @return Collection<int, UserAvatarPhoto>
3434
*/
3535
public function getAvatarPhotos(): Collection
3636
{

tests/Util/fixtures/add_one_to_many_relation/legacy/User_simple.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function getId(): ?int
3434
}
3535

3636
/**
37-
* @return Collection|UserAvatarPhoto[]
37+
* @return Collection<int, UserAvatarPhoto>
3838
*/
3939
public function getAvatarPhotos(): Collection
4040
{

tests/Util/fixtures/add_one_to_many_relation/legacy/User_simple_orphan_removal.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function getId(): ?int
3434
}
3535

3636
/**
37-
* @return Collection|UserAvatarPhoto[]
37+
* @return Collection<int, UserAvatarPhoto>
3838
*/
3939
public function getAvatarPhotos(): Collection
4040
{

tests/Util/fixtures/add_one_to_many_relation/legacy/User_with_use_statements.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function getId(): ?int
3636
}
3737

3838
/**
39-
* @return Collection|UserAvatarPhoto[]
39+
* @return Collection<int, UserAvatarPhoto>
4040
*/
4141
public function getAvatarPhotos(): Collection
4242
{

0 commit comments

Comments
 (0)