Fix PHP Symfony non-primitive return type being forced to be an array (#3515)

* Fix PHP Symfony non-primitive return type being forced to be an array

https://github.com/OpenAPITools/openapi-generator/issues/3514

* Update PHP Symfony samples
This commit is contained in:
Ivan Aksamentov 2019-08-02 00:54:13 +02:00 committed by William Cheng
parent 08415d1d83
commit 581131e0fe
4 changed files with 6 additions and 6 deletions

View File

@ -406,7 +406,7 @@ public class PhpSymfonyServerCodegen extends AbstractPhpCodegen implements Codeg
// Create a variable to display the correct return type in comments for interfaces // Create a variable to display the correct return type in comments for interfaces
if (op.returnType != null) { if (op.returnType != null) {
op.vendorExtensions.put("x-commentType", op.returnType); op.vendorExtensions.put("x-commentType", op.returnType);
if (!op.returnTypeIsPrimitive) { if (op.returnContainer != null && op.returnContainer.equals("array")) {
op.vendorExtensions.put("x-commentType", op.returnType + "[]"); op.vendorExtensions.put("x-commentType", op.returnType + "[]");
} }
} else { } else {

View File

@ -127,7 +127,7 @@ interface PetApiInterface
* @param integer $responseCode The HTTP response code to return * @param integer $responseCode The HTTP response code to return
* @param array $responseHeaders Additional HTTP headers to return with the response () * @param array $responseHeaders Additional HTTP headers to return with the response ()
* *
* @return OpenAPI\Server\Model\Pet[] * @return OpenAPI\Server\Model\Pet
* *
*/ */
public function getPetById($petId, &$responseCode, array &$responseHeaders); public function getPetById($petId, &$responseCode, array &$responseHeaders);
@ -173,7 +173,7 @@ interface PetApiInterface
* @param integer $responseCode The HTTP response code to return * @param integer $responseCode The HTTP response code to return
* @param array $responseHeaders Additional HTTP headers to return with the response () * @param array $responseHeaders Additional HTTP headers to return with the response ()
* *
* @return OpenAPI\Server\Model\ApiResponse[] * @return OpenAPI\Server\Model\ApiResponse
* *
*/ */
public function uploadFile($petId, $additionalMetadata = null, UploadedFile $file = null, &$responseCode, array &$responseHeaders); public function uploadFile($petId, $additionalMetadata = null, UploadedFile $file = null, &$responseCode, array &$responseHeaders);

View File

@ -87,7 +87,7 @@ interface StoreApiInterface
* @param integer $responseCode The HTTP response code to return * @param integer $responseCode The HTTP response code to return
* @param array $responseHeaders Additional HTTP headers to return with the response () * @param array $responseHeaders Additional HTTP headers to return with the response ()
* *
* @return OpenAPI\Server\Model\Order[] * @return OpenAPI\Server\Model\Order
* *
*/ */
public function getOrderById($orderId, &$responseCode, array &$responseHeaders); public function getOrderById($orderId, &$responseCode, array &$responseHeaders);
@ -101,7 +101,7 @@ interface StoreApiInterface
* @param integer $responseCode The HTTP response code to return * @param integer $responseCode The HTTP response code to return
* @param array $responseHeaders Additional HTTP headers to return with the response () * @param array $responseHeaders Additional HTTP headers to return with the response ()
* *
* @return OpenAPI\Server\Model\Order[] * @return OpenAPI\Server\Model\Order
* *
*/ */
public function placeOrder(Order $body, &$responseCode, array &$responseHeaders); public function placeOrder(Order $body, &$responseCode, array &$responseHeaders);

View File

@ -107,7 +107,7 @@ interface UserApiInterface
* @param integer $responseCode The HTTP response code to return * @param integer $responseCode The HTTP response code to return
* @param array $responseHeaders Additional HTTP headers to return with the response () * @param array $responseHeaders Additional HTTP headers to return with the response ()
* *
* @return OpenAPI\Server\Model\User[] * @return OpenAPI\Server\Model\User
* *
*/ */
public function getUserByName($username, &$responseCode, array &$responseHeaders); public function getUserByName($username, &$responseCode, array &$responseHeaders);