Skip to content

Commit 0790387

Browse files
committed
Add trailing comma
Fix implicit nullable (deprecated in PHP8.4)
1 parent 2604a21 commit 0790387

File tree

112 files changed

+746
-746
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+746
-746
lines changed

src/Model/GeneratorConfiguration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function addFilter(FilterInterface ...$additionalFilter): self
7777
foreach ($additionalFilter as $filter) {
7878
$this->validateFilterCallback(
7979
$filter->getFilter(),
80-
"Invalid filter callback for filter {$filter->getToken()}"
80+
"Invalid filter callback for filter {$filter->getToken()}",
8181
);
8282

8383
if ($filter instanceof TransformingFilterInterface) {

src/Model/Property/CompositionPropertyDecorator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(string $propertyName, JsonSchema $jsonSchema, Proper
4040
$propertyName,
4141
$jsonSchema,
4242
new ResolvedDefinitionsCollection([self::PROPERTY_KEY => $property]),
43-
self::PROPERTY_KEY
43+
self::PROPERTY_KEY,
4444
);
4545

4646
$property->onResolve(function (): void {

src/Model/Property/Property.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ public function getType(bool $outputType = false): ?PropertyType
9090
* @inheritdoc
9191
*/
9292
public function setType(
93-
PropertyType $type = null,
94-
PropertyType $outputType = null,
95-
bool $reset = false
93+
?PropertyType $type = null,
94+
?PropertyType $outputType = null,
95+
bool $reset = false,
9696
): PropertyInterface {
9797
if ($reset) {
9898
$this->typeHintDecorators = [];
@@ -134,15 +134,15 @@ public function getTypeHint(bool $outputType = false, array $skipDecorators = []
134134
$this->typeHintDecorators,
135135
static function (TypeHintDecoratorInterface $decorator) use ($skipDec): bool {
136136
return !in_array(get_class($decorator), $skipDec);
137-
}
137+
},
138138
);
139139

140140
foreach ($filteredDecorators as $decorator) {
141141
$typeHint = $decorator->decorate($typeHint, $outputType);
142142
}
143143

144144
return $typeHint;
145-
}, $input))
145+
}, $input)),
146146
);
147147

148148
$skipDec = array_diff($skipDec, $additionalSkips);
@@ -220,14 +220,14 @@ static function (Validator $validator, Validator $comparedValidator): int {
220220
return 0;
221221
}
222222
return ($validator->getPriority() < $comparedValidator->getPriority()) ? -1 : 1;
223-
}
223+
},
224224
);
225225

226226
return array_map(
227227
static function (Validator $validator): PropertyValidatorInterface {
228228
return $validator->getValidator();
229229
},
230-
$this->validators
230+
$this->validators,
231231
);
232232
}
233233

src/Model/Property/PropertyInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ public function getType(bool $outputType = false): ?PropertyType;
4848
* @return PropertyInterface
4949
*/
5050
public function setType(
51-
PropertyType $type = null,
52-
PropertyType $outputType = null,
53-
bool $reset = false
51+
?PropertyType $type = null,
52+
?PropertyType $outputType = null,
53+
bool $reset = false,
5454
): PropertyInterface;
5555

5656
/**

src/Model/Property/PropertyProxy.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(
4040
string $name,
4141
JsonSchema $jsonSchema,
4242
ResolvedDefinitionsCollection $definitionsCollection,
43-
string $key
43+
string $key,
4444
) {
4545
parent::__construct($name, $jsonSchema);
4646

@@ -70,9 +70,9 @@ public function getType(bool $outputType = false): ?PropertyType
7070
* @inheritdoc
7171
*/
7272
public function setType(
73-
PropertyType $type = null,
74-
PropertyType $outputType = null,
75-
bool $reset = false
73+
?PropertyType $type = null,
74+
?PropertyType $outputType = null,
75+
bool $reset = false,
7676
): PropertyInterface {
7777
return $this->getProperty()->setType($type, $outputType);
7878
}
@@ -134,7 +134,7 @@ public function getOrderedValidators(): array
134134
function (PropertyValidatorInterface $propertyValidator): PropertyValidatorInterface {
135135
return $propertyValidator->withProperty($this);
136136
},
137-
$this->getProperty()->getOrderedValidators()
137+
$this->getProperty()->getOrderedValidators(),
138138
);
139139
}
140140

