Skip to content

Commit ee52703

Browse files
committed
refactor: Code style
1 parent dd26fb9 commit ee52703

22 files changed

+54
-58
lines changed

src/Serializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ public function reflector(): Reflector;
2626
*
2727
* @return A
2828
*/
29-
public function adapter(string $typeAdapterType, Type|string $type, Attributes $attributes = new ArrayAttributes(), TypeAdapterFactory $skipPast = null): TypeAdapter;
29+
public function adapter(string $typeAdapterType, Type|string $type, Attributes $attributes = new ArrayAttributes(), ?TypeAdapterFactory $skipPast = null): TypeAdapter;
3030
}

src/Serializer/Registry/Cache/MemoizingTypeAdapterRegistry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function __construct(
2929
*
3030
* @return TypeAdapterType
3131
*/
32-
public function forType(string $typeAdapterType, Serializer $serializer, Type $type, Attributes $attributes = new ArrayAttributes(), TypeAdapterFactory $skipPast = null): TypeAdapter
32+
public function forType(string $typeAdapterType, Serializer $serializer, Type $type, Attributes $attributes = new ArrayAttributes(), ?TypeAdapterFactory $skipPast = null): TypeAdapter
3333
{
3434
$this->resolved[$typeAdapterType][(string) $type] ??= new WeakMap();
3535

src/Serializer/Registry/Factory/FactoryTypeAdapterRegistry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(
3030
*
3131
* @return TypeAdapterType
3232
*/
33-
public function forType(string $typeAdapterType, Serializer $serializer, Type $type, Attributes $attributes = new ArrayAttributes(), TypeAdapterFactory $skipPast = null): TypeAdapter
33+
public function forType(string $typeAdapterType, Serializer $serializer, Type $type, Attributes $attributes = new ArrayAttributes(), ?TypeAdapterFactory $skipPast = null): TypeAdapter
3434
{
3535
if ($skipPast) {
3636
$skipPastIndex = array_search($skipPast, $this->factories, true);

src/Serializer/Registry/TypeAdapterNotFoundException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ final class TypeAdapterNotFoundException extends RuntimeException
1414
/**
1515
* @param TypeAdapterFactory<TypeAdapter<mixed, mixed>>|null $skipPast
1616
*/
17-
public function __construct(string $typeAdapterType, Type $type, Attributes $attributes, ?TypeAdapterFactory $skipPast, Throwable $previous = null)
17+
public function __construct(string $typeAdapterType, Type $type, Attributes $attributes, ?TypeAdapterFactory $skipPast, ?Throwable $previous = null)
1818
{
1919
$message = "A matching type adapter of type '{$typeAdapterType}' for type '{$type}' " .
2020
($attributes->has() ? 'with attributes ' . $attributes : '') .

src/Serializer/Registry/TypeAdapterRegistry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ interface TypeAdapterRegistry
1919
*
2020
* @return TypeAdapterType
2121
*/
22-
public function forType(string $typeAdapterType, Serializer $serializer, Type $type, Attributes $attributes = new ArrayAttributes(), TypeAdapterFactory $skipPast = null): TypeAdapter;
22+
public function forType(string $typeAdapterType, Serializer $serializer, Type $type, Attributes $attributes = new ArrayAttributes(), ?TypeAdapterFactory $skipPast = null): TypeAdapter;
2323
}

src/Serializer/TypeAdapterRegistrySerializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function __construct(
1919
private readonly Reflector $reflector,
2020
) {}
2121

22-
public function adapter(string $typeAdapterType, Type|string $type, Attributes $attributes = new ArrayAttributes(), TypeAdapterFactory $skipPast = null): TypeAdapter
22+
public function adapter(string $typeAdapterType, Type|string $type, Attributes $attributes = new ArrayAttributes(), ?TypeAdapterFactory $skipPast = null): TypeAdapter
2323
{
2424
if (is_string($type)) {
2525
$type = new NamedType($type);

src/TypeAdapter/Exception/UnexpectedEnumValueException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class UnexpectedEnumValueException extends RuntimeException implements Unexpecte
1313
public function __construct(
1414
public readonly string|int $value,
1515
public readonly array $expectedValues,
16-
Throwable $previous = null
16+
?Throwable $previous = null
1717
) {
1818
parent::__construct(
1919
'Expected one of [' .

src/TypeAdapter/Exception/UnexpectedPolymorphicTypeException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function __construct(
1414
public readonly string $typeNameField,
1515
public readonly string $value,
1616
public readonly array $expectedTypeNames,
17-
Throwable $previous = null
17+
?Throwable $previous = null
1818
) {
1919
parent::__construct(
2020
"Only the following polymorphic types for field '{$this->typeNameField}' are allowed: [" .

src/TypeAdapter/Exception/UnexpectedTypeException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class UnexpectedTypeException extends RuntimeException
1111
public function __construct(
1212
public readonly mixed $value,
1313
public readonly Type $expectedType,
14-
Throwable $previous = null
14+
?Throwable $previous = null
1515
) {
1616
parent::__construct(
1717
"Expected value of type '{$expectedType}', but got '" .

src/TypeAdapter/Exception/UnexpectedValueException.php

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

55
use Throwable;
66

7-
interface UnexpectedValueException extends Throwable
8-
{
9-
}
7+
interface UnexpectedValueException extends Throwable {}

0 commit comments

Comments
 (0)