diff --git a/.github/workflows/client-generate.yml b/.github/workflows/client-generate.yml index e5a642c..cd73e23 100644 --- a/.github/workflows/client-generate.yml +++ b/.github/workflows/client-generate.yml @@ -57,7 +57,7 @@ jobs: - name: Run php-cs-fixer uses: docker://oskarstark/php-cs-fixer-ga - - uses: stefanzweifel/git-auto-commit-action@v5 + - uses: stefanzweifel/git-auto-commit-action@v7 with: commit_message: Apply php-cs-fixer changes diff --git a/.github/workflows/template-cleanup.yml b/.github/workflows/template-cleanup.yml index dc72b27..5dd6e54 100644 --- a/.github/workflows/template-cleanup.yml +++ b/.github/workflows/template-cleanup.yml @@ -107,6 +107,6 @@ jobs: - name: Run php-cs-fixer uses: docker://oskarstark/php-cs-fixer-ga - - uses: stefanzweifel/git-auto-commit-action@v5 + - uses: stefanzweifel/git-auto-commit-action@v7 with: commit_message: Apply php-cs-fixer changes \ No newline at end of file diff --git a/generated/Client.php b/generated/Client.php index db14742..029daa0 100644 --- a/generated/Client.php +++ b/generated/Client.php @@ -20,7 +20,7 @@ class Client extends Runtime\Client\Client * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \myvendor\mynamespace\Generated\Model\Pet[]|\myvendor\mynamespace\Generated\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Pet[]|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listPets(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { diff --git a/generated/Normalizer/ErrorNormalizer.php b/generated/Normalizer/ErrorNormalizer.php index 8e3a265..d63fea0 100644 --- a/generated/Normalizer/ErrorNormalizer.php +++ b/generated/Normalizer/ErrorNormalizer.php @@ -13,7 +13,6 @@ use Jane\Component\JsonSchemaRuntime\Reference; use myvendor\mynamespace\Generated\Runtime\Normalizer\CheckArray; use myvendor\mynamespace\Generated\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,139 +20,68 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ErrorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ErrorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; + return \myvendor\mynamespace\Generated\Model\Error::class === $type; + } - public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool - { - return \myvendor\mynamespace\Generated\Model\Error::class === $type; - } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && \myvendor\mynamespace\Generated\Model\Error::class === get_class($data); + } - public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool - { - return is_object($data) && \myvendor\mynamespace\Generated\Model\Error::class === get_class($data); + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \myvendor\mynamespace\Generated\Model\Error(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('code', $data)) { - $object->setCode($data['code']); - unset($data['code']); - } - if (\array_key_exists('message', $data)) { - $object->setMessage($data['message']); - unset($data['message']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \myvendor\mynamespace\Generated\Model\Error(); + if (null === $data || false === \is_array($data)) { return $object; } - - public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['code'] = $object->getCode(); - $data['message'] = $object->getMessage(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - - return $data; + if (\array_key_exists('code', $data)) { + $object->setCode($data['code']); + unset($data['code']); } - - public function getSupportedTypes(?string $format = null): array - { - return [\myvendor\mynamespace\Generated\Model\Error::class => false]; + if (\array_key_exists('message', $data)) { + $object->setMessage($data['message']); + unset($data['message']); } - } -} else { - class ErrorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool - { - return \myvendor\mynamespace\Generated\Model\Error::class === $type; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } - public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool - { - return is_object($data) && \myvendor\mynamespace\Generated\Model\Error::class === get_class($data); - } + return $object; + } - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \myvendor\mynamespace\Generated\Model\Error(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('code', $data)) { - $object->setCode($data['code']); - unset($data['code']); - } - if (\array_key_exists('message', $data)) { - $object->setMessage($data['message']); - unset($data['message']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['code'] = $data->getCode(); + $dataArray['message'] = $data->getMessage(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['code'] = $object->getCode(); - $data['message'] = $object->getMessage(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - - return $data; - } + return $dataArray; + } - public function getSupportedTypes(?string $format = null): array - { - return [\myvendor\mynamespace\Generated\Model\Error::class => false]; - } + public function getSupportedTypes(?string $format = null): array + { + return [\myvendor\mynamespace\Generated\Model\Error::class => false]; } } diff --git a/generated/Normalizer/JaneObjectNormalizer.php b/generated/Normalizer/JaneObjectNormalizer.php index c79ed22..bd053e4 100644 --- a/generated/Normalizer/JaneObjectNormalizer.php +++ b/generated/Normalizer/JaneObjectNormalizer.php @@ -12,7 +12,6 @@ use myvendor\mynamespace\Generated\Runtime\Normalizer\CheckArray; use myvendor\mynamespace\Generated\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -20,139 +19,68 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class JaneObjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class JaneObjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + protected $normalizers = [ + \myvendor\mynamespace\Generated\Model\Pet::class => PetNormalizer::class, + + \myvendor\mynamespace\Generated\Model\Error::class => ErrorNormalizer::class, + + \Jane\Component\JsonSchemaRuntime\Reference::class => \myvendor\mynamespace\Generated\Runtime\Normalizer\ReferenceNormalizer::class, + ]; + protected $normalizersCache = []; + + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return array_key_exists($type, $this->normalizers); + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - protected $normalizers = [ - \myvendor\mynamespace\Generated\Model\Pet::class => PetNormalizer::class, + return is_object($data) && array_key_exists(get_class($data), $this->normalizers); + } - \myvendor\mynamespace\Generated\Model\Error::class => ErrorNormalizer::class, + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $normalizerClass = $this->normalizers[get_class($data)]; + $normalizer = $this->getNormalizer($normalizerClass); - \Jane\Component\JsonSchemaRuntime\Reference::class => \myvendor\mynamespace\Generated\Runtime\Normalizer\ReferenceNormalizer::class, - ]; - protected $normalizersCache = []; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return array_key_exists($type, $this->normalizers); - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return is_object($data) && array_key_exists(get_class($data), $this->normalizers); - } - - public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $normalizerClass = $this->normalizers[get_class($object)]; - $normalizer = $this->getNormalizer($normalizerClass); - - return $normalizer->normalize($object, $format, $context); - } - - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - $denormalizerClass = $this->normalizers[$type]; - $denormalizer = $this->getNormalizer($denormalizerClass); - - return $denormalizer->denormalize($data, $type, $format, $context); - } - - private function getNormalizer(string $normalizerClass) - { - return $this->normalizersCache[$normalizerClass] ?? $this->initNormalizer($normalizerClass); - } - - private function initNormalizer(string $normalizerClass) - { - $normalizer = new $normalizerClass(); - $normalizer->setNormalizer($this->normalizer); - $normalizer->setDenormalizer($this->denormalizer); - $this->normalizersCache[$normalizerClass] = $normalizer; - - return $normalizer; - } - - public function getSupportedTypes(?string $format = null): array - { - return [ - \myvendor\mynamespace\Generated\Model\Pet::class => false, - \myvendor\mynamespace\Generated\Model\Error::class => false, - \Jane\Component\JsonSchemaRuntime\Reference::class => false, - ]; - } + return $normalizer->normalize($data, $format, $context); } -} else { - class JaneObjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - protected $normalizers = [ - \myvendor\mynamespace\Generated\Model\Pet::class => PetNormalizer::class, + $denormalizerClass = $this->normalizers[$type]; + $denormalizer = $this->getNormalizer($denormalizerClass); - \myvendor\mynamespace\Generated\Model\Error::class => ErrorNormalizer::class, + return $denormalizer->denormalize($data, $type, $format, $context); + } - \Jane\Component\JsonSchemaRuntime\Reference::class => \myvendor\mynamespace\Generated\Runtime\Normalizer\ReferenceNormalizer::class, + private function getNormalizer(string $normalizerClass) + { + return $this->normalizersCache[$normalizerClass] ?? $this->initNormalizer($normalizerClass); + } + + private function initNormalizer(string $normalizerClass) + { + $normalizer = new $normalizerClass(); + $normalizer->setNormalizer($this->normalizer); + $normalizer->setDenormalizer($this->denormalizer); + $this->normalizersCache[$normalizerClass] = $normalizer; + + return $normalizer; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + \myvendor\mynamespace\Generated\Model\Pet::class => false, + \myvendor\mynamespace\Generated\Model\Error::class => false, + \Jane\Component\JsonSchemaRuntime\Reference::class => false, ]; - protected $normalizersCache = []; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return array_key_exists($type, $this->normalizers); - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return is_object($data) && array_key_exists(get_class($data), $this->normalizers); - } - - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $normalizerClass = $this->normalizers[get_class($object)]; - $normalizer = $this->getNormalizer($normalizerClass); - - return $normalizer->normalize($object, $format, $context); - } - - public function denormalize($data, $type, $format = null, array $context = []) - { - $denormalizerClass = $this->normalizers[$type]; - $denormalizer = $this->getNormalizer($denormalizerClass); - - return $denormalizer->denormalize($data, $type, $format, $context); - } - - private function getNormalizer(string $normalizerClass) - { - return $this->normalizersCache[$normalizerClass] ?? $this->initNormalizer($normalizerClass); - } - - private function initNormalizer(string $normalizerClass) - { - $normalizer = new $normalizerClass(); - $normalizer->setNormalizer($this->normalizer); - $normalizer->setDenormalizer($this->denormalizer); - $this->normalizersCache[$normalizerClass] = $normalizer; - - return $normalizer; - } - - public function getSupportedTypes(?string $format = null): array - { - return [ - \myvendor\mynamespace\Generated\Model\Pet::class => false, - \myvendor\mynamespace\Generated\Model\Error::class => false, - \Jane\Component\JsonSchemaRuntime\Reference::class => false, - ]; - } } } diff --git a/generated/Normalizer/PetNormalizer.php b/generated/Normalizer/PetNormalizer.php index 72201c7..6fd1669 100644 --- a/generated/Normalizer/PetNormalizer.php +++ b/generated/Normalizer/PetNormalizer.php @@ -13,7 +13,6 @@ use Jane\Component\JsonSchemaRuntime\Reference; use myvendor\mynamespace\Generated\Runtime\Normalizer\CheckArray; use myvendor\mynamespace\Generated\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,153 +20,75 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PetNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PetNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; + return \myvendor\mynamespace\Generated\Model\Pet::class === $type; + } - public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool - { - return \myvendor\mynamespace\Generated\Model\Pet::class === $type; - } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && \myvendor\mynamespace\Generated\Model\Pet::class === get_class($data); + } - public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool - { - return is_object($data) && \myvendor\mynamespace\Generated\Model\Pet::class === get_class($data); + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \myvendor\mynamespace\Generated\Model\Pet(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('id', $data)) { - $object->setId($data['id']); - unset($data['id']); - } - if (\array_key_exists('name', $data)) { - $object->setName($data['name']); - unset($data['name']); - } - if (\array_key_exists('tag', $data)) { - $object->setTag($data['tag']); - unset($data['tag']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \myvendor\mynamespace\Generated\Model\Pet(); + if (null === $data || false === \is_array($data)) { return $object; } - - public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['id'] = $object->getId(); - $data['name'] = $object->getName(); - if ($object->isInitialized('tag') && null !== $object->getTag()) { - $data['tag'] = $object->getTag(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - - return $data; + if (\array_key_exists('id', $data)) { + $object->setId($data['id']); + unset($data['id']); } - - public function getSupportedTypes(?string $format = null): array - { - return [\myvendor\mynamespace\Generated\Model\Pet::class => false]; + if (\array_key_exists('name', $data)) { + $object->setName($data['name']); + unset($data['name']); } - } -} else { - class PetNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool - { - return \myvendor\mynamespace\Generated\Model\Pet::class === $type; + if (\array_key_exists('tag', $data)) { + $object->setTag($data['tag']); + unset($data['tag']); } - - public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool - { - return is_object($data) && \myvendor\mynamespace\Generated\Model\Pet::class === get_class($data); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \myvendor\mynamespace\Generated\Model\Pet(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('id', $data)) { - $object->setId($data['id']); - unset($data['id']); - } - if (\array_key_exists('name', $data)) { - $object->setName($data['name']); - unset($data['name']); - } - if (\array_key_exists('tag', $data)) { - $object->setTag($data['tag']); - unset($data['tag']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $object; + } - return $object; + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['id'] = $data->getId(); + $dataArray['name'] = $data->getName(); + if ($data->isInitialized('tag') && null !== $data->getTag()) { + $dataArray['tag'] = $data->getTag(); } - - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['id'] = $object->getId(); - $data['name'] = $object->getName(); - if ($object->isInitialized('tag') && null !== $object->getTag()) { - $data['tag'] = $object->getTag(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - - return $data; } - public function getSupportedTypes(?string $format = null): array - { - return [\myvendor\mynamespace\Generated\Model\Pet::class => false]; - } + return $dataArray; + } + + public function getSupportedTypes(?string $format = null): array + { + return [\myvendor\mynamespace\Generated\Model\Pet::class => false]; } } diff --git a/generated/Runtime/Client/BaseEndpoint.php b/generated/Runtime/Client/BaseEndpoint.php index 03c18b7..fcdc992 100644 --- a/generated/Runtime/Client/BaseEndpoint.php +++ b/generated/Runtime/Client/BaseEndpoint.php @@ -17,10 +17,10 @@ abstract class BaseEndpoint implements Endpoint { - protected $formParameters = []; - protected $queryParameters = []; - protected $headerParameters = []; - protected $body; + protected array $formParameters = []; + protected array $queryParameters = []; + protected array $headerParameters = []; + protected mixed $body; abstract public function getMethod(): string; @@ -40,11 +40,11 @@ protected function getExtraHeaders(): array public function getQueryString(): string { $optionsResolved = $this->getQueryOptionsResolver()->resolve($this->queryParameters); - $optionsResolved = array_map(function ($value) { - return null !== $value ? $value : ''; + $optionsResolved = array_map(static function ($value) { + return $value ?? ''; }, $optionsResolved); - return http_build_query($optionsResolved, '', '&', PHP_QUERY_RFC3986); + return http_build_query($optionsResolved, '', '&', \PHP_QUERY_RFC3986); } public function getHeaders(array $baseHeaders = []): array diff --git a/generated/Runtime/Client/Client.php b/generated/Runtime/Client/Client.php index e63db0d..7ead41c 100644 --- a/generated/Runtime/Client/Client.php +++ b/generated/Runtime/Client/Client.php @@ -22,22 +22,10 @@ abstract class Client { public const FETCH_RESPONSE = 'response'; public const FETCH_OBJECT = 'object'; - /** - * @var ClientInterface - */ - protected $httpClient; - /** - * @var RequestFactoryInterface - */ - protected $requestFactory; - /** - * @var SerializerInterface - */ - protected $serializer; - /** - * @var StreamFactoryInterface - */ - protected $streamFactory; + protected ClientInterface $httpClient; + protected RequestFactoryInterface $requestFactory; + protected SerializerInterface $serializer; + protected StreamFactoryInterface $streamFactory; public function __construct(ClientInterface $httpClient, RequestFactoryInterface $requestFactory, SerializerInterface $serializer, StreamFactoryInterface $streamFactory) { @@ -67,7 +55,7 @@ private function processEndpoint(Endpoint $endpoint): ResponseInterface { [$bodyHeaders, $body] = $endpoint->getBody($this->serializer, $this->streamFactory); $queryString = $endpoint->getQueryString(); - $uriGlue = false === strpos($endpoint->getUri(), '?') ? '?' : '&'; + $uriGlue = !str_contains($endpoint->getUri(), '?') ? '?' : '&'; $uri = '' !== $queryString ? $endpoint->getUri().$uriGlue.$queryString : $endpoint->getUri(); $request = $this->requestFactory->createRequest($endpoint->getMethod(), $uri); if ($body) { diff --git a/generated/Runtime/Normalizer/ReferenceNormalizer.php b/generated/Runtime/Normalizer/ReferenceNormalizer.php index 3163a99..3d45f0d 100644 --- a/generated/Runtime/Normalizer/ReferenceNormalizer.php +++ b/generated/Runtime/Normalizer/ReferenceNormalizer.php @@ -11,39 +11,25 @@ namespace myvendor\mynamespace\Generated\Runtime\Normalizer; use Jane\Component\JsonSchemaRuntime\Reference; -use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -if (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4) { - class ReferenceNormalizer implements NormalizerInterface +class ReferenceNormalizer implements NormalizerInterface +{ + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $ref = []; - $ref['$ref'] = (string) $object->getReferenceUri(); - - return $ref; - } - - public function supportsNormalization($data, $format = null): bool - { - return $data instanceof Reference; - } + $ref = []; + $ref['$ref'] = (string) $data->getReferenceUri(); + + return $ref; } -} else { - class ReferenceNormalizer implements NormalizerInterface + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return $data instanceof Reference; + } + + public function getSupportedTypes(?string $format): array { - public function normalize($object, $format = null, array $context = []) - { - $ref = []; - $ref['$ref'] = (string) $object->getReferenceUri(); - - return $ref; - } - - public function supportsNormalization($data, $format = null): bool - { - return $data instanceof Reference; - } + return [Reference::class => false]; } }