billing: tote Null-Pruefungen auf NOT-NULL-Spalten entfernt (phpstan)

current_period_start/-end und invoice_date sind NOT NULL; die nullsafe-
Zugriffe und der Fallback 'n/a' konnten nie greifen. Suite wieder auf
"No errors".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-09-16 12:34:56 +00:00
parent 3ef1b84600
commit 7fb5a2f9e9
2 changed files with 9 additions and 7 deletions

View file

@ -134,7 +134,7 @@ class SettleUnpaidLegacyInvoices extends Command
]);
$statuses = $classified
->map(fn (array $entry): string => $entry['source']?->status ?? 'unknown')
->map(fn (array $entry): string => $entry['source']->status ?? 'unknown')
->unique()
->values();
@ -335,8 +335,8 @@ class SettleUnpaidLegacyInvoices extends Command
'UPO #%d · User #%d · Quelle %s (%s, %s)',
$post->id,
$post->user_id,
$source?->number ?? '?',
$source?->status ?? 'unbekannt',
$source->number ?? '?',
$source->status ?? 'unbekannt',
$source?->invoice_date?->toDateString() ?? '-',
);
}

View file

@ -54,10 +54,10 @@ class ManualInvoicePdfRenderer
public function serviceName(Invoice $invoice): string
{
$option = $invoice->userPaymentOption;
$conditions = $option?->legacy_conditions ?? [];
$conditions = $option->legacy_conditions ?? [];
$name = $conditions['name']
?? $option?->paymentOption?->article_number
?? $option->paymentOption->article_number
?? 'Leistung laut Vereinbarung';
$portal = match ($conditions['legacy_portal'] ?? null) {
@ -80,7 +80,9 @@ class ManualInvoicePdfRenderer
{
$option = $invoice->userPaymentOption;
if (! $option?->current_period_start || ! $option->current_period_end) {
// Beide Spalten sind NOT NULL — ohne Vereinbarung gibt es keinen
// Zeitraum, mit Vereinbarung immer einen.
if ($option === null) {
return null;
}
@ -107,7 +109,7 @@ class ManualInvoicePdfRenderer
private function drawBody(string &$content, Invoice $invoice): void
{
$invoiceDate = $invoice->invoice_date?->format('d.m.Y') ?? 'n/a';
$invoiceDate = $invoice->invoice_date->format('d.m.Y');
$y = 700.0;
$content .= $this->text(self::LEFT, $y, 'Rechnungsdatum: '.$invoiceDate, 9);