Skip to content

Commit a1f9023

Browse files
committed
there is no need to initialize the variables in __construct
1 parent b394109 commit a1f9023

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/Decoder/Decoder.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@ final class Decoder implements DecoderInterface
1212
/**
1313
* @var array<string, TypeDecoderInterface>
1414
*/
15-
private array $decoderTypes;
15+
private array $decoderTypes = [];
1616

1717
/**
1818
* @param array<int, TypeDecoderInterface> $decoderTypes
1919
*/
2020
public function __construct(array $decoderTypes)
2121
{
22-
$this->decoderTypes = [];
2322
foreach ($decoderTypes as $decoderType) {
2423
$this->addTypeDecoder($decoderType);
2524
}

src/Encoder/Encoder.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@ final class Encoder implements EncoderInterface
1111
/**
1212
* @var array<string, TypeEncoderInterface>
1313
*/
14-
private array $encoderTypes;
14+
private array $encoderTypes = [];
1515

1616
/**
1717
* @param array<int, TypeEncoderInterface> $encoderTypes
1818
*/
1919
public function __construct(array $encoderTypes)
2020
{
21-
$this->encoderTypes = [];
2221
foreach ($encoderTypes as $encoderType) {
2322
$this->addTypeEncoder($encoderType);
2423
}

0 commit comments

Comments
 (0)