src/Model/Property/PropertyType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class PropertyType
1818
* @param bool|null $nullable Is the property nullable? if not provided the nullability will be determined
1919
* automatically from the required flag/implicitNull setting etc.
2020
*/
21-
public function __construct(string $name, bool $nullable = null)
21+
public function __construct(string $name, ?bool $nullable = null)
2222
{
2323
$this->name = $name;
2424
$this->nullable = $nullable;

src/Model/RenderJob.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(
4242
string $fileName,
4343
string $classPath,
4444
string $className,
45-
Schema $schema
45+
Schema $schema,
4646
) {
4747
$this->fileName = $fileName;
4848
$this->classPath = $classPath;
@@ -90,7 +90,7 @@ public function render(GeneratorConfiguration $generatorConfiguration): void
9090
"Rendered class %s\n",
9191
join(
9292
'\\',
93-
array_filter([$generatorConfiguration->getNamespacePrefix(), $this->classPath, $this->className])
93+
array_filter([$generatorConfiguration->getNamespacePrefix(), $this->classPath, $this->className]),
9494
)
9595
);
9696
}
@@ -138,9 +138,9 @@ protected function renderClass(GeneratorConfiguration $generatorConfiguration):
138138
$this->schema->getBaseValidators(),
139139
static function ($validator): bool {
140140
return !is_a($validator, AbstractComposedPropertyValidator::class);
141-
}
141+
},
142142
),
143-
]
143+
],
144144
);
145145
} catch (PHPMicroTemplateException $exception) {
146146
throw new RenderException("Can't render class $this->classPath\\$this->className", 0, $exception);
@@ -162,7 +162,7 @@ protected function getUseForSchema(GeneratorConfiguration $generatorConfiguratio
162162
$this->schema->getUsedClasses(),
163163
$generatorConfiguration->collectErrors()
164164
? [$generatorConfiguration->getErrorRegistryClass()]
165-
: [ValidationException::class]
165+
: [ValidationException::class],
166166
)
167167
);
168168

src/Model/Schema.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ public function __construct(
7474
string $classPath,
7575
string $className,
7676
JsonSchema $schema,
77-
SchemaDefinitionDictionary $dictionary = null,
78-
bool $initialClass = false
77+
?SchemaDefinitionDictionary $dictionary = null,
78+
bool $initialClass = false,
7979
) {
8080
$this->className = $className;
8181
$this->classPath = $classPath;
@@ -141,7 +141,7 @@ public function getProperties(): array
141141
$this->properties,
142142
static function (
143143
PropertyInterface $property,
144-
PropertyInterface $comparedProperty
144+
PropertyInterface $comparedProperty,
145145
) use ($hasSchemaDependencyValidator): int {
146146
$propertyHasSchemaDependencyValidator = $hasSchemaDependencyValidator($property);
147147
$comparedPropertyHasSchemaDependencyValidator = $hasSchemaDependencyValidator($comparedProperty);
@@ -151,7 +151,7 @@ static function (
151151
}
152152

153153
return ($propertyHasSchemaDependencyValidator < $comparedPropertyHasSchemaDependencyValidator) ? 1 : -1;
154-
}
154+
},
155155
);
156156

157157
return $this->properties;

