Skip to content

Commit 8f0c1bb

Browse files
naming updates
1 parent fdd0e03 commit 8f0c1bb

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/Infer/Services/ReferenceTypeResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ private function finalizeType(Type $type, Type $originalType): Type
119119
$attributes = $type->attributes();
120120

121121
$traverser = new TypeTraverser([
122-
new UnionNormalizingTypeVisitor,
123122
new KeyedArrayUnpackingTypeVisitor,
123+
new UnionNormalizingTypeVisitor,
124124
new LateTypeResolvingTypeVisitor,
125125
]);
126126

src/Support/Generator/TypeTransformer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,11 @@ public function transform(Type $type): OpenApiType
226226
$openApiType = count($uniqueItems) === 1 ? $uniqueItems[0] : (new AnyOf)->setItems($uniqueItems);
227227
}
228228
} elseif ($type instanceof LiteralStringType) {
229-
$openApiType = (new StringType)->constant($type->value);
229+
$openApiType = (new StringType)->const($type->value);
230230
} elseif ($type instanceof LiteralIntegerType) {
231-
$openApiType = (new IntegerType)->constant($type->value);
231+
$openApiType = (new IntegerType)->const($type->value);
232232
} elseif ($type instanceof LiteralFloatType) {
233-
$openApiType = (new NumberType)->constant($type->value);
233+
$openApiType = (new NumberType)->const($type->value);
234234
} elseif ($type instanceof \Dedoc\Scramble\Support\Type\StringType) {
235235
$openApiType = new StringType;
236236
} elseif ($type instanceof \Dedoc\Scramble\Support\Type\FloatType) {

src/Support/Generator/Types/Type.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ abstract class Type
3333
public array $enum = [];
3434

3535
/** @var scalar|null */
36-
public $constant = null;
36+
public $const = null;
3737

3838
public bool $nullable = false;
3939

@@ -94,7 +94,6 @@ public function contentEncoding(string $encoding): self
9494
public function addProperties(Type $fromType): self
9595
{
9696
$this->attributes = $fromType->attributes;
97-
9897
$this->format = $fromType->format;
9998
$this->description = $fromType->description;
10099
$this->contentMediaType = $fromType->contentMediaType;
@@ -103,6 +102,7 @@ public function addProperties(Type $fromType): self
103102
$this->default = $fromType->default;
104103
$this->examples = $fromType->examples;
105104
$this->enum = $fromType->enum;
105+
$this->const = $fromType->const;
106106
$this->nullable = $fromType->nullable;
107107
$this->deprecated = $fromType->deprecated;
108108
$this->pattern = $fromType->pattern;
@@ -122,7 +122,7 @@ public function toArray()
122122
'deprecated' => $this->deprecated,
123123
'pattern' => $this->pattern,
124124
'enum' => count($this->enum) ? $this->enum : null,
125-
'const' => ! is_null($this->constant) ? $this->constant : null,
125+
'const' => ! is_null($this->const) ? $this->const : null,
126126
]),
127127
$this->example instanceof MissingValue ? [] : ['example' => $this->example],
128128
$this->default instanceof MissingValue ? [] : ['default' => $this->default],
@@ -157,12 +157,12 @@ public function enum(array $enum): self
157157
}
158158

159159
/**
160-
* @param scalar $constant
160+
* @param scalar $const
161161
* @return $this
162162
*/
163-
public function constant($constant): self
163+
public function const($const): self
164164
{
165-
$this->constant = $constant;
165+
$this->const = $const;
166166

167167
return $this;
168168
}

0 commit comments

Comments
 (0)