Skip to content

Commit db960c1

Browse files
github-actionsgithub-actions[bot]
authored andcommitted
style(php-cs-fixer): fix coding standards
1 parent d8b6cd5 commit db960c1

20 files changed

+190
-205
lines changed

src/Attribute/Field.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@ public function __construct(
1111
public readonly string $title = '',
1212
public readonly string $description = '',
1313
public readonly mixed $default = null,
14-
) {
15-
}
14+
) {}
1615
}

src/Exception/DefinitionException.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@
44

55
namespace Spiral\JsonSchemaGenerator\Exception;
66

7-
class DefinitionException extends \RuntimeException
8-
{
9-
}
7+
class DefinitionException extends \RuntimeException {}

src/Exception/GeneratorException.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@
44

55
namespace Spiral\JsonSchemaGenerator\Exception;
66

7-
class GeneratorException extends \RuntimeException
8-
{
9-
}
7+
class GeneratorException extends \RuntimeException {}

src/Exception/InvalidTypeException.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@
44

55
namespace Spiral\JsonSchemaGenerator\Exception;
66

7-
class InvalidTypeException extends \RuntimeException
8-
{
9-
}
7+
class InvalidTypeException extends \RuntimeException {}

src/Generator.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ class Generator implements GeneratorInterface
1919

2020
public function __construct(
2121
protected readonly ParserInterface $parser = new Parser(),
22-
) {
23-
}
22+
) {}
2423

2524
/**
2625
* @param class-string|\ReflectionClass $class
@@ -88,7 +87,7 @@ protected function generateDefinition(ClassParserInterface $class, array &$depen
8887
return new Definition(
8988
type: $class->getName(),
9089
options: $class->getEnumValues(),
91-
title: $class->getShortName()
90+
title: $class->getShortName(),
9291
);
9392
}
9493

@@ -129,8 +128,8 @@ protected function generateProperty(PropertyInterface $property): ?Property
129128
$options = [];
130129
if ($property->isCollection()) {
131130
$options = \array_map(
132-
static fn (TypeInterface $type) => $type->getName(),
133-
$property->getCollectionValueTypes()
131+
static fn(TypeInterface $type) => $type->getName(),
132+
$property->getCollectionValueTypes(),
134133
);
135134
}
136135

src/GeneratorInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Spiral\JsonSchemaGenerator;
46

57
interface GeneratorInterface

src/Parser/ClassParser.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ final class ClassParser implements ClassParserInterface
2323
* @var array<string, \ReflectionParameter>
2424
*/
2525
private array $constructorParameters = [];
26+
2627
private readonly PropertyInfoExtractorInterface $propertyInfo;
2728

2829
/**
@@ -90,7 +91,7 @@ public function getProperties(): array
9091
type: new Type(name: $type->getName(), builtin: $type->isBuiltin(), nullable: $type->allowsNull()),
9192
hasDefaultValue: $this->hasPropertyDefaultValue($property),
9293
defaultValue: $this->getPropertyDefaultValue($property),
93-
collectionValueTypes: $this->getPropertyCollectionTypes($property->getName())
94+
collectionValueTypes: $this->getPropertyCollectionTypes($property->getName()),
9495
);
9596
}
9697

@@ -147,7 +148,7 @@ private function getPropertyCollectionTypes(string $property): array
147148
$result[] = new Type(
148149
name: $name,
149150
builtin: $type->getBuiltinType() !== SchemaType::Object->value,
150-
nullable: $type->isNullable()
151+
nullable: $type->isNullable(),
151152
);
152153
}
153154

src/Parser/Property.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ public function __construct(
1717
private readonly bool $hasDefaultValue,
1818
private readonly mixed $defaultValue = null,
1919
private readonly array $collectionValueTypes = [],
20-
) {
21-
}
20+
) {}
2221

2322
/**
2423
* @return non-empty-string

src/Schema/Definition.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function __construct(
2525
'Property `%s` is not an instance of `%s`.',
2626
// type name or class name
2727
\is_object($property) ? \get_class($property) : \gettype($property),
28-
Property::class
28+
Property::class,
2929
));
3030
}
3131

@@ -64,7 +64,7 @@ private function renderType(array $schema): array
6464
if (!$rf->isEnum()) {
6565
throw new DefinitionException(\sprintf(
6666
'Type `%s` must be a backed enum or class with properties.',
67-
$this->type instanceof Type ? $this->type->value : $this->type
67+
$this->type instanceof Type ? $this->type->value : $this->type,
6868
));
6969
}
7070

@@ -74,7 +74,7 @@ private function renderType(array $schema): array
7474
if (!$rf->isBacked()) {
7575
throw new DefinitionException(\sprintf(
7676
'Type `%s` is not a backed enum.',
77-
$this->type instanceof Type ? $this->type->value : $this->type
77+
$this->type instanceof Type ? $this->type->value : $this->type,
7878
));
7979
}
8080

@@ -90,7 +90,7 @@ private function renderType(array $schema): array
9090
'bool' => 'boolean',
9191
default => throw new DefinitionException(\sprintf(
9292
'Type `%s` is not a backed enum.',
93-
$this->type instanceof Type ? $this->type->value : $this->type
93+
$this->type instanceof Type ? $this->type->value : $this->type,
9494
)),
9595
};
9696

src/Schema/Reference.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ final class Reference implements \JsonSerializable
1414
*/
1515
public function __construct(
1616
private readonly string $className,
17-
) {
18-
}
17+
) {}
1918

2019
public function jsonSerialize(): string
2120
{

0 commit comments

Comments
 (0)