From e620687ae2eddba499d2b369b02da4975ca3cd5c Mon Sep 17 00:00:00 2001 From: Martin Helmich Date: Fri, 16 Jan 2026 15:24:24 +0100 Subject: [PATCH] fix: add "AI" to common initialisms --- src/Generator/ClientGenerator.php | 24 +++++++++++------------ src/Generator/GeneratorOptionsFactory.php | 2 +- src/Utils/Strings/Lowercaser.php | 2 +- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/Generator/ClientGenerator.php b/src/Generator/ClientGenerator.php index 646eb32..517715f 100644 --- a/src/Generator/ClientGenerator.php +++ b/src/Generator/ClientGenerator.php @@ -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( @@ -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 diff --git a/src/Generator/GeneratorOptionsFactory.php b/src/Generator/GeneratorOptionsFactory.php index 9efbd54..014bb02 100644 --- a/src/Generator/GeneratorOptionsFactory.php +++ b/src/Generator/GeneratorOptionsFactory.php @@ -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()") diff --git a/src/Utils/Strings/Lowercaser.php b/src/Utils/Strings/Lowercaser.php index 7f169d1..232829b 100644 --- a/src/Utils/Strings/Lowercaser.php +++ b/src/Utils/Strings/Lowercaser.php @@ -16,7 +16,7 @@ class Lowercaser "HTTP", "FTP", "SFTP", - + "AI", ]; public static function abbreviationAwareLowercase(string $input): string