Skip to content

Commit

Permalink
Set default values in property definition instead of constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
sprain committed Apr 19, 2021
1 parent ee52d8d commit 0ce5470
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions src/QrBill.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,18 @@ final class QrBill implements SelfValidatableInterface
private const PX_SWISS_CROSS = 83; // recommended 7x7 mm in px @ 300dpi

private Header $header;
private ?CreditorInformation $creditorInformation;
private ?AddressInterface $creditor;
private ?PaymentAmountInformation $paymentAmountInformation;
private ?AddressInterface $ultimateDebtor;
private ?PaymentReference $paymentReference;
private ?AdditionalInformation $additionalInformation;
private ?CreditorInformation $creditorInformation = null;
private ?AddressInterface $creditor = null;
private ?PaymentAmountInformation $paymentAmountInformation = null;
private ?AddressInterface $ultimateDebtor = null;
private ?PaymentReference $paymentReference = null;
private ?AdditionalInformation $additionalInformation = null;
/** @var AlternativeScheme[] */
private array $alternativeSchemes;
private array $alternativeSchemes = [];

private function __construct(Header $header)
{
$this->header = $header;
$this->creditorInformation = null;
$this->creditor = null;
$this->paymentAmountInformation = null;
$this->ultimateDebtor = null;
$this->paymentReference = null;
$this->additionalInformation = null;
$this->alternativeSchemes = [];
}

public static function create(): self
Expand Down

0 comments on commit 0ce5470

Please sign in to comment.