src/Model/SchemaDefinition/SchemaDefinition.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function getSchema(): Schema
7373
public function resolveReference(
7474
string $propertyName,
7575
array $path,
76-
PropertyMetaDataCollection $propertyMetaDataCollection
76+
PropertyMetaDataCollection $propertyMetaDataCollection,
7777
): PropertyInterface {
7878
$jsonSchema = $this->source->getJson();
7979
$originalPath = $path;
@@ -100,7 +100,7 @@ public function resolveReference(
100100
$this->schemaProcessor,
101101
$this->schema,
102102
$propertyName,
103-
$this->source->withJson($jsonSchema)
103+
$this->source->withJson($jsonSchema),
104104
);
105105
$this->resolvedPaths->offsetSet($key, $property);
106106

src/Model/SchemaDefinition/SchemaDefinitionDictionary.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function setUpDefinitionDictionary(SchemaProcessor $schemaProcessor, Sche
5151
// add the root nodes of the schema to resolve path references
5252
$this->addDefinition(
5353
$key,
54-
new SchemaDefinition($schema->getJsonSchema()->withJson($propertyEntry), $schemaProcessor, $schema)
54+
new SchemaDefinition($schema->getJsonSchema()->withJson($propertyEntry), $schemaProcessor, $schema),
5555
);
5656
}
5757

@@ -68,14 +68,14 @@ public function setUpDefinitionDictionary(SchemaProcessor $schemaProcessor, Sche
6868
protected function fetchDefinitionsById(
6969
JsonSchema $jsonSchema,
7070
SchemaProcessor $schemaProcessor,
71-
Schema $schema
71+
Schema $schema,
7272
): void {
7373
$json = $jsonSchema->getJson();
7474

7575
if (isset($json['$id'])) {
7676
$this->addDefinition(
7777
strpos($json['$id'], '#') === 0 ? $json['$id'] : "#{$json['$id']}",
78-
new SchemaDefinition($jsonSchema, $schemaProcessor, $schema)
78+
new SchemaDefinition($jsonSchema, $schemaProcessor, $schema),
7979
);
8080
}
8181

@@ -136,7 +136,7 @@ public function getDefinition(string $key, SchemaProcessor $schemaProcessor, arr
136136
return $this->parsedExternalFileSchemas[$jsonSchemaFile]->getSchemaDictionary()->getDefinition(
137137
"#$externalKey",
138138
$schemaProcessor,
139-
$path
139+
$path,
140140
);
141141
}
142142

@@ -162,7 +162,7 @@ protected function parseExternalFile(
162162
string $jsonSchemaFile,
163163
string $externalKey,
164164
SchemaProcessor $schemaProcessor,
165-
array &$path
165+
array &$path,
166166
): ?SchemaDefinition {
167167
$jsonSchemaFilePath = filter_var($jsonSchemaFile, FILTER_VALIDATE_URL)
168168
? $jsonSchemaFile
@@ -183,7 +183,7 @@ protected function parseExternalFile(
183183
$schemaProcessor->getCurrentClassPath(),
184184
'ExternalSchema',
185185
new JsonSchema($jsonSchemaFilePath, $decodedJsonSchema),
186-
new self(dirname($jsonSchemaFilePath))
186+
new self(dirname($jsonSchemaFilePath)),
187187
);
188188

189189
$schema->getSchemaDictionary()->setUpDefinitionDictionary($schemaProcessor, $schema);

src/Model/Validator/AdditionalPropertiesValidator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __construct(
4949
SchemaProcessor $schemaProcessor,
5050
Schema $schema,
5151
JsonSchema $propertiesStructure,
52-
?string $propertyName = null
52+
?string $propertyName = null,
5353
) {
5454
$propertyFactory = new PropertyFactory(new PropertyProcessorFactory());
5555

@@ -58,7 +58,7 @@ public function __construct(
5858
$schemaProcessor,
5959
$schema,
6060
static::PROPERTY_NAME,
61-
$propertiesStructure->withJson($propertiesStructure->getJson()[static::ADDITIONAL_PROPERTIES_KEY])
61+
$propertiesStructure->withJson($propertiesStructure->getJson()[static::ADDITIONAL_PROPERTIES_KEY]),
6262
);
6363

6464
$this->validationProperty->onResolve(function (): void {
@@ -74,7 +74,7 @@ public function __construct(
7474
'schema' => $schema,
7575
'validationProperty' => $this->validationProperty,
7676
'additionalProperties' => RenderHelper::varExportArray(
77-
array_keys($propertiesStructure->getJson()[static::PROPERTIES_KEY] ?? [])
77+
array_keys($propertiesStructure->getJson()[static::PROPERTIES_KEY] ?? []),
7878
),
7979
'patternProperties' => $patternProperties ? RenderHelper::varExportArray($patternProperties) : null,
8080
'generatorConfiguration' => $schemaProcessor->getGeneratorConfiguration(),
@@ -83,7 +83,7 @@ public function __construct(
8383
'collectAdditionalProperties' => &$this->collectAdditionalProperties,
8484
],
8585
static::EXCEPTION_CLASS,
86-
['&$invalidProperties']
86+
['&$invalidProperties'],
8787
);
8888
}
8989

src/Model/Validator/ArrayItemValidator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(
4242
SchemaProcessor $schemaProcessor,
4343
Schema $schema,
4444
JsonSchema $itemStructure,
45-
PropertyInterface $property
45+
PropertyInterface $property,
4646
) {
4747
$nestedPropertyName = "item of array {$property->getName()}";
4848
$this->variableSuffix = '_' . md5($nestedPropertyName);
@@ -54,7 +54,7 @@ public function __construct(
5454
$schemaProcessor,
5555
$schema,
5656
$nestedPropertyName,
57-
$itemStructure
57+
$itemStructure,
5858
);
5959

6060
$this->nestedProperty->onResolve(function () use ($property): void {
@@ -75,7 +75,7 @@ public function __construct(
7575
'suffix' => $this->variableSuffix,
7676
],
7777
InvalidItemException::class,
78-
["&\$invalidItems{$this->variableSuffix}"]
78+
["&\$invalidItems{$this->variableSuffix}"],
7979
);
8080
}
8181

src/Model/Validator/ArrayTupleValidator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(
4040
SchemaProcessor $schemaProcessor,
4141
Schema $schema,
4242
JsonSchema $propertiesStructure,
43-
string $propertyName
43+
string $propertyName,
4444
) {
4545
$propertyFactory = new PropertyFactory(new PropertyProcessorFactory());
4646

@@ -55,7 +55,7 @@ public function __construct(
5555
$schemaProcessor,
5656
$schema,
5757
$tupleItemName,
58-
$propertiesStructure->withJson($tupleItem)
58+
$propertiesStructure->withJson($tupleItem),
5959
);
6060

6161
$this->tupleProperties[] = $tupleProperty;
@@ -73,7 +73,7 @@ public function __construct(
7373
'generatorConfiguration' => $schemaProcessor->getGeneratorConfiguration(),
7474
],
7575
InvalidTupleException::class,
76-
['&$invalidTuples']
76+
['&$invalidTuples'],
7777
);
7878
}
7979

0 commit comments

Comments
 (0)