Skip to content

Commit be17698

Browse files
authored
[php-flight] fix: remove trailing spaces (#21254)
According to the Guidelines for Contributing (https://github.com/OpenAPITools/openapi-generator/blob/master/CONTRIBUTING.md) generated PHP code should conform to PSR-12 (https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-12-extended-coding-style-guide.md). There are some minor violations regarding the following rule > There MUST NOT be trailing whitespace at the end of lines. This change removes trailing spaces in generated code.
1 parent 2fd1ee6 commit be17698

File tree

13 files changed

+86
-86
lines changed

13 files changed

+86
-86
lines changed

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,31 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}} impl
2121
return new self(
2222
{{#vars}}
2323
{{#isDateTime}}
24-
isset($data['{{baseName}}']) ? new \DateTime($data['{{baseName}}']) : null{{^last}}, {{/last}}
24+
isset($data['{{baseName}}']) ? new \DateTime($data['{{baseName}}']) : null{{^last}},{{/last}}
2525
{{/isDateTime}}
2626
{{#isEnum}}
27-
isset($data['{{baseName}}']) ? {{enumName}}::tryFrom($data['{{baseName}}']) : null{{^last}}, {{/last}}
27+
isset($data['{{baseName}}']) ? {{enumName}}::tryFrom($data['{{baseName}}']) : null{{^last}},{{/last}}
2828
{{/isEnum}}
2929
{{#isEnumRef}}
30-
isset($data['{{baseName}}']) ? {{complexType}}::tryFrom($data['{{baseName}}']) : null{{^last}}, {{/last}}
30+
isset($data['{{baseName}}']) ? {{complexType}}::tryFrom($data['{{baseName}}']) : null{{^last}},{{/last}}
3131
{{/isEnumRef}}
3232
{{#isModel}}
33-
isset($data['{{baseName}}']) ? {{complexType}}::fromArray($data['{{baseName}}']) : null{{^last}}, {{/last}}
33+
isset($data['{{baseName}}']) ? {{complexType}}::fromArray($data['{{baseName}}']) : null{{^last}},{{/last}}
3434
{{/isModel}}
3535
{{#isArray}}
3636
{{#items.isEnumRef}}
37-
isset($data['{{baseName}}']) ? array_map(fn($item) => {{items.complexType}}::tryFrom($item), $data['{{baseName}}']) : null{{^last}}, {{/last}}
37+
isset($data['{{baseName}}']) ? array_map(fn($item) => {{items.complexType}}::tryFrom($item), $data['{{baseName}}']) : null{{^last}},{{/last}}
3838
{{/items.isEnumRef}}
3939
{{#items.isModel}}
40-
isset($data['{{baseName}}']) ? array_map(fn($item) => {{items.complexType}}::fromArray($item), $data['{{baseName}}']) : null{{^last}}, {{/last}}
40+
isset($data['{{baseName}}']) ? array_map(fn($item) => {{items.complexType}}::fromArray($item), $data['{{baseName}}']) : null{{^last}},{{/last}}
4141
{{/items.isModel}}
4242
{{#items.isDateTime}}
43-
isset($data['{{baseName}}']) ? array_map(fn($item) => new \DateTime($item), $data['{{baseName}}']) : null{{^last}}, {{/last}}
43+
isset($data['{{baseName}}']) ? array_map(fn($item) => new \DateTime($item), $data['{{baseName}}']) : null{{^last}},{{/last}}
4444
{{/items.isDateTime}}
4545
{{^items.isEnumRef}}
4646
{{^items.isModel}}
4747
{{^items.isDateTime}}
48-
$data['{{baseName}}'] ?? null{{^last}}, {{/last}}
48+
$data['{{baseName}}'] ?? null{{^last}},{{/last}}
4949
{{/items.isDateTime}}
5050
{{/items.isModel}}
5151
{{/items.isEnumRef}}
@@ -55,7 +55,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}} impl
5555
{{^isModel}}
5656
{{^isArray}}
5757
{{^isDateTime}}
58-
$data['{{baseName}}'] ?? null{{^last}}, {{/last}}
58+
$data['{{baseName}}'] ?? null{{^last}},{{/last}}
5959
{{/isDateTime}}
6060
{{/isArray}}
6161
{{/isModel}}
@@ -69,19 +69,19 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}} impl
6969
return [
7070
{{#vars}}
7171
{{#isDateTime}}
72-
'{{baseName}}' => $this->{{name}}?->format('c'){{^last}}, {{/last}}
72+
'{{baseName}}' => $this->{{name}}?->format('c'){{^last}},{{/last}}
7373
{{/isDateTime}}
7474
{{#isArray}}
7575
{{#items.isDateTime}}
76-
'{{baseName}}' => $this->{{name}} ? array_map(fn($item) => $item->format('c'), $this->{{name}}) : null{{^last}}, {{/last}}
76+
'{{baseName}}' => $this->{{name}} ? array_map(fn($item) => $item->format('c'), $this->{{name}}) : null{{^last}},{{/last}}
7777
{{/items.isDateTime}}
7878
{{^items.isDateTime}}
79-
'{{baseName}}' => $this->{{name}}{{^last}}, {{/last}}
79+
'{{baseName}}' => $this->{{name}}{{^last}},{{/last}}
8080
{{/items.isDateTime}}
8181
{{/isArray}}
8282
{{^isDateTime}}
8383
{{^isArray}}
84-
'{{baseName}}' => $this->{{name}}{{^last}}, {{/last}}
84+
'{{baseName}}' => $this->{{name}}{{^last}},{{/last}}
8585
{{/isArray}}
8686
{{/isDateTime}}
8787
{{/vars}}

modules/openapi-generator/src/main/resources/php-flight/partial_header.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* {{{.}}}
88
*
99
{{/appDescription}}
10-
* {{#version}}The version of the OpenAPI document: {{{.}}}{{/version}}
11-
* {{#infoEmail}}Contact: {{{.}}}{{/infoEmail}}
10+
*{{#version}} The version of the OpenAPI document: {{{.}}}{{/version}}
11+
*{{#infoEmail}} Contact: {{{.}}}{{/infoEmail}}
1212
* Generated by: https://github.com/openapitools/openapi-generator.git
1313
*
1414
*/

modules/openapi-generator/src/main/resources/php-flight/register_routes.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class RegisterRoutes {
2222
$r = \Flight::request();
2323
{{^vendorExtensions.x-return-type-is-void}}$result = {{/vendorExtensions.x-return-type-is-void}}$handler->{{operationId}}(
2424
{{#vendorExtensions.x-nonFormParams}}
25-
parseParam({{#isBodyParam}}json_decode($r->getBody(), true){{/isBodyParam}}{{#isQueryParam}}$r->query['{{baseName}}'] ?? null{{/isQueryParam}}{{#isPathParam}}${{paramName}}{{/isPathParam}}{{#isHeaderParam}}$r->getHeader('{{baseName}}'){{/isHeaderParam}}, '{{vendorExtensions.x-comment-type-escaped}}'){{^-last}}, {{/-last}}
25+
parseParam({{#isBodyParam}}json_decode($r->getBody(), true){{/isBodyParam}}{{#isQueryParam}}$r->query['{{baseName}}'] ?? null{{/isQueryParam}}{{#isPathParam}}${{paramName}}{{/isPathParam}}{{#isHeaderParam}}$r->getHeader('{{baseName}}'){{/isHeaderParam}}, '{{vendorExtensions.x-comment-type-escaped}}'){{^-last}},{{/-last}}
2626
{{/vendorExtensions.x-nonFormParams}}
2727
);
2828
{{^vendorExtensions.x-return-type-is-void}}
@@ -42,7 +42,7 @@ class RegisterRoutes {
4242
$r = \Flight::request();
4343
$handler->{{operationId}}Stream(
4444
{{#vendorExtensions.x-nonFormParams}}
45-
parseParam({{#isBodyParam}}json_decode($r->getBody(), true){{/isBodyParam}}{{#isQueryParam}}$r->query['{{baseName}}'] ?? null{{/isQueryParam}}{{#isPathParam}}${{paramName}}{{/isPathParam}}{{#isHeaderParam}}$r->getHeader('{{baseName}}'){{/isHeaderParam}}, '{{vendorExtensions.x-comment-type-escaped}}'){{^-last}}, {{/-last}}
45+
parseParam({{#isBodyParam}}json_decode($r->getBody(), true){{/isBodyParam}}{{#isQueryParam}}$r->query['{{baseName}}'] ?? null{{/isQueryParam}}{{#isPathParam}}${{paramName}}{{/isPathParam}}{{#isHeaderParam}}$r->getHeader('{{baseName}}'){{/isHeaderParam}}, '{{vendorExtensions.x-comment-type-escaped}}'){{^-last}},{{/-last}}
4646
{{/vendorExtensions.x-nonFormParams}}
4747
);
4848
// ignore return value: streaming expected

samples/server/petstore/php-flight/Model/ApiResponse.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
1717
*
1818
* The version of the OpenAPI document: 1.0.0
19-
*
19+
*
2020
* Generated by: https://github.com/openapitools/openapi-generator.git
2121
*
2222
*/
@@ -76,17 +76,17 @@ public function __construct(?int $code, ?string $type, ?string $message)
7676
public static function fromArray(array $data): self
7777
{
7878
return new self(
79-
$data['code'] ?? null,
80-
$data['type'] ?? null,
81-
$data['message'] ?? null,
79+
$data['code'] ?? null,
80+
$data['type'] ?? null,
81+
$data['message'] ?? null,
8282
);
8383
}
8484

8585
public function jsonSerialize(): mixed {
8686
return [
87-
'code' => $this->code,
88-
'type' => $this->type,
89-
'message' => $this->message,
87+
'code' => $this->code,
88+
'type' => $this->type,
89+
'message' => $this->message,
9090
];
9191
}
9292
}

samples/server/petstore/php-flight/Model/Category.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
1717
*
1818
* The version of the OpenAPI document: 1.0.0
19-
*
19+
*
2020
* Generated by: https://github.com/openapitools/openapi-generator.git
2121
*
2222
*/
@@ -67,15 +67,15 @@ public function __construct(?int $id, ?string $name)
6767
public static function fromArray(array $data): self
6868
{
6969
return new self(
70-
$data['id'] ?? null,
71-
$data['name'] ?? null,
70+
$data['id'] ?? null,
71+
$data['name'] ?? null,
7272
);
7373
}
7474

7575
public function jsonSerialize(): mixed {
7676
return [
77-
'id' => $this->id,
78-
'name' => $this->name,
77+
'id' => $this->id,
78+
'name' => $this->name,
7979
];
8080
}
8181
}

samples/server/petstore/php-flight/Model/FindPetsByStatusStatusParameterInner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
1717
*
1818
* The version of the OpenAPI document: 1.0.0
19-
*
19+
*
2020
* Generated by: https://github.com/openapitools/openapi-generator.git
2121
*
2222
*/

samples/server/petstore/php-flight/Model/Order.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
1717
*
1818
* The version of the OpenAPI document: 1.0.0
19-
*
19+
*
2020
* Generated by: https://github.com/openapitools/openapi-generator.git
2121
*
2222
*/
@@ -106,23 +106,23 @@ public function __construct(?int $id, ?int $petId, ?int $quantity, ?\DateTime $s
106106
public static function fromArray(array $data): self
107107
{
108108
return new self(
109-
$data['id'] ?? null,
110-
$data['petId'] ?? null,
111-
$data['quantity'] ?? null,
112-
isset($data['shipDate']) ? new \DateTime($data['shipDate']) : null,
113-
isset($data['status']) ? OrderStatus::tryFrom($data['status']) : null,
114-
$data['complete'] ?? null,
109+
$data['id'] ?? null,
110+
$data['petId'] ?? null,
111+
$data['quantity'] ?? null,
112+
isset($data['shipDate']) ? new \DateTime($data['shipDate']) : null,
113+
isset($data['status']) ? OrderStatus::tryFrom($data['status']) : null,
114+
$data['complete'] ?? null,
115115
);
116116
}
117117

118118
public function jsonSerialize(): mixed {
119119
return [
120-
'id' => $this->id,
121-
'petId' => $this->petId,
122-
'quantity' => $this->quantity,
123-
'shipDate' => $this->shipDate?->format('c'),
124-
'status' => $this->status,
125-
'complete' => $this->complete,
120+
'id' => $this->id,
121+
'petId' => $this->petId,
122+
'quantity' => $this->quantity,
123+
'shipDate' => $this->shipDate?->format('c'),
124+
'status' => $this->status,
125+
'complete' => $this->complete,
126126
];
127127
}
128128
}

samples/server/petstore/php-flight/Model/OrderStatus.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
1717
*
1818
* The version of the OpenAPI document: 1.0.0
19-
*
19+
*
2020
* Generated by: https://github.com/openapitools/openapi-generator.git
2121
*
2222
*/

samples/server/petstore/php-flight/Model/Pet.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
1717
*
1818
* The version of the OpenAPI document: 1.0.0
19-
*
19+
*
2020
* Generated by: https://github.com/openapitools/openapi-generator.git
2121
*
2222
*/
@@ -112,23 +112,23 @@ public function __construct(?int $id, ?Category $category, string $name, array $
112112
public static function fromArray(array $data): self
113113
{
114114
return new self(
115-
$data['id'] ?? null,
116-
isset($data['category']) ? Category::fromArray($data['category']) : null,
117-
$data['name'] ?? null,
118-
$data['photoUrls'] ?? null,
119-
isset($data['tags']) ? array_map(fn($item) => Tag::fromArray($item), $data['tags']) : null,
120-
isset($data['status']) ? PetStatus::tryFrom($data['status']) : null,
115+
$data['id'] ?? null,
116+
isset($data['category']) ? Category::fromArray($data['category']) : null,
117+
$data['name'] ?? null,
118+
$data['photoUrls'] ?? null,
119+
isset($data['tags']) ? array_map(fn($item) => Tag::fromArray($item), $data['tags']) : null,
120+
isset($data['status']) ? PetStatus::tryFrom($data['status']) : null,
121121
);
122122
}
123123

124124
public function jsonSerialize(): mixed {
125125
return [
126-
'id' => $this->id,
127-
'category' => $this->category,
128-
'name' => $this->name,
129-
'photoUrls' => $this->photoUrls,
130-
'tags' => $this->tags,
131-
'status' => $this->status,
126+
'id' => $this->id,
127+
'category' => $this->category,
128+
'name' => $this->name,
129+
'photoUrls' => $this->photoUrls,
130+
'tags' => $this->tags,
131+
'status' => $this->status,
132132
];
133133
}
134134
}

samples/server/petstore/php-flight/Model/PetStatus.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
1717
*
1818
* The version of the OpenAPI document: 1.0.0
19-
*
19+
*
2020
* Generated by: https://github.com/openapitools/openapi-generator.git
2121
*
2222
*/

samples/server/petstore/php-flight/Model/Tag.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
1717
*
1818
* The version of the OpenAPI document: 1.0.0
19-
*
19+
*
2020
* Generated by: https://github.com/openapitools/openapi-generator.git
2121
*
2222
*/
@@ -66,15 +66,15 @@ public function __construct(?int $id, ?string $name)
6666
public static function fromArray(array $data): self
6767
{
6868
return new self(
69-
$data['id'] ?? null,
70-
$data['name'] ?? null,
69+
$data['id'] ?? null,
70+
$data['name'] ?? null,
7171
);
7272
}
7373

7474
public function jsonSerialize(): mixed {
7575
return [
76-
'id' => $this->id,
77-
'name' => $this->name,
76+
'id' => $this->id,
77+
'name' => $this->name,
7878
];
7979
}
8080
}

samples/server/petstore/php-flight/Model/User.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
1717
*
1818
* The version of the OpenAPI document: 1.0.0
19-
*
19+
*
2020
* Generated by: https://github.com/openapitools/openapi-generator.git
2121
*
2222
*/
@@ -128,27 +128,27 @@ public function __construct(?int $id, ?string $username, ?string $firstName, ?st
128128
public static function fromArray(array $data): self
129129
{
130130
return new self(
131-
$data['id'] ?? null,
132-
$data['username'] ?? null,
133-
$data['firstName'] ?? null,
134-
$data['lastName'] ?? null,
135-
$data['email'] ?? null,
136-
$data['password'] ?? null,
137-
$data['phone'] ?? null,
138-
$data['userStatus'] ?? null,
131+
$data['id'] ?? null,
132+
$data['username'] ?? null,
133+
$data['firstName'] ?? null,
134+
$data['lastName'] ?? null,
135+
$data['email'] ?? null,
136+
$data['password'] ?? null,
137+
$data['phone'] ?? null,
138+
$data['userStatus'] ?? null,
139139
);
140140
}
141141

142142
public function jsonSerialize(): mixed {
143143
return [
144-
'id' => $this->id,
145-
'username' => $this->username,
146-
'firstName' => $this->firstName,
147-
'lastName' => $this->lastName,
148-
'email' => $this->email,
149-
'password' => $this->password,
150-
'phone' => $this->phone,
151-
'userStatus' => $this->userStatus,
144+
'id' => $this->id,
145+
'username' => $this->username,
146+
'firstName' => $this->firstName,
147+
'lastName' => $this->lastName,
148+
'email' => $this->email,
149+
'password' => $this->password,
150+
'phone' => $this->phone,
151+
'userStatus' => $this->userStatus,
152152
];
153153
}
154154
}

0 commit comments

Comments
 (0)