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 b74fa68699caa..455b5586ef7ac 100644 --- a/modules/openapi-generator/src/main/resources/php-symfony/Controller.mustache +++ b/modules/openapi-generator/src/main/resources/php-symfony/Controller.mustache @@ -92,7 +92,7 @@ class Controller extends AbstractController $json = $this->exceptionToArray($exception); $json['statusCode'] = $statusCode; - return new Response(json_encode($json, 15, 512), $statusCode, $headers); + return new Response(json_encode($json, 15), $statusCode, $headers); } /** @@ -219,7 +219,7 @@ class Controller extends AbstractController public static function isContentTypeAllowed(Request $request, array $consumes = []): bool { if (!empty($consumes) && $consumes[0] !== '*/*') { - $currentFormat = $request->getContentType(); + $currentFormat = $request->getContentTypeFormat(); foreach ($consumes as $mimeType) { // canonize mime type if (is_string($mimeType) && false !== $pos = strpos($mimeType, ';')) { @@ -230,7 +230,7 @@ class Controller extends AbstractController // add custom format to request $format = $mimeType; $request->setFormat($format, $format); - $currentFormat = $request->getContentType(); + $currentFormat = $request->getContentTypeFormat(); } if ($format === $currentFormat) { diff --git a/modules/openapi-generator/src/main/resources/php-symfony/api_controller.mustache b/modules/openapi-generator/src/main/resources/php-symfony/api_controller.mustache index 7153742677137..9dd5c4ef18ab4 100644 --- a/modules/openapi-generator/src/main/resources/php-symfony/api_controller.mustache +++ b/modules/openapi-generator/src/main/resources/php-symfony/api_controller.mustache @@ -101,6 +101,10 @@ class {{controllerName}} extends Controller // HTTP basic authentication required $security{{name}} = $request->headers->get('authorization'); {{/isBasicBasic}} + {{#isBasicBearer}} + // HTTP bearer authentication required + $security{{name}} = $request->headers->get('authorization'); + {{/isBasicBearer}} {{#isOAuth}} // Oauth required $security{{name}} = $request->headers->get('authorization'); @@ -148,7 +152,7 @@ class {{controllerName}} extends Controller {{#allParams}} {{^isFile}} {{#isBodyParam}} - $inputFormat = $request->getMimeType($request->getContentType()); + $inputFormat = $request->getMimeType($request->getContentTypeFormat()); ${{paramName}} = $this->deserialize(${{paramName}}, '{{#isContainer}}{{#items}}array<{{dataType}}>{{/items}}{{/isContainer}}{{^isContainer}}{{#isEnumRef}}\{{modelPackage}}\{{dataType}}{{/isEnumRef}}{{^isEnumRef}}{{dataType}}{{/isEnumRef}}{{/isContainer}}', $inputFormat); {{/isBodyParam}} {{^isBodyParam}} @@ -178,17 +182,12 @@ class {{controllerName}} extends Controller {{#returnType}}$result = {{/returnType}}$handler->{{operationId}}({{#allParams}}${{paramName}}, {{/allParams}}$responseCode, $responseHeaders); - // Find default response message - $message = '{{#responses}}{{#isDefault}}{{message}}{{/isDefault}}{{/responses}}'; - - // Find a more specific message, if available - switch ($responseCode) { + $message = match($responseCode) { {{#responses}} - case {{code}}: - $message = '{{message}}'; - break; + {{code}} => '{{message}}', {{/responses}} - } + default => '{{#responses}}{{#isDefault}}{{message}}{{/isDefault}}{{/responses}}', + }; return new Response( {{#returnType}}$result !== null ?$this->serialize($result, $responseFormat):''{{/returnType}}{{^returnType}}''{{/returnType}}, diff --git a/modules/openapi-generator/src/main/resources/php-symfony/composer.mustache b/modules/openapi-generator/src/main/resources/php-symfony/composer.mustache index 2e66acfed8dd2..026bd4fb3acbd 100644 --- a/modules/openapi-generator/src/main/resources/php-symfony/composer.mustache +++ b/modules/openapi-generator/src/main/resources/php-symfony/composer.mustache @@ -24,19 +24,19 @@ } ], "require": { - "php": ">=7.4.0|>=8.0.2", + "php": ">=8.1", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", - "symfony/validator": "^5.0|^6.0", - "jms/serializer-bundle": "^4.0", - "symfony/framework-bundle": "^5.0|^6.0" + "symfony/validator": "^6.4|^7.0", + "jms/serializer-bundle": "^5.4", + "symfony/framework-bundle": "^6.4|^7.0" }, "require-dev": { - "phpunit/phpunit": "^9.5", - "friendsofphp/php-cs-fixer": "^2.16.3", - "symfony/browser-kit": "^5.0|^6.0", - "symfony/yaml": "^5.0|^6.0", + "phpunit/phpunit": "^10.5|^11.0", + "friendsofphp/php-cs-fixer": "*", + "symfony/browser-kit": "^6.4|7.0", + "symfony/yaml": "^6.4|^7.0", "hoa/regex": "~1.0" }, "autoload": { diff --git a/modules/openapi-generator/src/main/resources/php-symfony/serialization/JmsSerializer.mustache b/modules/openapi-generator/src/main/resources/php-symfony/serialization/JmsSerializer.mustache index 62f167951e1ed..e5ff50c3f7fe5 100644 --- a/modules/openapi-generator/src/main/resources/php-symfony/serialization/JmsSerializer.mustache +++ b/modules/openapi-generator/src/main/resources/php-symfony/serialization/JmsSerializer.mustache @@ -47,14 +47,11 @@ class JmsSerializer implements SerializerInterface private function convertFormat(string $format): ?string { - switch ($format) { - case 'application/json': - return 'json'; - case 'application/xml': - return 'xml'; - } - - return null; + return match($format) { + 'application/json' => 'json', + 'application/xml' => 'xml', + default => null, + }; } private function deserializeString($data, string $type) @@ -132,22 +129,13 @@ class JmsSerializer implements SerializerInterface } // Parse the string using the correct separator - switch ($format) { - case 'csv': - $data = explode(',', $data); - break; - case 'ssv': - $data = explode(' ', $data); - break; - case 'tsv': - $data = explode("\t", $data); - break; - case 'pipes': - $data = explode('|', $data); - break; - default; - $data = []; - } + $data = match($format) { + 'csv' => explode(',', $data), + 'ssv' => explode(' ', $data), + 'tsv' => explode("\t", $data), + 'pipes' => explode('|', $data), + default => [], + }; // Deserialize each of the array elements foreach ($data as $key => $item) { diff --git a/modules/openapi-generator/src/main/resources/php-symfony/testing/ControllerTest.mustache b/modules/openapi-generator/src/main/resources/php-symfony/testing/ControllerTest.mustache index e4d5039db8463..ac285dd0fca8a 100644 --- a/modules/openapi-generator/src/main/resources/php-symfony/testing/ControllerTest.mustache +++ b/modules/openapi-generator/src/main/resources/php-symfony/testing/ControllerTest.mustache @@ -55,7 +55,7 @@ class ControllerTest extends TestCase ); } - public function dataProviderIsContentTypeAllowed(): array + public static function dataProviderIsContentTypeAllowed(): array { return [ 'usual JSON content type' => [ 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 f1d6d929d5380..abaf02d5b8c5b 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/Controller.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/Controller.php @@ -102,7 +102,7 @@ public function createErrorResponse(HttpException $exception): Response $json = $this->exceptionToArray($exception); $json['statusCode'] = $statusCode; - return new Response(json_encode($json, 15, 512), $statusCode, $headers); + return new Response(json_encode($json, 15), $statusCode, $headers); } /** @@ -229,7 +229,7 @@ protected function getOutputFormat(string $accept, array $produced): ?string public static function isContentTypeAllowed(Request $request, array $consumes = []): bool { if (!empty($consumes) && $consumes[0] !== '*/*') { - $currentFormat = $request->getContentType(); + $currentFormat = $request->getContentTypeFormat(); foreach ($consumes as $mimeType) { // canonize mime type if (is_string($mimeType) && false !== $pos = strpos($mimeType, ';')) { @@ -240,7 +240,7 @@ public static function isContentTypeAllowed(Request $request, array $consumes = // add custom format to request $format = $mimeType; $request->setFormat($format, $format); - $currentFormat = $request->getContentType(); + $currentFormat = $request->getContentTypeFormat(); } if ($format === $currentFormat) { diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/PetController.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/PetController.php index 66cec11ee392a..c9bf53c92e2a1 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/PetController.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/PetController.php @@ -88,7 +88,7 @@ public function addPetAction(Request $request) // Deserialize the input values that needs it try { - $inputFormat = $request->getMimeType($request->getContentType()); + $inputFormat = $request->getMimeType($request->getContentTypeFormat()); $pet = $this->deserialize($pet, 'OpenAPI\Server\Model\Pet', $inputFormat); } catch (SerializerRuntimeException $exception) { return $this->createBadRequestResponse($exception->getMessage()); @@ -117,18 +117,11 @@ public function addPetAction(Request $request) $result = $handler->addPet($pet, $responseCode, $responseHeaders); - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { - case 200: - $message = 'successful operation'; - break; - case 405: - $message = 'Invalid input'; - break; - } + $message = match($responseCode) { + 200 => 'successful operation', + 405 => 'Invalid input', + default => '', + }; return new Response( $result !== null ?$this->serialize($result, $responseFormat):'', @@ -202,15 +195,10 @@ public function deletePetAction(Request $request, $petId) $handler->deletePet($petId, $apiKey, $responseCode, $responseHeaders); - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { - case 400: - $message = 'Invalid pet value'; - break; - } + $message = match($responseCode) { + 400 => 'Invalid pet value', + default => '', + }; return new Response( '', @@ -291,18 +279,11 @@ public function findPetsByStatusAction(Request $request) $result = $handler->findPetsByStatus($status, $responseCode, $responseHeaders); - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { - case 200: - $message = 'successful operation'; - break; - case 400: - $message = 'Invalid status value'; - break; - } + $message = match($responseCode) { + 200 => 'successful operation', + 400 => 'Invalid status value', + default => '', + }; return new Response( $result !== null ?$this->serialize($result, $responseFormat):'', @@ -382,18 +363,11 @@ public function findPetsByTagsAction(Request $request) $result = $handler->findPetsByTags($tags, $responseCode, $responseHeaders); - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { - case 200: - $message = 'successful operation'; - break; - case 400: - $message = 'Invalid tag value'; - break; - } + $message = match($responseCode) { + 200 => 'successful operation', + 400 => 'Invalid tag value', + default => '', + }; return new Response( $result !== null ?$this->serialize($result, $responseFormat):'', @@ -468,21 +442,12 @@ public function getPetByIdAction(Request $request, $petId) $result = $handler->getPetById($petId, $responseCode, $responseHeaders); - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { - case 200: - $message = 'successful operation'; - break; - case 400: - $message = 'Invalid ID supplied'; - break; - case 404: - $message = 'Pet not found'; - break; - } + $message = match($responseCode) { + 200 => 'successful operation', + 400 => 'Invalid ID supplied', + 404 => 'Pet not found', + default => '', + }; return new Response( $result !== null ?$this->serialize($result, $responseFormat):'', @@ -538,7 +503,7 @@ public function updatePetAction(Request $request) // Deserialize the input values that needs it try { - $inputFormat = $request->getMimeType($request->getContentType()); + $inputFormat = $request->getMimeType($request->getContentTypeFormat()); $pet = $this->deserialize($pet, 'OpenAPI\Server\Model\Pet', $inputFormat); } catch (SerializerRuntimeException $exception) { return $this->createBadRequestResponse($exception->getMessage()); @@ -567,24 +532,13 @@ public function updatePetAction(Request $request) $result = $handler->updatePet($pet, $responseCode, $responseHeaders); - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { - case 200: - $message = 'successful operation'; - break; - case 400: - $message = 'Invalid ID supplied'; - break; - case 404: - $message = 'Pet not found'; - break; - case 405: - $message = 'Validation exception'; - break; - } + $message = match($responseCode) { + 200 => 'successful operation', + 400 => 'Invalid ID supplied', + 404 => 'Pet not found', + 405 => 'Validation exception', + default => '', + }; return new Response( $result !== null ?$this->serialize($result, $responseFormat):'', @@ -666,15 +620,10 @@ public function updatePetWithFormAction(Request $request, $petId) $handler->updatePetWithForm($petId, $name, $status, $responseCode, $responseHeaders); - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { - case 405: - $message = 'Invalid input'; - break; - } + $message = match($responseCode) { + 405 => 'Invalid input', + default => '', + }; return new Response( '', @@ -763,15 +712,10 @@ public function uploadFileAction(Request $request, $petId) $result = $handler->uploadFile($petId, $additionalMetadata, $file, $responseCode, $responseHeaders); - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { - case 200: - $message = 'successful operation'; - break; - } + $message = match($responseCode) { + 200 => 'successful operation', + default => '', + }; return new Response( $result !== null ?$this->serialize($result, $responseFormat):'', diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/StoreController.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/StoreController.php index 28a894894f64d..79b38c784f418 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/StoreController.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/StoreController.php @@ -92,18 +92,11 @@ public function deleteOrderAction(Request $request, $orderId) $handler->deleteOrder($orderId, $responseCode, $responseHeaders); - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { - case 400: - $message = 'Invalid ID supplied'; - break; - case 404: - $message = 'Order not found'; - break; - } + $message = match($responseCode) { + 400 => 'Invalid ID supplied', + 404 => 'Order not found', + default => '', + }; return new Response( '', @@ -163,15 +156,10 @@ public function getInventoryAction(Request $request) $result = $handler->getInventory($responseCode, $responseHeaders); - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { - case 200: - $message = 'successful operation'; - break; - } + $message = match($responseCode) { + 200 => 'successful operation', + default => '', + }; return new Response( $result !== null ?$this->serialize($result, $responseFormat):'', @@ -243,21 +231,12 @@ public function getOrderByIdAction(Request $request, $orderId) $result = $handler->getOrderById($orderId, $responseCode, $responseHeaders); - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { - case 200: - $message = 'successful operation'; - break; - case 400: - $message = 'Invalid ID supplied'; - break; - case 404: - $message = 'Order not found'; - break; - } + $message = match($responseCode) { + 200 => 'successful operation', + 400 => 'Invalid ID supplied', + 404 => 'Order not found', + default => '', + }; return new Response( $result !== null ?$this->serialize($result, $responseFormat):'', @@ -310,7 +289,7 @@ public function placeOrderAction(Request $request) // Deserialize the input values that needs it try { - $inputFormat = $request->getMimeType($request->getContentType()); + $inputFormat = $request->getMimeType($request->getContentTypeFormat()); $order = $this->deserialize($order, 'OpenAPI\Server\Model\Order', $inputFormat); } catch (SerializerRuntimeException $exception) { return $this->createBadRequestResponse($exception->getMessage()); @@ -337,18 +316,11 @@ public function placeOrderAction(Request $request) $result = $handler->placeOrder($order, $responseCode, $responseHeaders); - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { - case 200: - $message = 'successful operation'; - break; - case 400: - $message = 'Invalid Order'; - break; - } + $message = match($responseCode) { + 200 => 'successful operation', + 400 => 'Invalid Order', + default => '', + }; return new Response( $result !== null ?$this->serialize($result, $responseFormat):'', diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/UserController.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/UserController.php index 49287cbbe203f..fac6cc0225071 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/UserController.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/UserController.php @@ -78,7 +78,7 @@ public function createUserAction(Request $request) // Deserialize the input values that needs it try { - $inputFormat = $request->getMimeType($request->getContentType()); + $inputFormat = $request->getMimeType($request->getContentTypeFormat()); $user = $this->deserialize($user, 'OpenAPI\Server\Model\User', $inputFormat); } catch (SerializerRuntimeException $exception) { return $this->createBadRequestResponse($exception->getMessage()); @@ -107,15 +107,10 @@ public function createUserAction(Request $request) $handler->createUser($user, $responseCode, $responseHeaders); - // Find default response message - $message = 'successful operation'; - - // Find a more specific message, if available - switch ($responseCode) { - case 0: - $message = 'successful operation'; - break; - } + $message = match($responseCode) { + 0 => 'successful operation', + default => 'successful operation', + }; return new Response( '', @@ -161,7 +156,7 @@ public function createUsersWithArrayInputAction(Request $request) // Deserialize the input values that needs it try { - $inputFormat = $request->getMimeType($request->getContentType()); + $inputFormat = $request->getMimeType($request->getContentTypeFormat()); $user = $this->deserialize($user, 'array', $inputFormat); } catch (SerializerRuntimeException $exception) { return $this->createBadRequestResponse($exception->getMessage()); @@ -192,15 +187,10 @@ public function createUsersWithArrayInputAction(Request $request) $handler->createUsersWithArrayInput($user, $responseCode, $responseHeaders); - // Find default response message - $message = 'successful operation'; - - // Find a more specific message, if available - switch ($responseCode) { - case 0: - $message = 'successful operation'; - break; - } + $message = match($responseCode) { + 0 => 'successful operation', + default => 'successful operation', + }; return new Response( '', @@ -246,7 +236,7 @@ public function createUsersWithListInputAction(Request $request) // Deserialize the input values that needs it try { - $inputFormat = $request->getMimeType($request->getContentType()); + $inputFormat = $request->getMimeType($request->getContentTypeFormat()); $user = $this->deserialize($user, 'array', $inputFormat); } catch (SerializerRuntimeException $exception) { return $this->createBadRequestResponse($exception->getMessage()); @@ -277,15 +267,10 @@ public function createUsersWithListInputAction(Request $request) $handler->createUsersWithListInput($user, $responseCode, $responseHeaders); - // Find default response message - $message = 'successful operation'; - - // Find a more specific message, if available - switch ($responseCode) { - case 0: - $message = 'successful operation'; - break; - } + $message = match($responseCode) { + 0 => 'successful operation', + default => 'successful operation', + }; return new Response( '', @@ -350,18 +335,11 @@ public function deleteUserAction(Request $request, $username) $handler->deleteUser($username, $responseCode, $responseHeaders); - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { - case 400: - $message = 'Invalid username supplied'; - break; - case 404: - $message = 'User not found'; - break; - } + $message = match($responseCode) { + 400 => 'Invalid username supplied', + 404 => 'User not found', + default => '', + }; return new Response( '', @@ -430,21 +408,12 @@ public function getUserByNameAction(Request $request, $username) $result = $handler->getUserByName($username, $responseCode, $responseHeaders); - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { - case 200: - $message = 'successful operation'; - break; - case 400: - $message = 'Invalid username supplied'; - break; - case 404: - $message = 'User not found'; - break; - } + $message = match($responseCode) { + 200 => 'successful operation', + 400 => 'Invalid username supplied', + 404 => 'User not found', + default => '', + }; return new Response( $result !== null ?$this->serialize($result, $responseFormat):'', @@ -525,18 +494,11 @@ public function loginUserAction(Request $request) $result = $handler->loginUser($username, $password, $responseCode, $responseHeaders); - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { - case 200: - $message = 'successful operation'; - break; - case 400: - $message = 'Invalid username/password supplied'; - break; - } + $message = match($responseCode) { + 200 => 'successful operation', + 400 => 'Invalid username/password supplied', + default => '', + }; return new Response( $result !== null ?$this->serialize($result, $responseFormat):'', @@ -588,15 +550,10 @@ public function logoutUserAction(Request $request) $handler->logoutUser($responseCode, $responseHeaders); - // Find default response message - $message = 'successful operation'; - - // Find a more specific message, if available - switch ($responseCode) { - case 0: - $message = 'successful operation'; - break; - } + $message = match($responseCode) { + 0 => 'successful operation', + default => 'successful operation', + }; return new Response( '', @@ -643,7 +600,7 @@ public function updateUserAction(Request $request, $username) // Deserialize the input values that needs it try { $username = $this->deserialize($username, 'string', 'string'); - $inputFormat = $request->getMimeType($request->getContentType()); + $inputFormat = $request->getMimeType($request->getContentTypeFormat()); $user = $this->deserialize($user, 'OpenAPI\Server\Model\User', $inputFormat); } catch (SerializerRuntimeException $exception) { return $this->createBadRequestResponse($exception->getMessage()); @@ -679,18 +636,11 @@ public function updateUserAction(Request $request, $username) $handler->updateUser($username, $user, $responseCode, $responseHeaders); - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { - case 400: - $message = 'Invalid user supplied'; - break; - case 404: - $message = 'User not found'; - break; - } + $message = match($responseCode) { + 400 => 'Invalid user supplied', + 404 => 'User not found', + default => '', + }; return new Response( '', diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Service/JmsSerializer.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Service/JmsSerializer.php index 34a16b5e7346c..12c69bab088bd 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Service/JmsSerializer.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Service/JmsSerializer.php @@ -47,14 +47,11 @@ public function deserialize($data, string $type, string $format) private function convertFormat(string $format): ?string { - switch ($format) { - case 'application/json': - return 'json'; - case 'application/xml': - return 'xml'; - } - - return null; + return match($format) { + 'application/json' => 'json', + 'application/xml' => 'xml', + default => null, + }; } private function deserializeString($data, string $type) @@ -132,22 +129,13 @@ private function deserializeArrayString(string $format, string $type, $data): ar } // Parse the string using the correct separator - switch ($format) { - case 'csv': - $data = explode(',', $data); - break; - case 'ssv': - $data = explode(' ', $data); - break; - case 'tsv': - $data = explode("\t", $data); - break; - case 'pipes': - $data = explode('|', $data); - break; - default; - $data = []; - } + $data = match($format) { + 'csv' => explode(',', $data), + 'ssv' => explode(' ', $data), + 'tsv' => explode("\t", $data), + 'pipes' => explode('|', $data), + default => [], + }; // Deserialize each of the array elements foreach ($data as $key => $item) { diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Controller/ControllerTest.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Controller/ControllerTest.php index 9e2328a813f0a..bf0edd41b4562 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Controller/ControllerTest.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Controller/ControllerTest.php @@ -65,7 +65,7 @@ public function testIsContentTypeAllowed(?string $contentType, array $consumes, ); } - public function dataProviderIsContentTypeAllowed(): array + public static function dataProviderIsContentTypeAllowed(): array { return [ 'usual JSON content type' => [ diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/composer.json b/samples/server/petstore/php-symfony/SymfonyBundle-php/composer.json index 7aaf83d9c7688..258c663710394 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/composer.json +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/composer.json @@ -16,19 +16,19 @@ } ], "require": { - "php": ">=7.4.0|>=8.0.2", + "php": ">=8.1", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", - "symfony/validator": "^5.0|^6.0", - "jms/serializer-bundle": "^4.0", - "symfony/framework-bundle": "^5.0|^6.0" + "symfony/validator": "^6.4|^7.0", + "jms/serializer-bundle": "^5.4", + "symfony/framework-bundle": "^6.4|^7.0" }, "require-dev": { - "phpunit/phpunit": "^9.5", - "friendsofphp/php-cs-fixer": "^2.16.3", - "symfony/browser-kit": "^5.0|^6.0", - "symfony/yaml": "^5.0|^6.0", + "phpunit/phpunit": "^10.5|^11.0", + "friendsofphp/php-cs-fixer": "*", + "symfony/browser-kit": "^6.4|7.0", + "symfony/yaml": "^6.4|^7.0", "hoa/regex": "~1.0" }, "autoload": {