diff --git a/composer.json b/composer.json index 7b9c933..7fc5e91 100644 --- a/composer.json +++ b/composer.json @@ -63,7 +63,7 @@ "@composer run build", "@php vendor/bin/testbench serve" ], - "analyse": "vendor/bin/phpstan analyse", + "analyse": "vendor/bin/phpstan analyse --memory-limit 500M", "test": "vendor/bin/pest", "test-coverage": "vendor/bin/pest --coverage", "format": "vendor/bin/pint", diff --git a/src/Invoice.php b/src/Invoice.php index 58cb72c..ee90c6f 100644 --- a/src/Invoice.php +++ b/src/Invoice.php @@ -163,11 +163,14 @@ public function credit(): HasOne */ public function getPreviousInvoice(): ?static { - return static::query() + /** @var ?static $invoice */ + $invoice = static::query() ->when($this->getSerialNumberPrefix(), fn (Builder $query) => $query->where('serial_number_details->prefix', $this->getSerialNumberPrefix())) ->when($this->getSerialNumberSerie(), fn (Builder $query) => $query->where('serial_number_details->serie', $this->getSerialNumberSerie())) ->latest('serial_number') ->first(); + + return $invoice; } public function initSerialNumberDetailst(): static