Skip to content
This repository was archived by the owner on Feb 9, 2021. It is now read-only.

Commit 07dd971

Browse files
committed
Add return self type hint for setters
1 parent 0b7c075 commit 07dd971

File tree

7 files changed

+28
-28
lines changed

7 files changed

+28
-28
lines changed

modules/openapi-generator/src/main/resources/php-symfony/model_generic.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}
3535
*
3636
* @return $this
3737
*/
38-
public function {{setter}}({{#vendorExtensions.x-parameter-type}}{{vendorExtensions.x-parameter-type}} {{/vendorExtensions.x-parameter-type}}${{name}}{{^required}} = null{{/required}})
38+
public function {{setter}}({{#vendorExtensions.x-parameter-type}}{{vendorExtensions.x-parameter-type}} {{/vendorExtensions.x-parameter-type}}${{name}}{{^required}} = null{{/required}}): self
3939
{
4040
$this->{{name}} = ${{name}};
4141

samples/server/petstore/php-symfony/SymfonyBundle-php/Model/ApiResponse.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function getCode()
9595
*
9696
* @return $this
9797
*/
98-
public function setCode($code = null)
98+
public function setCode($code = null): self
9999
{
100100
$this->code = $code;
101101

@@ -119,7 +119,7 @@ public function getType()
119119
*
120120
* @return $this
121121
*/
122-
public function setType($type = null)
122+
public function setType($type = null): self
123123
{
124124
$this->type = $type;
125125

@@ -143,7 +143,7 @@ public function getMessage()
143143
*
144144
* @return $this
145145
*/
146-
public function setMessage($message = null)
146+
public function setMessage($message = null): self
147147
{
148148
$this->message = $message;
149149

samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Category.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function getId()
8686
*
8787
* @return $this
8888
*/
89-
public function setId($id = null)
89+
public function setId($id = null): self
9090
{
9191
$this->id = $id;
9292

@@ -110,7 +110,7 @@ public function getName()
110110
*
111111
* @return $this
112112
*/
113-
public function setName($name = null)
113+
public function setName($name = null): self
114114
{
115115
$this->name = $name;
116116

samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Order.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function getId()
125125
*
126126
* @return $this
127127
*/
128-
public function setId($id = null)
128+
public function setId($id = null): self
129129
{
130130
$this->id = $id;
131131

@@ -149,7 +149,7 @@ public function getPetId()
149149
*
150150
* @return $this
151151
*/
152-
public function setPetId($petId = null)
152+
public function setPetId($petId = null): self
153153
{
154154
$this->petId = $petId;
155155

@@ -173,7 +173,7 @@ public function getQuantity()
173173
*
174174
* @return $this
175175
*/
176-
public function setQuantity($quantity = null)
176+
public function setQuantity($quantity = null): self
177177
{
178178
$this->quantity = $quantity;
179179

@@ -197,7 +197,7 @@ public function getShipDate(): ?\DateTime
197197
*
198198
* @return $this
199199
*/
200-
public function setShipDate(\DateTime $shipDate = null)
200+
public function setShipDate(\DateTime $shipDate = null): self
201201
{
202202
$this->shipDate = $shipDate;
203203

@@ -221,7 +221,7 @@ public function getStatus()
221221
*
222222
* @return $this
223223
*/
224-
public function setStatus($status = null)
224+
public function setStatus($status = null): self
225225
{
226226
$this->status = $status;
227227

@@ -245,7 +245,7 @@ public function isComplete()
245245
*
246246
* @return $this
247247
*/
248-
public function setComplete($complete = null)
248+
public function setComplete($complete = null): self
249249
{
250250
$this->complete = $complete;
251251

samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Pet.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function getId()
131131
*
132132
* @return $this
133133
*/
134-
public function setId($id = null)
134+
public function setId($id = null): self
135135
{
136136
$this->id = $id;
137137

@@ -155,7 +155,7 @@ public function getCategory(): ?Category
155155
*
156156
* @return $this
157157
*/
158-
public function setCategory(Category $category = null)
158+
public function setCategory(Category $category = null): self
159159
{
160160
$this->category = $category;
161161

@@ -179,7 +179,7 @@ public function getName()
179179
*
180180
* @return $this
181181
*/
182-
public function setName($name)
182+
public function setName($name): self
183183
{
184184
$this->name = $name;
185185

@@ -203,7 +203,7 @@ public function getPhotoUrls(): array
203203
*
204204
* @return $this
205205
*/
206-
public function setPhotoUrls(array $photoUrls)
206+
public function setPhotoUrls(array $photoUrls): self
207207
{
208208
$this->photoUrls = $photoUrls;
209209

@@ -227,7 +227,7 @@ public function getTags(): ?array
227227
*
228228
* @return $this
229229
*/
230-
public function setTags(array $tags = null)
230+
public function setTags(array $tags = null): self
231231
{
232232
$this->tags = $tags;
233233

@@ -251,7 +251,7 @@ public function getStatus()
251251
*
252252
* @return $this
253253
*/
254-
public function setStatus($status = null)
254+
public function setStatus($status = null): self
255255
{
256256
$this->status = $status;
257257

samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Tag.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function getId()
8686
*
8787
* @return $this
8888
*/
89-
public function setId($id = null)
89+
public function setId($id = null): self
9090
{
9191
$this->id = $id;
9292

@@ -110,7 +110,7 @@ public function getName()
110110
*
111111
* @return $this
112112
*/
113-
public function setName($name = null)
113+
public function setName($name = null): self
114114
{
115115
$this->name = $name;
116116

samples/server/petstore/php-symfony/SymfonyBundle-php/Model/User.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function getId()
142142
*
143143
* @return $this
144144
*/
145-
public function setId($id = null)
145+
public function setId($id = null): self
146146
{
147147
$this->id = $id;
148148

@@ -166,7 +166,7 @@ public function getUsername()
166166
*
167167
* @return $this
168168
*/
169-
public function setUsername($username = null)
169+
public function setUsername($username = null): self
170170
{
171171
$this->username = $username;
172172

@@ -190,7 +190,7 @@ public function getFirstName()
190190
*
191191
* @return $this
192192
*/
193-
public function setFirstName($firstName = null)
193+
public function setFirstName($firstName = null): self
194194
{
195195
$this->firstName = $firstName;
196196

@@ -214,7 +214,7 @@ public function getLastName()
214214
*
215215
* @return $this
216216
*/
217-
public function setLastName($lastName = null)
217+
public function setLastName($lastName = null): self
218218
{
219219
$this->lastName = $lastName;
220220

@@ -238,7 +238,7 @@ public function getEmail()
238238
*
239239
* @return $this
240240
*/
241-
public function setEmail($email = null)
241+
public function setEmail($email = null): self
242242
{
243243
$this->email = $email;
244244

@@ -262,7 +262,7 @@ public function getPassword()
262262
*
263263
* @return $this
264264
*/
265-
public function setPassword($password = null)
265+
public function setPassword($password = null): self
266266
{
267267
$this->password = $password;
268268

@@ -286,7 +286,7 @@ public function getPhone()
286286
*
287287
* @return $this
288288
*/
289-
public function setPhone($phone = null)
289+
public function setPhone($phone = null): self
290290
{
291291
$this->phone = $phone;
292292

@@ -310,7 +310,7 @@ public function getUserStatus()
310310
*
311311
* @return $this
312312
*/
313-
public function setUserStatus($userStatus = null)
313+
public function setUserStatus($userStatus = null): self
314314
{
315315
$this->userStatus = $userStatus;
316316

0 commit comments

Comments
 (0)