Skip to content

Commit 30c3498

Browse files
committed
[make:*] use static return type instead of self for setters
1 parent 2e428e8 commit 30c3498

File tree

61 files changed

+111
-111
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+111
-111
lines changed

src/Util/ClassSourceManipulator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,7 @@ private function makeMethodFluent(Builder\Method $methodBuilder): void
10731073
$methodBuilder
10741074
->addStmt($this->createBlankLineNode(self::CONTEXT_CLASS_METHOD))
10751075
->addStmt(new Node\Stmt\Return_(new Node\Expr\Variable('this')));
1076-
$methodBuilder->setReturnType('self');
1076+
$methodBuilder->setReturnType('static');
10771077
}
10781078

10791079
private function isInSameNamespace(string $class): bool

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function getName(): ?string
3838
return $this->name;
3939
}
4040

41-
public function setName(string $name): self
41+
public function setName(string $name): static
4242
{
4343
$this->name = $name;
4444

@@ -50,7 +50,7 @@ public function getMagic(): ?int
5050
return $this->magic;
5151
}
5252

53-
public function setMagic(int $magic): self
53+
public function setMagic(int $magic): static
5454
{
5555
$this->magic = $magic;
5656

@@ -62,7 +62,7 @@ public function getCreator(): ?User
6262
return $this->creator;
6363
}
6464

65-
public function setCreator(?User $creator): self
65+
public function setCreator(?User $creator): static
6666
{
6767
$this->creator = $creator;
6868

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function getEmbed(): Embed
3535
return $this->embed;
3636
}
3737

38-
public function setEmbed(Embed $embed): self
38+
public function setEmbed(Embed $embed): static
3939
{
4040
$this->embed = $embed;
4141

@@ -47,7 +47,7 @@ public function getApiKey(): ?string
4747
return $this->apiKey;
4848
}
4949

50-
public function setApiKey(string $apiKey): self
50+
public function setApiKey(string $apiKey): static
5151
{
5252
$this->apiKey = $apiKey;
5353

@@ -62,7 +62,7 @@ public function getTags(): Collection
6262
return $this->tags;
6363
}
6464

