Skip to content

Commit

Permalink
add transactions null check (#8)
Browse files Browse the repository at this point in the history
* add transactions null check

* initialize transactions as an empty array

* Update Verification.php

---------

Co-authored-by: Johan Wilfer <[email protected]>
  • Loading branch information
kwarszawski and johanwilfer authored Jun 17, 2024
1 parent 17e40d9 commit 578e3cb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/SIE/Data/Verification.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Verification
* Transactions for this Verification
* @var Transaction[]
*/
protected $transactions;
protected $transactions = [];

/**
* Construct a Verification
Expand Down Expand Up @@ -188,7 +188,7 @@ public function validate()
if (!$this->date) {
throw new DomainException('Mandatory field date');
}
if (count($this->transactions) == 0) {
if (count($this->transactions) === 0) {
throw new DomainException('No transactions for verification id "' . $this->id . '".');
}

Expand Down

0 comments on commit 578e3cb

Please sign in to comment.