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
24 changes: 11 additions & 13 deletions src/Generator/ClientGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,12 @@ private function buildOperationMethod(string $namespace, string $tag, string $pa
],
];

$req = new GeneratorRequest($envelopedResponseSchema, new ValidatedSpecificationFilesItem($responseClassNamespace, $responseClassName, $outputDir), $this->generatorOpts);
$req = $req->withReferenceLookup($this->referenceLookup);
$req = $req->withAdditionalMethod($factoryMethod);
$req = $req->withAdditionalMethod($getResponseMethod);
$req = $req->withAdditionalProperty($httpResponseProperty);
$req = $req->withAdditionalInterface("\\Mittwald\\ApiClient\\Client\\ResponseContainer");
$req = new GeneratorRequest($envelopedResponseSchema, new ValidatedSpecificationFilesItem($responseClassNamespace, $responseClassName, $outputDir), $this->generatorOpts)
->withReferenceLookup($this->referenceLookup)
->withAdditionalMethod($factoryMethod)
->withAdditionalMethod($getResponseMethod)
->withAdditionalProperty($httpResponseProperty)
->withAdditionalInterface("\\Mittwald\\ApiClient\\Client\\ResponseContainer");

if (!NestedObjectProperty::canHandleSchema($responseSchema) && !ReferenceProperty::canHandleSchema($responseSchema) && !ReferenceArrayProperty::canHandleSchema($responseSchema) && !ObjectArrayProperty::canHandleSchema($responseSchema)) {
$responseTypes[] = new OperationResponse(
Expand Down Expand Up @@ -420,13 +420,11 @@ private function buildOperationMethod(string $namespace, string $tag, string $pa
$docComment->setTag(new ReturnTag($defaultResponse->type, $defaultResponse->comment));
}

$method = new MethodGenerator(name: $methodName);
$method->setBody($body);
$method->setParameters($parameterGenerators);
$method->setReturnType($defaultResponse ? $defaultResponse->type : "void");
$method->setDocBlock($docComment);

return $method;
return new MethodGenerator(name: $methodName)
->setBody($body)
->setParameters($parameterGenerators)
->setReturnType($defaultResponse ? $defaultResponse->type : "void")
->setDocBlock($docComment);
}

private function mapOperationId(string $tag, string $operationId): string
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/GeneratorOptionsFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class GeneratorOptionsFactory
{
public static function buildGeneratorOptions(): SpecificationOptions
{
return (new SpecificationOptions())
return new SpecificationOptions()
->withTargetPHPVersion('8.2')
->withTreatValuesWithDefaultAsOptional(true)
->withNewValidatorClassExpr("new \Mittwald\ApiClient\Validator\Validator()")
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/Strings/Lowercaser.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Lowercaser
"HTTP",
"FTP",
"SFTP",

"AI",
];

public static function abbreviationAwareLowercase(string $input): string
Expand Down