diff --git a/src/Metadata/Model/MethodMeta.php b/src/Metadata/Model/MethodMeta.php index 269556d..e2b1c0e 100644 --- a/src/Metadata/Model/MethodMeta.php +++ b/src/Metadata/Model/MethodMeta.php @@ -9,92 +9,113 @@ final class MethodMeta { /** - * @var string|null + * @var Option */ - private $docs; + private Option $docs; /** - * @var string|null + * @var Option */ - private $action; + private Option $action; /** - * @var string|null + * @var Option */ - private $operationName; + private Option $operationName; /** - * @var string|null + * @var Option */ - private $location; + private Option $location; /** - * @var string|null + * @var Option */ - private $targetNamespace; + private Option $targetNamespace; /** - * @var string|null + * @var Option */ - private $soapVersion; + private Option $soapVersion; /** - * @var string|null + * @var Option */ - private $transport; + private Option $transport; /** - * @var string|null + * @var Option */ - private $bindingStyle; + private Option $bindingStyle; /** - * @var string|null + * @var Option */ - private $inputBindingUsage; + private Option $inputBindingUsage; /** - * @var string|null + * @var Option */ - private $inputNamespace; + private Option $inputNamespace; /** - * @var string|null + * @var Option */ - private $inputEncodingStyle; + private Option $inputEncodingStyle; /** - * @var string|null + * @var Option */ - private $outputBindingUsage; + private Option $outputBindingUsage; /** - * @var string|null + * @var Option */ - private $outputNamespace; + private Option $outputNamespace; /** - * @var string|null + * @var Option */ - private $outputEncodingStyle; + private Option $outputEncodingStyle; /** - * @var bool|null + * @var Option */ - private $isOneWay; + private Option $isOneWay; + + public function __construct() + { + $none = Option::none(); + + $this->docs = $none; + $this->action = $none; + $this->operationName = $none; + $this->location = $none; + $this->targetNamespace = $none; + $this->soapVersion = $none; + $this->transport = $none; + $this->bindingStyle = $none; + $this->isOneWay = $none; + $this->inputBindingUsage = $none; + $this->inputNamespace = $none; + $this->inputEncodingStyle = $none; + $this->outputBindingUsage = $none; + $this->outputNamespace = $none; + $this->outputEncodingStyle = $none; + } /** * @return Option */ public function docs(): Option { - return from_nullable($this->docs); + return $this->docs; } public function withDocs(?string $docs): self { $new = clone $this; - $new->docs = $docs; + $new->docs = from_nullable($docs); return $new; } @@ -104,13 +125,13 @@ public function withDocs(?string $docs): self */ public function action(): Option { - return from_nullable($this->action); + return $this->action; } public function withAction(?string $action): self { $new = clone $this; - $new->action = $action; + $new->action = from_nullable($action); return $new; } @@ -120,13 +141,13 @@ public function withAction(?string $action): self */ public function operationName(): Option { - return from_nullable($this->operationName); + return $this->operationName; } public function withOperationName(?string $operationName): self { $new = clone $this; - $new->operationName = $operationName; + $new->operationName = from_nullable($operationName); return $new; } @@ -136,13 +157,13 @@ public function withOperationName(?string $operationName): self */ public function location(): Option { - return from_nullable($this->location); + return $this->location; } public function withlocation(?string $location): self { $new = clone $this; - $new->location = $location; + $new->location = from_nullable($location); return $new; } @@ -152,13 +173,13 @@ public function withlocation(?string $location): self */ public function targetNamespace(): Option { - return from_nullable($this->targetNamespace); + return $this->targetNamespace; } public function withTargetNamespace(?string $targetNamespace): self { $new = clone $this; - $new->targetNamespace = $targetNamespace; + $new->targetNamespace = from_nullable($targetNamespace); return $new; } @@ -168,13 +189,13 @@ public function withTargetNamespace(?string $targetNamespace): self */ public function soapVersion(): Option { - return from_nullable($this->soapVersion); + return $this->soapVersion; } public function withSoapVersion(?string $soapVersion): self { $new = clone $this; - $new->soapVersion = $soapVersion; + $new->soapVersion = from_nullable($soapVersion); return $new; } @@ -184,13 +205,13 @@ public function withSoapVersion(?string $soapVersion): self */ public function transport(): Option { - return from_nullable($this->transport); + return $this->transport; } public function withTransport(?string $transport): self { $new = clone $this; - $new->transport = $transport; + $new->transport = from_nullable($transport); return $new; } @@ -200,13 +221,13 @@ public function withTransport(?string $transport): self */ public function bindingStyle(): Option { - return from_nullable($this->bindingStyle); + return $this->bindingStyle; } public function withBindingStyle(?string $bindingStyle): self { $new = clone $this; - $new->bindingStyle = $bindingStyle; + $new->bindingStyle = from_nullable($bindingStyle); return $new; } @@ -216,13 +237,13 @@ public function withBindingStyle(?string $bindingStyle): self */ public function isOneWay(): Option { - return from_nullable($this->isOneWay); + return $this->isOneWay; } public function withIsOneWay(?bool $isOneWay): self { $new = clone $this; - $new->isOneWay = $isOneWay; + $new->isOneWay = from_nullable($isOneWay); return $new; } @@ -232,13 +253,13 @@ public function withIsOneWay(?bool $isOneWay): self */ public function inputBindingUsage(): Option { - return from_nullable($this->inputBindingUsage); + return $this->inputBindingUsage; } public function withInputBindingUsage(?string $inputBindingUsage): self { $new = clone $this; - $new->inputBindingUsage = $inputBindingUsage; + $new->inputBindingUsage = from_nullable($inputBindingUsage); return $new; } @@ -248,13 +269,13 @@ public function withInputBindingUsage(?string $inputBindingUsage): self */ public function inputNamespace(): Option { - return from_nullable($this->inputNamespace); + return $this->inputNamespace; } public function withInputNamespace(?string $inputNamespace): self { $new = clone $this; - $new->inputNamespace = $inputNamespace; + $new->inputNamespace = from_nullable($inputNamespace); return $new; } @@ -264,13 +285,13 @@ public function withInputNamespace(?string $inputNamespace): self */ public function inputEncodingStyle(): Option { - return from_nullable($this->inputEncodingStyle); + return $this->inputEncodingStyle; } public function withInputEncodingStyle(?string $inputEncodingStyle): self { $new = clone $this; - $new->inputEncodingStyle = $inputEncodingStyle; + $new->inputEncodingStyle = from_nullable($inputEncodingStyle); return $new; } @@ -281,13 +302,13 @@ public function withInputEncodingStyle(?string $inputEncodingStyle): self */ public function outputBindingUsage(): Option { - return from_nullable($this->outputBindingUsage); + return $this->outputBindingUsage; } public function withOutputBindingUsage(?string $outputBindingUsage): self { $new = clone $this; - $new->outputBindingUsage = $outputBindingUsage; + $new->outputBindingUsage = from_nullable($outputBindingUsage); return $new; } @@ -297,13 +318,13 @@ public function withOutputBindingUsage(?string $outputBindingUsage): self */ public function outputNamespace(): Option { - return from_nullable($this->outputNamespace); + return $this->outputNamespace; } public function withOutputNamespace(?string $outputNamespace): self { $new = clone $this; - $new->outputNamespace = $outputNamespace; + $new->outputNamespace = from_nullable($outputNamespace); return $new; } @@ -313,13 +334,13 @@ public function withOutputNamespace(?string $outputNamespace): self */ public function outputEncodingStyle(): Option { - return from_nullable($this->outputEncodingStyle); + return $this->outputEncodingStyle; } public function withOutputEncodingStyle(?string $outputEncodingStyle): self { $new = clone $this; - $new->outputEncodingStyle = $outputEncodingStyle; + $new->outputEncodingStyle = from_nullable($outputEncodingStyle); return $new; } diff --git a/src/Metadata/Model/TypeMeta.php b/src/Metadata/Model/TypeMeta.php index 0e3c5e1..98612cb 100644 --- a/src/Metadata/Model/TypeMeta.php +++ b/src/Metadata/Model/TypeMeta.php @@ -17,143 +17,174 @@ final class TypeMeta { /** - * @var bool|null + * @var Option */ - private $isAbstract; + private Option $isAbstract; /** - * @var string|null|null + * @var Option */ - private $default; + private Option $default; /** - * @var string|null + * @var Option */ - private $docs; + private Option $docs; /** - * @var list|null + * @var Option> */ - private $enums; + private Option $enums; /** - * @var array{type: non-empty-string, namespace: non-empty-string, isSimple ?: bool}|null + * @var Option */ - private $extends; + private Option $extends; /** - * @var null|string|null + * @var Option */ - private $fixed; + private Option $fixed; /** - * @var bool|null + * @var Option */ - private $isAlias; + private Option $isAlias; /** - * @var bool|null + * @var Option */ - private $isAttribute; + private Option $isAttribute; /** * Indicates the element value of an attribute-group. * - * @var bool|null + * @var Option */ - private $isElementValue; + private Option $isElementValue; /** - * @var bool|null + * @var Option */ - private $isList; + private Option $isList; /** - * @var bool|null + * @var Option */ - private $isRepeatingElement; + private Option $isRepeatingElement; /** - * @var bool|null + * @var Option */ - private $isNullable; + private Option $isNullable; /** - * @var bool|null + * @var Option */ - private $isElement; + private Option $isElement; /** - * @var bool|null + * @var Option */ - private $isSimple; + private Option $isSimple; /** - * @var bool|null + * @var Option */ - private $isLocal; + private Option $isLocal; /** - * @var bool|null + * @var Option */ - private $isNil; + private Option $isNil; /** - * @var int|null + * @var Option */ - private $minOccurs; + private Option $minOccurs; /** - * @var int|null + * @var Option */ - private $maxOccurs; + private Option $maxOccurs; /** - * @var array|null + * @var Option> */ - private $restriction; + private Option $restriction; /** - * @var list|null + * @var Option> */ - private $unions; + private Option $unions; /** - * @var null|string + * @var Option */ - private $use; + private Option $use; /** - * @var bool|null + * @var Option */ - private $isQualified; + private Option $isQualified; /** * The soap-enc array-type information * - * @var array{type: non-empty-string, itemType: non-empty-string, namespace: non-empty-string}|null + * @var Option */ - private $arrayType; + private Option $arrayType; /** * The name of the internal array nodes for soap-enc arrays * - * @var string|null - */ - private $arrayNodeName; + * @var Option + */ + private Option $arrayNodeName; + + + public function __construct() + { + $none = Option::none(); + $this->isAbstract = $none; + $this->default = $none; + $this->docs = $none; + $this->enums = $none; + $this->extends = $none; + $this->fixed = $none; + $this->isAlias = $none; + $this->isAttribute = $none; + $this->isElementValue = $none; + $this->isList = $none; + $this->isRepeatingElement = $none; + $this->isNullable = $none; + $this->isSimple = $none; + $this->isElement = $none; + $this->isLocal = $none; + $this->isNil = $none; + $this->minOccurs = $none; + $this->maxOccurs = $none; + $this->restriction = $none; + $this->unions = $none; + $this->use = $none; + $this->isQualified = $none; + $this->arrayType = $none; + $this->arrayNodeName = $none; + } + /** * @return Option */ public function isAbstract(): Option { - return from_nullable($this->isAbstract); + return $this->isAbstract; } public function withIsAbstract(?bool $abstract): self { $new = clone $this; - $new->isAbstract = $abstract; + $new->isAbstract = from_nullable($abstract); return $new; } @@ -163,13 +194,13 @@ public function withIsAbstract(?bool $abstract): self */ public function default(): Option { - return from_nullable($this->default); + return $this->default; } public function withDefault(?string $default): self { $new = clone $this; - $new->default = $default; + $new->default = from_nullable($default); return $new; } @@ -179,13 +210,13 @@ public function withDefault(?string $default): self */ public function docs(): Option { - return from_nullable($this->docs); + return $this->docs; } public function withDocs(?string $docs): self { $new = clone $this; - $new->docs = $docs; + $new->docs = from_nullable($docs); return $new; } @@ -195,7 +226,7 @@ public function withDocs(?string $docs): self */ public function enums(): Option { - return from_nullable($this->enums); + return $this->enums; } /** @@ -204,7 +235,7 @@ public function enums(): Option public function withEnums(?array $enums): self { $new = clone $this; - $new->enums = optional(vec(string()))->coerce($enums); + $new->enums = from_nullable(optional(vec(string()))->coerce($enums)); return $new; } @@ -214,7 +245,7 @@ public function withEnums(?array $enums): self */ public function extends(): Option { - return from_nullable($this->extends); + return $this->extends; } /** @@ -223,13 +254,13 @@ public function extends(): Option public function withExtends(?array $extends): self { $new = clone $this; - $new->extends = optional( + $new->extends = from_nullable(optional( shape([ 'type' => non_empty_string(), 'namespace' => non_empty_string(), 'isSimple' => optional(bool()), ], true) - )->coerce($extends); + )->coerce($extends)); return $new; } @@ -239,13 +270,13 @@ public function withExtends(?array $extends): self */ public function fixed(): Option { - return from_nullable($this->fixed); + return $this->fixed; } public function withFixed(?string $fixed): self { $new = clone $this; - $new->fixed = $fixed; + $new->fixed = from_nullable($fixed); return $new; } @@ -255,13 +286,13 @@ public function withFixed(?string $fixed): self */ public function isAlias(): Option { - return from_nullable($this->isAlias); + return $this->isAlias; } public function withIsAlias(?bool $isAlias): self { $new = clone $this; - $new->isAlias = $isAlias; + $new->isAlias = from_nullable($isAlias); return $new; } @@ -271,13 +302,13 @@ public function withIsAlias(?bool $isAlias): self */ public function isAttribute(): Option { - return from_nullable($this->isAttribute); + return $this->isAttribute; } public function withIsAttribute(?bool $isAttribute): self { $new = clone $this; - $new->isAttribute = $isAttribute; + $new->isAttribute = from_nullable($isAttribute); return $new; } @@ -287,13 +318,13 @@ public function withIsAttribute(?bool $isAttribute): self */ public function isElementValue(): Option { - return from_nullable($this->isElementValue); + return $this->isElementValue; } public function withIsElementValue(?bool $isElementValue): self { $new = clone $this; - $new->isElementValue = $isElementValue; + $new->isElementValue = from_nullable($isElementValue); return $new; } @@ -303,13 +334,13 @@ public function withIsElementValue(?bool $isElementValue): self */ public function isList(): Option { - return from_nullable($this->isList); + return $this->isList; } public function withIsList(?bool $isList): self { $new = clone $this; - $new->isList = $isList; + $new->isList = from_nullable($isList); return $new; } @@ -319,13 +350,13 @@ public function withIsList(?bool $isList): self */ public function isRepeatingElement(): Option { - return from_nullable($this->isRepeatingElement); + return $this->isRepeatingElement; } public function withIsRepeatingElement(?bool $isRepeatingElement): self { $new = clone $this; - $new->isRepeatingElement = $isRepeatingElement; + $new->isRepeatingElement = from_nullable($isRepeatingElement); return $new; } @@ -335,13 +366,13 @@ public function withIsRepeatingElement(?bool $isRepeatingElement): self */ public function isNullable(): Option { - return from_nullable($this->isNullable); + return $this->isNullable; } public function withIsNullable(?bool $isNullable): self { $new = clone $this; - $new->isNullable = $isNullable; + $new->isNullable = from_nullable($isNullable); return $new; } @@ -351,13 +382,13 @@ public function withIsNullable(?bool $isNullable): self */ public function isSimple(): Option { - return from_nullable($this->isSimple); + return $this->isSimple; } public function withIsSimple(?bool $isSimple): self { $new = clone $this; - $new->isSimple = $isSimple; + $new->isSimple = from_nullable($isSimple); return $new; } @@ -367,13 +398,13 @@ public function withIsSimple(?bool $isSimple): self */ public function isElement(): Option { - return from_nullable($this->isElement); + return $this->isElement; } public function withIsElement(?bool $isElement): self { $new = clone $this; - $new->isElement = $isElement; + $new->isElement = from_nullable($isElement); return $new; } @@ -383,13 +414,13 @@ public function withIsElement(?bool $isElement): self */ public function isLocal(): Option { - return from_nullable($this->isLocal); + return $this->isLocal; } public function withIsLocal(?bool $local): self { $new = clone $this; - $new->isLocal = $local; + $new->isLocal = from_nullable($local); return $new; } @@ -399,13 +430,13 @@ public function withIsLocal(?bool $local): self */ public function isNil(): Option { - return from_nullable($this->isNil); + return $this->isNil; } public function withIsNil(?bool $nil): self { $new = clone $this; - $new->isNil = $nil; + $new->isNil = from_nullable($nil); return $new; } @@ -415,13 +446,13 @@ public function withIsNil(?bool $nil): self */ public function minOccurs(): Option { - return from_nullable($this->minOccurs); + return $this->minOccurs; } public function withMinOccurs(?int $min): self { $new = clone $this; - $new->minOccurs = $min; + $new->minOccurs = from_nullable($min); return $new; } @@ -431,13 +462,13 @@ public function withMinOccurs(?int $min): self */ public function maxOccurs(): Option { - return from_nullable($this->maxOccurs); + return $this->maxOccurs; } public function withMaxOccurs(?int $max): self { $new = clone $this; - $new->maxOccurs = $max; + $new->maxOccurs = from_nullable($max); return $new; } @@ -447,7 +478,7 @@ public function withMaxOccurs(?int $max): self */ public function restriction(): Option { - return from_nullable($this->restriction); + return $this->restriction; } /** @@ -456,7 +487,7 @@ public function restriction(): Option public function withRestriction(?array $restriction): self { $new = clone $this; - $new->restriction = optional(mixed_dict())->coerce($restriction); + $new->restriction = from_nullable(optional(mixed_dict())->coerce($restriction)); return $new; } @@ -466,7 +497,7 @@ public function withRestriction(?array $restriction): self */ public function unions(): Option { - return from_nullable($this->unions); + return $this->unions; } /** @@ -475,7 +506,7 @@ public function unions(): Option public function withUnions(?array $unions): self { $new = clone $this; - $new->unions = optional( + $new->unions = from_nullable(optional( vec( shape([ 'type' => non_empty_string(), @@ -483,7 +514,7 @@ public function withUnions(?array $unions): self 'isList' => bool(), ], true) ) - )->coerce($unions); + )->coerce($unions)); return $new; } @@ -493,13 +524,13 @@ public function withUnions(?array $unions): self */ public function use(): Option { - return from_nullable($this->use); + return $this->use; } public function withUse(?string $use): self { $new = clone $this; - $new->use = $use; + $new->use = from_nullable($use); return $new; } @@ -509,13 +540,13 @@ public function withUse(?string $use): self */ public function isQualified(): Option { - return from_nullable($this->isQualified); + return $this->isQualified; } public function withIsQualified(?bool $qualified): self { $new = clone $this; - $new->isQualified = $qualified; + $new->isQualified = from_nullable($qualified); return $new; } @@ -525,7 +556,7 @@ public function withIsQualified(?bool $qualified): self */ public function arrayType(): Option { - return from_nullable($this->arrayType); + return $this->arrayType; } /** @@ -534,13 +565,13 @@ public function arrayType(): Option public function withArrayType(?array $arrayType): self { $new = clone $this; - $new->arrayType = optional( + $new->arrayType = from_nullable(optional( shape([ 'type' => non_empty_string(), 'itemType' => non_empty_string(), 'namespace' => non_empty_string(), ], true) - )->coerce($arrayType); + )->coerce($arrayType)); return $new; } @@ -550,13 +581,13 @@ public function withArrayType(?array $arrayType): self */ public function arrayNodeName(): Option { - return from_nullable($this->arrayNodeName); + return $this->arrayNodeName; } public function withArrayNodeName(?string $arrayNodeName): self { $new = clone $this; - $new->arrayNodeName = $arrayNodeName; + $new->arrayNodeName = from_nullable($arrayNodeName); return $new; }