Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,11 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<Mo
if (param.isArray || param.isMap) {
param.vendorExtensions.putIfAbsent("x-php-param-type", "array");
} else {
param.vendorExtensions.putIfAbsent("x-php-param-type", param.dataType);
String paramType = param.dataType;
if ((!param.required || param.isNullable) && !paramType.equals("mixed")) { // optional or nullable but not mixed
paramType = "?" + paramType;
}
param.vendorExtensions.putIfAbsent("x-php-param-type", paramType);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ use {{invokerPackage}}\ObjectSerializer;
public function {{operationId}}(
{{^vendorExtensions.x-group-parameters}}
{{#allParams}}
{{^required}}?{{/required}}{{vendorExtensions.x-php-param-type}} ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}},
{{vendorExtensions.x-php-param-type}} ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}},
{{/allParams}}
{{#servers}}
{{#-first}}
Expand Down Expand Up @@ -247,7 +247,7 @@ use {{invokerPackage}}\ObjectSerializer;
public function {{operationId}}WithHttpInfo(
{{^vendorExtensions.x-group-parameters}}
{{#allParams}}
{{^required}}?{{/required}}{{vendorExtensions.x-php-param-type}} ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}},
{{vendorExtensions.x-php-param-type}} ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}},
{{/allParams}}
{{#servers}}
{{#-first}}
Expand Down Expand Up @@ -446,7 +446,7 @@ use {{invokerPackage}}\ObjectSerializer;
public function {{operationId}}Async(
{{^vendorExtensions.x-group-parameters}}
{{#allParams}}
{{^required}}?{{/required}}{{vendorExtensions.x-php-param-type}} ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}},
{{vendorExtensions.x-php-param-type}} ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}},
{{/allParams}}
{{#servers}}
{{#-first}}
Expand Down Expand Up @@ -524,7 +524,7 @@ use {{invokerPackage}}\ObjectSerializer;
public function {{operationId}}AsyncWithHttpInfo(
{{^vendorExtensions.x-group-parameters}}
{{#allParams}}
${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}},
{{vendorExtensions.x-php-param-type}} ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}},
{{/allParams}}
{{#servers}}
{{#-first}}
Expand Down Expand Up @@ -630,7 +630,7 @@ use {{invokerPackage}}\ObjectSerializer;
public function {{operationId}}Request(
{{^vendorExtensions.x-group-parameters}}
{{#allParams}}
${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}},
{{vendorExtensions.x-php-param-type}} ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}},
{{/allParams}}
{{#servers}}
{{#-first}}
Expand Down
42 changes: 21 additions & 21 deletions samples/client/echo_api/php-nextgen-streaming/src/Api/BodyApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ function ($response) {
* @return PromiseInterface
*/
public function testBodyApplicationOctetstreamBinaryAsyncWithHttpInfo(
$body = null,
?\Psr\Http\Message\StreamInterface $body = null,
string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0]
): PromiseInterface
{
Expand Down Expand Up @@ -686,7 +686,7 @@ function ($exception) {
* @return \GuzzleHttp\Psr7\Request
*/
public function testBodyApplicationOctetstreamBinaryRequest(
$body = null,
?\Psr\Http\Message\StreamInterface $body = null,
string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0]
): Request
{
Expand Down Expand Up @@ -949,7 +949,7 @@ function ($response) {
* @return PromiseInterface
*/
public function testBodyMultipartFormdataArrayOfBinaryAsyncWithHttpInfo(
$files,
array $files,
string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0]
): PromiseInterface
{
Expand Down Expand Up @@ -1002,7 +1002,7 @@ function ($exception) {
* @return \GuzzleHttp\Psr7\Request
*/
public function testBodyMultipartFormdataArrayOfBinaryRequest(
$files,
array $files,
string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0]
): Request
{
Expand Down Expand Up @@ -1278,7 +1278,7 @@ function ($response) {
* @return PromiseInterface
*/
public function testBodyMultipartFormdataSingleBinaryAsyncWithHttpInfo(
$my_file = null,
?\Psr\Http\Message\StreamInterface $my_file = null,
string $contentType = self::contentTypes['testBodyMultipartFormdataSingleBinary'][0]
): PromiseInterface
{
Expand Down Expand Up @@ -1331,7 +1331,7 @@ function ($exception) {
* @return \GuzzleHttp\Psr7\Request
*/
public function testBodyMultipartFormdataSingleBinaryRequest(
$my_file = null,
?\Psr\Http\Message\StreamInterface $my_file = null,
string $contentType = self::contentTypes['testBodyMultipartFormdataSingleBinary'][0]
): Request
{
Expand Down Expand Up @@ -1601,7 +1601,7 @@ function ($response) {
* @return PromiseInterface
*/
public function testEchoBodyAllOfPetAsyncWithHttpInfo(
$pet = null,
?\OpenAPI\Client\Model\Pet $pet = null,
string $contentType = self::contentTypes['testEchoBodyAllOfPet'][0]
): PromiseInterface
{
Expand Down Expand Up @@ -1654,7 +1654,7 @@ function ($exception) {
* @return \GuzzleHttp\Psr7\Request
*/
public function testEchoBodyAllOfPetRequest(
$pet = null,
?\OpenAPI\Client\Model\Pet $pet = null,
string $contentType = self::contentTypes['testEchoBodyAllOfPet'][0]
): Request
{
Expand Down Expand Up @@ -1745,7 +1745,7 @@ public function testEchoBodyAllOfPetRequest(
* @return string
*/
public function testEchoBodyFreeFormObjectResponseString(
?array $body = null,
array $body = null,
string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0]
): string
{
Expand All @@ -1766,7 +1766,7 @@ public function testEchoBodyFreeFormObjectResponseString(
* @return array of string, HTTP status code, HTTP response headers (array of strings)
*/
public function testEchoBodyFreeFormObjectResponseStringWithHttpInfo(
?array $body = null,
array $body = null,
string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0]
): array
{
Expand Down Expand Up @@ -1893,7 +1893,7 @@ public function testEchoBodyFreeFormObjectResponseStringWithHttpInfo(
* @return PromiseInterface
*/
public function testEchoBodyFreeFormObjectResponseStringAsync(
?array $body = null,
array $body = null,
string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0]
): PromiseInterface
{
Expand All @@ -1917,7 +1917,7 @@ function ($response) {
* @return PromiseInterface
*/
public function testEchoBodyFreeFormObjectResponseStringAsyncWithHttpInfo(
$body = null,
array $body = null,
string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0]
): PromiseInterface
{
Expand Down Expand Up @@ -1970,7 +1970,7 @@ function ($exception) {
* @return \GuzzleHttp\Psr7\Request
*/
public function testEchoBodyFreeFormObjectResponseStringRequest(
$body = null,
array $body = null,
string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0]
): Request
{
Expand Down Expand Up @@ -2233,7 +2233,7 @@ function ($response) {
* @return PromiseInterface
*/
public function testEchoBodyPetAsyncWithHttpInfo(
$pet = null,
?\OpenAPI\Client\Model\Pet $pet = null,
string $contentType = self::contentTypes['testEchoBodyPet'][0]
): PromiseInterface
{
Expand Down Expand Up @@ -2286,7 +2286,7 @@ function ($exception) {
* @return \GuzzleHttp\Psr7\Request
*/
public function testEchoBodyPetRequest(
$pet = null,
?\OpenAPI\Client\Model\Pet $pet = null,
string $contentType = self::contentTypes['testEchoBodyPet'][0]
): Request
{
Expand Down Expand Up @@ -2549,7 +2549,7 @@ function ($response) {
* @return PromiseInterface
*/
public function testEchoBodyPetResponseStringAsyncWithHttpInfo(
$pet = null,
?\OpenAPI\Client\Model\Pet $pet = null,
string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0]
): PromiseInterface
{
Expand Down Expand Up @@ -2602,7 +2602,7 @@ function ($exception) {
* @return \GuzzleHttp\Psr7\Request
*/
public function testEchoBodyPetResponseStringRequest(
$pet = null,
?\OpenAPI\Client\Model\Pet $pet = null,
string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0]
): Request
{
Expand Down Expand Up @@ -2865,7 +2865,7 @@ function ($response) {
* @return PromiseInterface
*/
public function testEchoBodyStringEnumAsyncWithHttpInfo(
$body = null,
?string $body = null,
string $contentType = self::contentTypes['testEchoBodyStringEnum'][0]
): PromiseInterface
{
Expand Down Expand Up @@ -2918,7 +2918,7 @@ function ($exception) {
* @return \GuzzleHttp\Psr7\Request
*/
public function testEchoBodyStringEnumRequest(
$body = null,
?string $body = null,
string $contentType = self::contentTypes['testEchoBodyStringEnum'][0]
): Request
{
Expand Down Expand Up @@ -3181,7 +3181,7 @@ function ($response) {
* @return PromiseInterface
*/
public function testEchoBodyTagResponseStringAsyncWithHttpInfo(
$tag = null,
?\OpenAPI\Client\Model\Tag $tag = null,
string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0]
): PromiseInterface
{
Expand Down Expand Up @@ -3234,7 +3234,7 @@ function ($exception) {
* @return \GuzzleHttp\Psr7\Request
*/
public function testEchoBodyTagResponseStringRequest(
$tag = null,
?\OpenAPI\Client\Model\Tag $tag = null,
string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0]
): Request
{
Expand Down
40 changes: 20 additions & 20 deletions samples/client/echo_api/php-nextgen-streaming/src/Api/FormApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,9 @@ function ($response) {
* @return PromiseInterface
*/
public function testFormIntegerBooleanStringAsyncWithHttpInfo(
$integer_form = null,
$boolean_form = null,
$string_form = null,
?int $integer_form = null,
?bool $boolean_form = null,
?string $string_form = null,
string $contentType = self::contentTypes['testFormIntegerBooleanString'][0]
): PromiseInterface
{
Expand Down Expand Up @@ -385,9 +385,9 @@ function ($exception) {
* @return \GuzzleHttp\Psr7\Request
*/
public function testFormIntegerBooleanStringRequest(
$integer_form = null,
$boolean_form = null,
$string_form = null,
?int $integer_form = null,
?bool $boolean_form = null,
?string $string_form = null,
string $contentType = self::contentTypes['testFormIntegerBooleanString'][0]
): Request
{
Expand Down Expand Up @@ -657,7 +657,7 @@ function ($response) {
* @return PromiseInterface
*/
public function testFormObjectMultipartAsyncWithHttpInfo(
$marker,
\OpenAPI\Client\Model\TestFormObjectMultipartRequestMarker $marker,
string $contentType = self::contentTypes['testFormObjectMultipart'][0]
): PromiseInterface
{
Expand Down Expand Up @@ -710,7 +710,7 @@ function ($exception) {
* @return \GuzzleHttp\Psr7\Request
*/
public function testFormObjectMultipartRequest(
$marker,
\OpenAPI\Client\Model\TestFormObjectMultipartRequestMarker $marker,
string $contentType = self::contentTypes['testFormObjectMultipart'][0]
): Request
{
Expand Down Expand Up @@ -1011,12 +1011,12 @@ function ($response) {
* @return PromiseInterface
*/
public function testFormOneofAsyncWithHttpInfo(
$form1 = null,
$form2 = null,
$form3 = null,
$form4 = null,
$id = null,
$name = null,
?string $form1 = null,
?int $form2 = null,
?string $form3 = null,
?bool $form4 = null,
?int $id = null,
?string $name = null,
string $contentType = self::contentTypes['testFormOneof'][0]
): PromiseInterface
{
Expand Down Expand Up @@ -1074,12 +1074,12 @@ function ($exception) {
* @return \GuzzleHttp\Psr7\Request
*/
public function testFormOneofRequest(
$form1 = null,
$form2 = null,
$form3 = null,
$form4 = null,
$id = null,
$name = null,
?string $form1 = null,
?int $form2 = null,
?string $form3 = null,
?bool $form4 = null,
?int $id = null,
?string $name = null,
string $contentType = self::contentTypes['testFormOneof'][0]
): Request
{
Expand Down
20 changes: 10 additions & 10 deletions samples/client/echo_api/php-nextgen-streaming/src/Api/HeaderApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,11 @@ function ($response) {
* @return PromiseInterface
*/
public function testHeaderIntegerBooleanStringEnumsAsyncWithHttpInfo(
$integer_header = null,
$boolean_header = null,
$string_header = null,
$enum_nonref_string_header = null,
$enum_ref_string_header = null,
?int $integer_header = null,
?bool $boolean_header = null,
?string $string_header = null,
?string $enum_nonref_string_header = null,
?\OpenAPI\Client\Model\StringEnumRef $enum_ref_string_header = null,
string $contentType = self::contentTypes['testHeaderIntegerBooleanStringEnums'][0]
): PromiseInterface
{
Expand Down Expand Up @@ -397,11 +397,11 @@ function ($exception) {
* @return \GuzzleHttp\Psr7\Request
*/
public function testHeaderIntegerBooleanStringEnumsRequest(
$integer_header = null,
$boolean_header = null,
$string_header = null,
$enum_nonref_string_header = null,
$enum_ref_string_header = null,
?int $integer_header = null,
?bool $boolean_header = null,
?string $string_header = null,
?string $enum_nonref_string_header = null,
?\OpenAPI\Client\Model\StringEnumRef $enum_ref_string_header = null,
string $contentType = self::contentTypes['testHeaderIntegerBooleanStringEnums'][0]
): Request
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,10 @@ function ($response) {
* @return PromiseInterface
*/
public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathAsyncWithHttpInfo(
$path_string,
$path_integer,
$enum_nonref_string_path,
$enum_ref_string_path,
string $path_string,
int $path_integer,
string $enum_nonref_string_path,
\OpenAPI\Client\Model\StringEnumRef $enum_ref_string_path,
string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'][0]
): PromiseInterface
{
Expand Down Expand Up @@ -388,10 +388,10 @@ function ($exception) {
* @return \GuzzleHttp\Psr7\Request
*/
public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequest(
$path_string,
$path_integer,
$enum_nonref_string_path,
$enum_ref_string_path,
string $path_string,
int $path_integer,
string $enum_nonref_string_path,
\OpenAPI\Client\Model\StringEnumRef $enum_ref_string_path,
string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'][0]
): Request
{
Expand Down
Loading