Skip to content

Commit

Permalink
chore: rector run (#255)
Browse files Browse the repository at this point in the history
  • Loading branch information
priyadi authored Nov 13, 2024
1 parent b91b897 commit 140192e
Show file tree
Hide file tree
Showing 17 changed files with 31 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 1.13.6

* chore: rector run

## 1.13.5

* fix: infinite loop in `MapperFactory`
Expand Down
8 changes: 2 additions & 6 deletions src/MapperFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,6 @@ class MapperFactory

private ?Application $application = null;

private LoggerInterface $logger;

/**
* @param array<string,TransformerInterface> $additionalTransformers
*/
Expand All @@ -227,10 +225,8 @@ public function __construct(
private readonly ?NormalizerInterface $normalizer = null,
private readonly ?DenormalizerInterface $denormalizer = null,
private readonly CacheItemPoolInterface $propertyInfoExtractorCache = new ArrayAdapter(),
?LoggerInterface $logger = null,
) {
$this->logger = $logger ?? new NullLogger();
}
private readonly LoggerInterface $logger = new NullLogger()
) {}

/**
* @param class-string $sourceClass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function __construct(
private readonly LoggerInterface $logger,
) {}

#[\Override]
public function getObjectProcessor(
ObjectToObjectMetadata $metadata,
): ObjectProcessorInterface {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public function __construct(
private LoggerInterface $logger,
) {}

#[\Override]
public function transform(
object $source,
?object $target,
Expand Down
1 change: 1 addition & 0 deletions tests/src/Common/FrameworkTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public function get(string $serviceId): object
return $result;
}

#[\Override]
protected function setUp(): void
{
parent::setUp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
class ObjectWithConstructorAndSetter
{
public function __construct(
private string $id,
private string $name,
private string $description,
private readonly string $id,
private readonly string $name,
private readonly string $description,
) {}

public function setId(string $id): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
class ObjectWithConstructorArgumentsAndGetters
{
public function __construct(
private string $id,
private string $name,
private string $description,
private readonly string $id,
private readonly string $name,
private readonly string $description,
) {}

public function getId(): string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
class ObjectWithIdOnlyOnConstructor
{
public function __construct(
private string $id,
private readonly string $id,
) {}

private string $name = '';

private string $description = '';

public function getId(): string
Expand Down
2 changes: 2 additions & 0 deletions tests/src/Fixtures/ConstructorAndProperty/SourceObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
class SourceObject
{
public string $id = 'id';

public string $name = 'name';

public string $description = 'description';
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ public function __construct(
) {}

public ?string $name = null;

public ?string $other = null;
}
2 changes: 1 addition & 1 deletion tests/src/Fixtures/NullSource/TargetString.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class TargetString
{
private string $property;
private readonly string $property;

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Fixtures/NullSource/TargetUuid.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class TargetUuid
{
private Uuid $property;
private readonly Uuid $property;

public function __construct()
{
Expand Down
2 changes: 2 additions & 0 deletions tests/src/Fixtures/ObjectMapper/MoneyDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ public function __construct(
private string $currency,
) {}

#[\Override]
public function getAmount(): string
{
return $this->amount;
}

#[\Override]
public function getCurrency(): string
{
return $this->currency;
Expand Down
2 changes: 2 additions & 0 deletions tests/src/Fixtures/ObjectMapper/MoneyDtoToo.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ public function __construct(
private string $currency,
) {}

#[\Override]
public function getAmount(): string
{
return $this->amount;
}

#[\Override]
public function getCurrency(): string
{
return $this->currency;
Expand Down
2 changes: 2 additions & 0 deletions tests/src/Services/Issue232/BigDecimalTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

final readonly class BigDecimalTransformer implements TransformerInterface
{
#[\Override]
public function transform(
mixed $source,
mixed $target,
Expand All @@ -40,6 +41,7 @@ public function transform(
return BigDecimal::of($source)->toBigDecimal();
}

#[\Override]
public function getSupportedTransformation(): iterable
{
yield new TypeMapping(
Expand Down
2 changes: 2 additions & 0 deletions tests/src/Services/Issue232/CurrencyTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

final readonly class CurrencyTransformer implements TransformerInterface
{
#[\Override]
public function transform(
mixed $source,
mixed $target,
Expand All @@ -36,6 +37,7 @@ public function transform(
return Currency::of($source);
}

#[\Override]
public function getSupportedTransformation(): iterable
{
yield new TypeMapping(
Expand Down
1 change: 1 addition & 0 deletions tests/src/Services/TestLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public function __construct(
private readonly LoggerInterface $logger,
) {}

#[\Override]
public function reset(): void
{
$this->messages = [];
Expand Down

0 comments on commit 140192e

Please sign in to comment.