mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-19 00:17:05 +00:00
[php-*] Explicitly declare nullable parameters (#20524)
* [php-nextgen] Explicitly declare nullable parameters explicitly * Fix some deprecation warnings in other php generators * [php-nextgen] Fix PHP 8.4 deprecation warnings with nullable/optional array parameters
This commit is contained in:
@@ -87,9 +87,9 @@ class AuthApi
|
||||
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
|
||||
*/
|
||||
public function __construct(
|
||||
ClientInterface $client = null,
|
||||
Configuration $config = null,
|
||||
HeaderSelector $selector = null,
|
||||
?ClientInterface $client = null,
|
||||
?Configuration $config = null,
|
||||
?HeaderSelector $selector = null,
|
||||
int $hostIndex = 0
|
||||
) {
|
||||
$this->client = $client ?: new Client();
|
||||
|
||||
@@ -111,9 +111,9 @@ class BodyApi
|
||||
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
|
||||
*/
|
||||
public function __construct(
|
||||
ClientInterface $client = null,
|
||||
Configuration $config = null,
|
||||
HeaderSelector $selector = null,
|
||||
?ClientInterface $client = null,
|
||||
?Configuration $config = null,
|
||||
?HeaderSelector $selector = null,
|
||||
int $hostIndex = 0
|
||||
) {
|
||||
$this->client = $client ?: new Client();
|
||||
@@ -1745,7 +1745,7 @@ class BodyApi
|
||||
* @return string
|
||||
*/
|
||||
public function testEchoBodyFreeFormObjectResponseString(
|
||||
array $body = null,
|
||||
?array $body = null,
|
||||
string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0]
|
||||
): string
|
||||
{
|
||||
@@ -1766,7 +1766,7 @@ class BodyApi
|
||||
* @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
|
||||
{
|
||||
@@ -1893,7 +1893,7 @@ class BodyApi
|
||||
* @return PromiseInterface
|
||||
*/
|
||||
public function testEchoBodyFreeFormObjectResponseStringAsync(
|
||||
array $body = null,
|
||||
?array $body = null,
|
||||
string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0]
|
||||
): PromiseInterface
|
||||
{
|
||||
@@ -1917,7 +1917,7 @@ class BodyApi
|
||||
* @return PromiseInterface
|
||||
*/
|
||||
public function testEchoBodyFreeFormObjectResponseStringAsyncWithHttpInfo(
|
||||
array $body = null,
|
||||
?array $body = null,
|
||||
string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0]
|
||||
): PromiseInterface
|
||||
{
|
||||
@@ -1970,7 +1970,7 @@ class BodyApi
|
||||
* @return \GuzzleHttp\Psr7\Request
|
||||
*/
|
||||
public function testEchoBodyFreeFormObjectResponseStringRequest(
|
||||
array $body = null,
|
||||
?array $body = null,
|
||||
string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0]
|
||||
): Request
|
||||
{
|
||||
|
||||
@@ -90,9 +90,9 @@ class FormApi
|
||||
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
|
||||
*/
|
||||
public function __construct(
|
||||
ClientInterface $client = null,
|
||||
Configuration $config = null,
|
||||
HeaderSelector $selector = null,
|
||||
?ClientInterface $client = null,
|
||||
?Configuration $config = null,
|
||||
?HeaderSelector $selector = null,
|
||||
int $hostIndex = 0
|
||||
) {
|
||||
$this->client = $client ?: new Client();
|
||||
|
||||
@@ -84,9 +84,9 @@ class HeaderApi
|
||||
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
|
||||
*/
|
||||
public function __construct(
|
||||
ClientInterface $client = null,
|
||||
Configuration $config = null,
|
||||
HeaderSelector $selector = null,
|
||||
?ClientInterface $client = null,
|
||||
?Configuration $config = null,
|
||||
?HeaderSelector $selector = null,
|
||||
int $hostIndex = 0
|
||||
) {
|
||||
$this->client = $client ?: new Client();
|
||||
|
||||
@@ -84,9 +84,9 @@ class PathApi
|
||||
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
|
||||
*/
|
||||
public function __construct(
|
||||
ClientInterface $client = null,
|
||||
Configuration $config = null,
|
||||
HeaderSelector $selector = null,
|
||||
?ClientInterface $client = null,
|
||||
?Configuration $config = null,
|
||||
?HeaderSelector $selector = null,
|
||||
int $hostIndex = 0
|
||||
) {
|
||||
$this->client = $client ?: new Client();
|
||||
|
||||
@@ -111,9 +111,9 @@ class QueryApi
|
||||
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
|
||||
*/
|
||||
public function __construct(
|
||||
ClientInterface $client = null,
|
||||
Configuration $config = null,
|
||||
HeaderSelector $selector = null,
|
||||
?ClientInterface $client = null,
|
||||
?Configuration $config = null,
|
||||
?HeaderSelector $selector = null,
|
||||
int $hostIndex = 0
|
||||
) {
|
||||
$this->client = $client ?: new Client();
|
||||
@@ -1853,7 +1853,7 @@ class QueryApi
|
||||
* @return string
|
||||
*/
|
||||
public function testQueryStyleFormExplodeFalseArrayInteger(
|
||||
array $query_object = null,
|
||||
?array $query_object = null,
|
||||
string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'][0]
|
||||
): string
|
||||
{
|
||||
@@ -1874,7 +1874,7 @@ class QueryApi
|
||||
* @return array of string, HTTP status code, HTTP response headers (array of strings)
|
||||
*/
|
||||
public function testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(
|
||||
array $query_object = null,
|
||||
?array $query_object = null,
|
||||
string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'][0]
|
||||
): array
|
||||
{
|
||||
@@ -2001,7 +2001,7 @@ class QueryApi
|
||||
* @return PromiseInterface
|
||||
*/
|
||||
public function testQueryStyleFormExplodeFalseArrayIntegerAsync(
|
||||
array $query_object = null,
|
||||
?array $query_object = null,
|
||||
string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'][0]
|
||||
): PromiseInterface
|
||||
{
|
||||
@@ -2025,7 +2025,7 @@ class QueryApi
|
||||
* @return PromiseInterface
|
||||
*/
|
||||
public function testQueryStyleFormExplodeFalseArrayIntegerAsyncWithHttpInfo(
|
||||
array $query_object = null,
|
||||
?array $query_object = null,
|
||||
string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'][0]
|
||||
): PromiseInterface
|
||||
{
|
||||
@@ -2078,7 +2078,7 @@ class QueryApi
|
||||
* @return \GuzzleHttp\Psr7\Request
|
||||
*/
|
||||
public function testQueryStyleFormExplodeFalseArrayIntegerRequest(
|
||||
array $query_object = null,
|
||||
?array $query_object = null,
|
||||
string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'][0]
|
||||
): Request
|
||||
{
|
||||
@@ -2171,7 +2171,7 @@ class QueryApi
|
||||
* @return string
|
||||
*/
|
||||
public function testQueryStyleFormExplodeFalseArrayString(
|
||||
array $query_object = null,
|
||||
?array $query_object = null,
|
||||
string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayString'][0]
|
||||
): string
|
||||
{
|
||||
@@ -2192,7 +2192,7 @@ class QueryApi
|
||||
* @return array of string, HTTP status code, HTTP response headers (array of strings)
|
||||
*/
|
||||
public function testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(
|
||||
array $query_object = null,
|
||||
?array $query_object = null,
|
||||
string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayString'][0]
|
||||
): array
|
||||
{
|
||||
@@ -2319,7 +2319,7 @@ class QueryApi
|
||||
* @return PromiseInterface
|
||||
*/
|
||||
public function testQueryStyleFormExplodeFalseArrayStringAsync(
|
||||
array $query_object = null,
|
||||
?array $query_object = null,
|
||||
string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayString'][0]
|
||||
): PromiseInterface
|
||||
{
|
||||
@@ -2343,7 +2343,7 @@ class QueryApi
|
||||
* @return PromiseInterface
|
||||
*/
|
||||
public function testQueryStyleFormExplodeFalseArrayStringAsyncWithHttpInfo(
|
||||
array $query_object = null,
|
||||
?array $query_object = null,
|
||||
string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayString'][0]
|
||||
): PromiseInterface
|
||||
{
|
||||
@@ -2396,7 +2396,7 @@ class QueryApi
|
||||
* @return \GuzzleHttp\Psr7\Request
|
||||
*/
|
||||
public function testQueryStyleFormExplodeFalseArrayStringRequest(
|
||||
array $query_object = null,
|
||||
?array $query_object = null,
|
||||
string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayString'][0]
|
||||
): Request
|
||||
{
|
||||
|
||||
@@ -482,7 +482,7 @@ class Configuration
|
||||
* @param array|null $variables hash of variable and the corresponding value (optional)
|
||||
* @return string URL based on host settings
|
||||
*/
|
||||
public static function getHostString(array $hostSettings, int $hostIndex, array $variables = null): string
|
||||
public static function getHostString(array $hostSettings, int $hostIndex, ?array $variables = null): string
|
||||
{
|
||||
if (null === $variables) {
|
||||
$variables = [];
|
||||
|
||||
@@ -247,7 +247,7 @@ class Bird implements ModelInterface, ArrayAccess, JsonSerializable
|
||||
*
|
||||
* @param array $data Associated array of property values initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
public function __construct(?array $data = null)
|
||||
{
|
||||
$this->setIfExists('size', $data ?? [], null);
|
||||
$this->setIfExists('color', $data ?? [], null);
|
||||
|
||||
@@ -247,7 +247,7 @@ class Category implements ModelInterface, ArrayAccess, JsonSerializable
|
||||
*
|
||||
* @param array $data Associated array of property values initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
public function __construct(?array $data = null)
|
||||
{
|
||||
$this->setIfExists('id', $data ?? [], null);
|
||||
$this->setIfExists('name', $data ?? [], null);
|
||||
|
||||
@@ -241,7 +241,7 @@ class DataQuery extends Query
|
||||
*
|
||||
* @param array $data Associated array of property values initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
public function __construct(?array $data = null)
|
||||
{
|
||||
parent::__construct($data);
|
||||
|
||||
|
||||
@@ -301,7 +301,7 @@ class DefaultValue implements ModelInterface, ArrayAccess, JsonSerializable
|
||||
*
|
||||
* @param array $data Associated array of property values initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
public function __construct(?array $data = null)
|
||||
{
|
||||
$this->setIfExists('array_string_enum_ref_default', $data ?? [], [["success","failure"]]);
|
||||
$this->setIfExists('array_string_enum_default', $data ?? [], [["success","failure"]]);
|
||||
|
||||
@@ -253,7 +253,7 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, JsonSerializa
|
||||
*
|
||||
* @param array $data Associated array of property values initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
public function __construct(?array $data = null)
|
||||
{
|
||||
$this->setIfExists('number', $data ?? [], null);
|
||||
$this->setIfExists('float', $data ?? [], null);
|
||||
|
||||
@@ -288,7 +288,7 @@ class Pet implements ModelInterface, ArrayAccess, JsonSerializable
|
||||
*
|
||||
* @param array $data Associated array of property values initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
public function __construct(?array $data = null)
|
||||
{
|
||||
$this->setIfExists('id', $data ?? [], null);
|
||||
$this->setIfExists('name', $data ?? [], null);
|
||||
|
||||
@@ -264,7 +264,7 @@ class Query implements ModelInterface, ArrayAccess, JsonSerializable
|
||||
*
|
||||
* @param array $data Associated array of property values initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
public function __construct(?array $data = null)
|
||||
{
|
||||
$this->setIfExists('id', $data ?? [], null);
|
||||
$this->setIfExists('outcomes', $data ?? [], [["SUCCESS","FAILURE"]]);
|
||||
|
||||
@@ -247,7 +247,7 @@ class Tag implements ModelInterface, ArrayAccess, JsonSerializable
|
||||
*
|
||||
* @param array $data Associated array of property values initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
public function __construct(?array $data = null)
|
||||
{
|
||||
$this->setIfExists('id', $data ?? [], null);
|
||||
$this->setIfExists('name', $data ?? [], null);
|
||||
|
||||
@@ -241,7 +241,7 @@ class TestFormObjectMultipartRequestMarker implements ModelInterface, ArrayAcces
|
||||
*
|
||||
* @param array $data Associated array of property values initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
public function __construct(?array $data = null)
|
||||
{
|
||||
$this->setIfExists('name', $data ?? [], null);
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme
|
||||
*
|
||||
* @param array $data Associated array of property values initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
public function __construct(?array $data = null)
|
||||
{
|
||||
$this->setIfExists('size', $data ?? [], null);
|
||||
$this->setIfExists('color', $data ?? [], null);
|
||||
|
||||
@@ -241,7 +241,7 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo
|
||||
*
|
||||
* @param array $data Associated array of property values initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
public function __construct(?array $data = null)
|
||||
{
|
||||
$this->setIfExists('values', $data ?? [], null);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ class ObjectSerializer
|
||||
*
|
||||
* @return scalar|object|array|null serialized form of $data
|
||||
*/
|
||||
public static function sanitizeForSerialization(mixed $data, string $type = null, string $format = null): mixed
|
||||
public static function sanitizeForSerialization(mixed $data, ?string $type = null, ?string $format = null): mixed
|
||||
{
|
||||
if (is_scalar($data) || null === $data) {
|
||||
return $data;
|
||||
@@ -398,7 +398,7 @@ class ObjectSerializer
|
||||
*
|
||||
* @return mixed a single or an array of $class instances
|
||||
*/
|
||||
public static function deserialize(mixed $data, string $class, array $httpHeaders = null): mixed
|
||||
public static function deserialize(mixed $data, string $class, ?array $httpHeaders = null): mixed
|
||||
{
|
||||
if (null === $data) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user