65-
public function addTag(Tag $tag): self
65+
public function addTag(Tag $tag): static
6666
{
6767
if (!$this->tags->contains($tag)) {
6868
$this->tags->add($tag);
@@ -71,7 +71,7 @@ public function addTag(Tag $tag): self
7171
return $this;
7272
}
7373

74-
public function removeTag(Tag $tag): self
74+
public function removeTag(Tag $tag): static
7575
{
7676
$this->tags->removeElement($tag);
7777

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function getVal(): ?int
1616
return $this->val;
1717
}
1818

19-
public function setVal(int $val): self
19+
public function setVal(int $val): static
2020
{
2121
$this->val = $val;
2222

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function getAvatars(): Collection
5353
return $this->avatars;
5454
}
5555

56-
public function addAvatar(UserAvatar $avatar): self
56+
public function addAvatar(UserAvatar $avatar): static
5757
{
5858
if (!$this->avatars->contains($avatar)) {
5959
$this->avatars->add($avatar);
@@ -63,7 +63,7 @@ public function addAvatar(UserAvatar $avatar): self
6363
return $this;
6464
}
6565

66-
public function removeAvatar(UserAvatar $avatar): self
66+
public function removeAvatar(UserAvatar $avatar): static
6767
{
6868
if ($this->avatars->removeElement($avatar)) {
6969
// set the owning side to null (unless already changed)
@@ -88,7 +88,7 @@ public function getTags(): Collection
8888
return $this->tags;
8989
}
9090

91-
public function addTag(Tag $tag): self
91+
public function addTag(Tag $tag): static
9292
{
9393
if (!$this->tags->contains($tag)) {
9494
$this->tags->add($tag);
@@ -97,7 +97,7 @@ public function addTag(Tag $tag): self
9797
return $this;
9898
}
9999

100-
public function removeTag(Tag $tag): self
100+
public function removeTag(Tag $tag): static
101101
{
102102
$this->tags->removeElement($tag);
103103

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function getUser(): ?User
2626
return $this->user;
2727
}
2828

29-
public function setUser(?User $user): self
29+
public function setUser(?User $user): static
3030
{
3131
$this->user = $user;
3232

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function getUser(): ?User
2727
return $this->user;
2828
}
2929

30-
public function setUser(User $user): self
30+
public function setUser(User $user): static
3131
{
3232
$this->user = $user;
3333

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function getName(): ?string
3838
return $this->name;
3939
}
4040

41-
public function setName(string $name): self
41+
public function setName(string $name): static
4242
{
4343
$this->name = $name;
4444

@@ -50,7 +50,7 @@ public function getMagic(): ?int
5050
return $this->magic;
5151
}
5252

53-
public function setMagic(int $magic): self
53+
public function setMagic(int $magic): static
5454
{
5555
$this->magic = $magic;
5656

@@ -62,7 +62,7 @@ public function getCreator(): ?User
6262
return $this->creator;
6363
}
6464

65-
public function setCreator(?User $creator): self
65+
public function setCreator(?User $creator): static
6666
{
6767
$this->creator = $creator;
6868

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function getEmbed(): Embed
3535
return $this->embed;
3636
}
3737

38-
public function setEmbed(Embed $embed): self
38+
public function setEmbed(Embed $embed): static
3939
{
4040
$this->embed = $embed;
4141

@@ -47,7 +47,7 @@ public function getApiKey(): ?string
4747
return $this->apiKey;
4848
}
4949

50-
public function setApiKey(string $apiKey): self
50+
public function setApiKey(string $apiKey): static
5151
{
5252
$this->apiKey = $apiKey;
5353

@@ -62,7 +62,7 @@ public function getTags(): Collection
6262
return $this->tags;
6363
}
6464

65-
public function addTag(Tag $tag): self
65+
public function addTag(Tag $tag): static
6666
{
6767
if (!$this->tags->contains($tag)) {
6868
$this->tags->add($tag);
@@ -71,7 +71,7 @@ public function addTag(Tag $tag): self
7171
return $this;
7272
}
7373

74-
public function removeTag(Tag $tag): self
74+
public function removeTag(Tag $tag): static
7575
{
7676
$this->tags->removeElement($tag);
7777

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function getVal(): ?int
1616
return $this->val;
1717
}
1818

19-
public function setVal(int $val): self
19+
public function setVal(int $val): static
2020
{
2121
$this->val = $val;
2222

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function customMethod()
3939
return '';
4040
}
4141

42-
public function setUserProfile(?UserProfile $userProfile): self
42+
public function setUserProfile(?UserProfile $userProfile): static
4343
{
4444
// unset the owning side of the relation if necessary
4545
if ($userProfile === null && $this->userProfile !== null) {
@@ -64,7 +64,7 @@ public function getAvatars(): Collection
6464
return $this->avatars;
6565
}
6666

67-
public function addAvatar(UserAvatar $avatar): self
67+
public function addAvatar(UserAvatar $avatar): static
6868
{
6969
if (!$this->avatars->contains($avatar)) {
7070
$this->avatars->add($avatar);
@@ -74,7 +74,7 @@ public function addAvatar(UserAvatar $avatar): self
7474
return $this;
7575
}
7676

77-
public function removeAvatar(UserAvatar $avatar): self
77+
public function removeAvatar(UserAvatar $avatar): static
7878
{
7979
if ($this->avatars->removeElement($avatar)) {
8080
// set the owning side to null (unless already changed)
@@ -99,7 +99,7 @@ public function getTags(): Collection
9999
return $this->tags;
100100
}
101101

102-
public function addTag(Tag $tag): self
102+
public function addTag(Tag $tag): static
103103
{
104104
if (!$this->tags->contains($tag)) {
105105
$this->tags->add($tag);
@@ -108,7 +108,7 @@ public function addTag(Tag $tag): self
108108
return $this;
109109
}
110110

111-
public function removeTag(Tag $tag): self
111+
public function removeTag(Tag $tag): static
112112
{
113113
$this->tags->removeElement($tag);
114114

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function getUser(): ?User
2626
return $this->user;
2727
}
2828

29-
public function setUser(?User $user): self
29+
public function setUser(?User $user): static
3030
{
3131
$this->user = $user;
3232

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function getUser(): ?User
2727
return $this->user;
2828
}
2929

30-
public function setUser(User $user): self
30+
public function setUser(User $user): static
3131
{
3232
$this->user = $user;
3333

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function getUser(): ?UserXml
1818
return $this->user;
1919
}
2020

21-
public function setUser(?UserXml $user): self
21+
public function setUser(?UserXml $user): static
2222
{
2323
$this->user = $user;
2424

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function getName(): ?string
2929
return $this->name;
3030
}
3131

32-
public function setName(string $name): self
32+
public function setName(string $name): static
3333
{
3434
$this->name = $name;
3535

@@ -44,7 +44,7 @@ public function getAvatars(): Collection
4444
return $this->avatars;
4545
}
4646

47-
public function addAvatar(UserAvatar $avatar): self
47+
public function addAvatar(UserAvatar $avatar): static
4848
{
4949
if (!$this->avatars->contains($avatar)) {
5050
$this->avatars->add($avatar);
@@ -54,7 +54,7 @@ public function addAvatar(UserAvatar $avatar): self
5454
return $this;
5555
}
5656

57-
public function removeAvatar(UserAvatar $avatar): self
57+
public function removeAvatar(UserAvatar $avatar): static
5858
{
5959
if ($this->avatars->removeElement($avatar)) {
6060
// set the owning side to null (unless already changed)

tests/Security/fixtures/expected/UserEntityWithEmailAsIdentifier.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function getEmail(): ?string
3636
return $this->email;
3737
}
3838

39-
public function setEmail(string $email): self
39+
public function setEmail(string $email): static
4040
{
4141
$this->email = $email;
4242

@@ -65,7 +65,7 @@ public function getRoles(): array
6565
return array_unique($roles);
6666
}
6767

68-
public function setRoles(array $roles): self
68+
public function setRoles(array $roles): static
6969
{
7070
$this->roles = $roles;
7171

@@ -80,7 +80,7 @@ public function getPassword(): string
8080
return $this->password;
8181
}
8282

83-
public function setPassword(string $password): self
83+
public function setPassword(string $password): static
8484
{
8585
$this->password = $password;
8686

tests/Security/fixtures/expected/UserEntityWithPassword.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function getUserIdentifier(): string
4141
return (string) $this->userIdentifier;
4242
}
4343

44-
public function setUserIdentifier(string $userIdentifier): self
44+
public function setUserIdentifier(string $userIdentifier): static
4545
{
4646
$this->userIdentifier = $userIdentifier;
4747

@@ -60,7 +60,7 @@ public function getRoles(): array
6060
return array_unique($roles);
6161
}
6262

63-
public function setRoles(array $roles): self
63+
public function setRoles(array $roles): static
6464
{
6565
$this->roles = $roles;
6666

@@ -75,7 +75,7 @@ public function getPassword(): string
7575
return $this->password;
7676
}
7777

78-
public function setPassword(string $password): self
78+
public function setPassword(string $password): static
7979
{
8080
$this->password = $password;
8181

tests/Security/fixtures/expected/UserEntityWithUser_IdentifierAsIdentifier.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function getUserIdentifier(): string
4141
return (string) $this->user_identifier;
4242
}
4343

44-
public function setUserIdentifier(string $user_identifier): self
44+
public function setUserIdentifier(string $user_identifier): static
4545
{
4646
$this->user_identifier = $user_identifier;
4747

@@ -60,7 +60,7 @@ public function getRoles(): array
6060
return array_unique($roles);
6161
}
6262

63-
public function setRoles(array $roles): self
63+
public function setRoles(array $roles): static
6464
{
6565
$this->roles = $roles;
6666

@@ -75,7 +75,7 @@ public function getPassword(): string
7575
return $this->password;
7676
}
7777

78-
public function setPassword(string $password): self
78+
public function setPassword(string $password): static
7979
{
8080
$this->password = $password;
8181

0 commit comments

Comments
 (0)