From 71920b8ce88605613e3d796b8da72f0ceee831fd Mon Sep 17 00:00:00 2001 From: Masaki Kawaguchi Date: Fri, 22 Nov 2024 23:18:30 +0900 Subject: [PATCH 1/3] matrix php build --- .github/workflows/samples-php8.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/samples-php8.yaml b/.github/workflows/samples-php8.yaml index 0d2941f6e3ce..e1aca18ea87b 100644 --- a/.github/workflows/samples-php8.yaml +++ b/.github/workflows/samples-php8.yaml @@ -16,6 +16,10 @@ jobs: strategy: fail-fast: false matrix: + php: + - "8.1" + - "8.2" + - "8.3" sample: # servers - samples/server/petstore/php-symfony/SymfonyBundle-php/ @@ -25,7 +29,7 @@ jobs: - name: Setup PHP with tools uses: shivammathur/setup-php@v2 with: - php-version: '8.1' + php-version: "${{ matrix.php }}" tools: php-cs-fixer, phpunit - name: composer install working-directory: ${{ matrix.sample }} From 6c8b05a2aa1f55ad56a4e8fd204a0797043bf102 Mon Sep 17 00:00:00 2001 From: Masaki Kawaguchi Date: Fri, 22 Nov 2024 23:23:26 +0900 Subject: [PATCH 2/3] NullableTypeForNullDefaultValue --- .../src/main/resources/php-symfony/Controller.mustache | 2 +- .../src/main/resources/php-symfony/model_generic.mustache | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/php-symfony/Controller.mustache b/modules/openapi-generator/src/main/resources/php-symfony/Controller.mustache index 455b5586ef7a..023b66c90f7d 100644 --- a/modules/openapi-generator/src/main/resources/php-symfony/Controller.mustache +++ b/modules/openapi-generator/src/main/resources/php-symfony/Controller.mustache @@ -151,7 +151,7 @@ class Controller extends AbstractController * * @return array|null */ - private function exceptionToArray(\Throwable $exception = null): ?array + private function exceptionToArray(?\Throwable $exception = null): ?array { if (null === $exception) { return null; diff --git a/modules/openapi-generator/src/main/resources/php-symfony/model_generic.mustache b/modules/openapi-generator/src/main/resources/php-symfony/model_generic.mustache index 962a4cdb2d59..d992f8fb1933 100644 --- a/modules/openapi-generator/src/main/resources/php-symfony/model_generic.mustache +++ b/modules/openapi-generator/src/main/resources/php-symfony/model_generic.mustache @@ -6,7 +6,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}} * Constructor * @param array|null $data Associated array of property values initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { {{#parentSchema}} parent::__construct($data); From fbf73b19e5292cb5f2522482dea427245d989b51 Mon Sep 17 00:00:00 2001 From: Masaki Kawaguchi Date: Sat, 23 Nov 2024 00:09:40 +0900 Subject: [PATCH 3/3] update sample --- .../php-symfony/SymfonyBundle-php/Controller/Controller.php | 2 +- .../php-symfony/SymfonyBundle-php/Model/ApiResponse.php | 2 +- .../petstore/php-symfony/SymfonyBundle-php/Model/Category.php | 2 +- .../petstore/php-symfony/SymfonyBundle-php/Model/Order.php | 2 +- .../server/petstore/php-symfony/SymfonyBundle-php/Model/Pet.php | 2 +- .../server/petstore/php-symfony/SymfonyBundle-php/Model/Tag.php | 2 +- .../petstore/php-symfony/SymfonyBundle-php/Model/User.php | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/Controller.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/Controller.php index abaf02d5b8c5..e21a2f138131 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/Controller.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/Controller.php @@ -161,7 +161,7 @@ protected function validate($data, $asserts = null): ?Response * * @return array|null */ - private function exceptionToArray(\Throwable $exception = null): ?array + private function exceptionToArray(?\Throwable $exception = null): ?array { if (null === $exception) { return null; diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/ApiResponse.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/ApiResponse.php index e7c2de6ce033..0ac640c06647 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/ApiResponse.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/ApiResponse.php @@ -73,7 +73,7 @@ class ApiResponse * Constructor * @param array|null $data Associated array of property values initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { if (is_array($data)) { $this->code = array_key_exists('code', $data) ? $data['code'] : $this->code; diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Category.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Category.php index fc827e4ae735..1debfbf9c160 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Category.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Category.php @@ -66,7 +66,7 @@ class Category * Constructor * @param array|null $data Associated array of property values initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { if (is_array($data)) { $this->id = array_key_exists('id', $data) ? $data['id'] : $this->id; diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Order.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Order.php index 2aa65aa47a76..47ee65e211cf 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Order.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Order.php @@ -100,7 +100,7 @@ class Order * Constructor * @param array|null $data Associated array of property values initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { if (is_array($data)) { $this->id = array_key_exists('id', $data) ? $data['id'] : $this->id; diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Pet.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Pet.php index 5f229ab6bb12..299b55f603ec 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Pet.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Pet.php @@ -106,7 +106,7 @@ class Pet * Constructor * @param array|null $data Associated array of property values initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { if (is_array($data)) { $this->id = array_key_exists('id', $data) ? $data['id'] : $this->id; diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Tag.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Tag.php index 7d669ab9bb07..f42c3e2bceb3 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Tag.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Tag.php @@ -65,7 +65,7 @@ class Tag * Constructor * @param array|null $data Associated array of property values initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { if (is_array($data)) { $this->id = array_key_exists('id', $data) ? $data['id'] : $this->id; diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/User.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/User.php index b15d7fef65d8..aec38c6a73ef 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/User.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/User.php @@ -115,7 +115,7 @@ class User * Constructor * @param array|null $data Associated array of property values initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { if (is_array($data)) { $this->id = array_key_exists('id', $data) ? $data['id'] : $this->id;