Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 68a72e7

Browse files
Fix missing fluent interface for setter - Close #39
1 parent fd00676 commit 68a72e7

File tree

4 files changed

+21
-19
lines changed

4 files changed

+21
-19
lines changed

‎src/Code/ClassConstGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function getValue(): ValueGenerator
5656
return $this->value;
5757
}
5858

59-
public function generate(): \PhpParser\Node\Stmt\ClassConst
59+
public function generate(): Node\Stmt\ClassConst
6060
{
6161
return new Node\Stmt\ClassConst(
6262
[

‎src/Code/MethodGenerator.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,35 +172,35 @@ public function getDocBlockComment(): ?string
172172
return $this->docBlockComment;
173173
}
174174

175-
public function setDocBlockComment(?string $docBlockComment): void
175+
public function setDocBlockComment(?string $docBlockComment): self
176176
{
177177
$this->docBlockComment = $docBlockComment;
178+
179+
return $this;
178180
}
179181

180182
public function getReturnTypeDocBlockHint(): ?string
181183
{
182184
return $this->returnTypeDocBlockHint;
183185
}
184186

185-
public function setReturnTypeDocBlockHint(?string $typeDocBlockHint): void
187+
public function setReturnTypeDocBlockHint(?string $typeDocBlockHint): self
186188
{
187189
$this->returnTypeDocBlockHint = $typeDocBlockHint;
190+
191+
return $this;
188192
}
189193

190-
/**
191-
* @return bool
192-
*/
193194
public function getTyped(): bool
194195
{
195196
return $this->typed;
196197
}
197198

198-
/**
199-
* @param bool $typed
200-
*/
201-
public function setTyped(bool $typed): void
199+
public function setTyped(bool $typed): self
202200
{
203201
$this->typed = $typed;
202+
203+
return $this;
204204
}
205205

206206
/**

‎src/Code/ParameterGenerator.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,7 @@ public function __construct(
7777
}
7878
}
7979

80-
/**
81-
* @param string $type
82-
* @return ParameterGenerator
83-
*/
84-
public function setType($type): self
80+
public function setType(string $type): self
8581
{
8682
$this->type = TypeGenerator::fromTypeString($type);
8783

@@ -99,7 +95,7 @@ public function getType(): ?TypeGenerator
9995
*/
10096
public function setName(string $name): self
10197
{
102-
$this->name = (string) $name;
98+
$this->name = $name;
10399

104100
return $this;
105101
}
@@ -185,9 +181,11 @@ public function getTypeDocBlockHint(): ?string
185181
/**
186182
* @param string|null $typeDocBlockHint
187183
*/
188-
public function setTypeDocBlockHint(?string $typeDocBlockHint): void
184+
public function setTypeDocBlockHint(?string $typeDocBlockHint): self
189185
{
190186
$this->typeDocBlockHint = $typeDocBlockHint;
187+
188+
return $this;
191189
}
192190

193191
public function generate(): Node\Param

‎src/Code/PropertyGenerator.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,11 @@ public function getDocBlockComment(): ?string
9999
return $this->docBlockComment;
100100
}
101101

102-
public function setDocBlockComment(?string $docBlockComment): void
102+
public function setDocBlockComment(?string $docBlockComment): self
103103
{
104104
$this->docBlockComment = $docBlockComment;
105+
106+
return $this;
105107
}
106108

107109
/**
@@ -146,9 +148,11 @@ public function getTypeDocBlockHint(): ?string
146148
return $this->typeDocBlockHint;
147149
}
148150

149-
public function setTypeDocBlockHint(?string $typeDocBlockHint): void
151+
public function setTypeDocBlockHint(?string $typeDocBlockHint): self
150152
{
151153
$this->typeDocBlockHint = $typeDocBlockHint;
154+
155+
return $this;
152156
}
153157

154158
public function generate(): Property

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /