[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.
This commit is contained in:
Jonas Renggli 2025-05-11 16:32:27 +02:00 committed by GitHub
parent 2fd1ee66cc
commit be17698320
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 86 additions and 86 deletions

View File

@ -21,31 +21,31 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}} impl
return new self(
{{#vars}}
{{#isDateTime}}
isset($data['{{baseName}}']) ? new \DateTime($data['{{baseName}}']) : null{{^last}}, {{/last}}
isset($data['{{baseName}}']) ? new \DateTime($data['{{baseName}}']) : null{{^last}},{{/last}}
{{/isDateTime}}
{{#isEnum}}
isset($data['{{baseName}}']) ? {{enumName}}::tryFrom($data['{{baseName}}']) : null{{^last}}, {{/last}}
isset($data['{{baseName}}']) ? {{enumName}}::tryFrom($data['{{baseName}}']) : null{{^last}},{{/last}}
{{/isEnum}}
{{#isEnumRef}}
isset($data['{{baseName}}']) ? {{complexType}}::tryFrom($data['{{baseName}}']) : null{{^last}}, {{/last}}
isset($data['{{baseName}}']) ? {{complexType}}::tryFrom($data['{{baseName}}']) : null{{^last}},{{/last}}
{{/isEnumRef}}
{{#isModel}}
isset($data['{{baseName}}']) ? {{complexType}}::fromArray($data['{{baseName}}']) : null{{^last}}, {{/last}}
isset($data['{{baseName}}']) ? {{complexType}}::fromArray($data['{{baseName}}']) : null{{^last}},{{/last}}
{{/isModel}}
{{#isArray}}
{{#items.isEnumRef}}
isset($data['{{baseName}}']) ? array_map(fn($item) => {{items.complexType}}::tryFrom($item), $data['{{baseName}}']) : null{{^last}}, {{/last}}
isset($data['{{baseName}}']) ? array_map(fn($item) => {{items.complexType}}::tryFrom($item), $data['{{baseName}}']) : null{{^last}},{{/last}}
{{/items.isEnumRef}}
{{#items.isModel}}
isset($data['{{baseName}}']) ? array_map(fn($item) => {{items.complexType}}::fromArray($item), $data['{{baseName}}']) : null{{^last}}, {{/last}}
isset($data['{{baseName}}']) ? array_map(fn($item) => {{items.complexType}}::fromArray($item), $data['{{baseName}}']) : null{{^last}},{{/last}}
{{/items.isModel}}
{{#items.isDateTime}}
isset($data['{{baseName}}']) ? array_map(fn($item) => new \DateTime($item), $data['{{baseName}}']) : null{{^last}}, {{/last}}
isset($data['{{baseName}}']) ? array_map(fn($item) => new \DateTime($item), $data['{{baseName}}']) : null{{^last}},{{/last}}
{{/items.isDateTime}}
{{^items.isEnumRef}}
{{^items.isModel}}
{{^items.isDateTime}}
$data['{{baseName}}'] ?? null{{^last}}, {{/last}}
$data['{{baseName}}'] ?? null{{^last}},{{/last}}
{{/items.isDateTime}}
{{/items.isModel}}
{{/items.isEnumRef}}
@ -55,7 +55,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}} impl
{{^isModel}}
{{^isArray}}
{{^isDateTime}}
$data['{{baseName}}'] ?? null{{^last}}, {{/last}}
$data['{{baseName}}'] ?? null{{^last}},{{/last}}
{{/isDateTime}}
{{/isArray}}
{{/isModel}}
@ -69,19 +69,19 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}} impl
return [
{{#vars}}
{{#isDateTime}}
'{{baseName}}' => $this->{{name}}?->format('c'){{^last}}, {{/last}}
'{{baseName}}' => $this->{{name}}?->format('c'){{^last}},{{/last}}
{{/isDateTime}}
{{#isArray}}
{{#items.isDateTime}}
'{{baseName}}' => $this->{{name}} ? array_map(fn($item) => $item->format('c'), $this->{{name}}) : null{{^last}}, {{/last}}
'{{baseName}}' => $this->{{name}} ? array_map(fn($item) => $item->format('c'), $this->{{name}}) : null{{^last}},{{/last}}
{{/items.isDateTime}}
{{^items.isDateTime}}
'{{baseName}}' => $this->{{name}}{{^last}}, {{/last}}
'{{baseName}}' => $this->{{name}}{{^last}},{{/last}}
{{/items.isDateTime}}
{{/isArray}}
{{^isDateTime}}
{{^isArray}}
'{{baseName}}' => $this->{{name}}{{^last}}, {{/last}}
'{{baseName}}' => $this->{{name}}{{^last}},{{/last}}
{{/isArray}}
{{/isDateTime}}
{{/vars}}

View File

@ -7,8 +7,8 @@
* {{{.}}}
*
{{/appDescription}}
* {{#version}}The version of the OpenAPI document: {{{.}}}{{/version}}
* {{#infoEmail}}Contact: {{{.}}}{{/infoEmail}}
*{{#version}} The version of the OpenAPI document: {{{.}}}{{/version}}
*{{#infoEmail}} Contact: {{{.}}}{{/infoEmail}}
* Generated by: https://github.com/openapitools/openapi-generator.git
*
*/

View File

@ -22,7 +22,7 @@ class RegisterRoutes {
$r = \Flight::request();
{{^vendorExtensions.x-return-type-is-void}}$result = {{/vendorExtensions.x-return-type-is-void}}$handler->{{operationId}}(
{{#vendorExtensions.x-nonFormParams}}
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}}
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}}
{{/vendorExtensions.x-nonFormParams}}
);
{{^vendorExtensions.x-return-type-is-void}}
@ -42,7 +42,7 @@ class RegisterRoutes {
$r = \Flight::request();
$handler->{{operationId}}Stream(
{{#vendorExtensions.x-nonFormParams}}
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}}
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}}
{{/vendorExtensions.x-nonFormParams}}
);
// ignore return value: streaming expected