From 51a6cf12e1b8e431aca7cfa144ab76083b60e141 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 24 Jul 2023 21:39:30 +1000 Subject: [PATCH] Minor fixes --- app/Export/CSV/BaseExport.php | 9 ++++++--- phpstan.neon | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/Export/CSV/BaseExport.php b/app/Export/CSV/BaseExport.php index d11c9ef72c..8ef9419c94 100644 --- a/app/Export/CSV/BaseExport.php +++ b/app/Export/CSV/BaseExport.php @@ -373,6 +373,8 @@ class BaseExport if(!is_array($parts) || count($parts) < 2) return ''; + $value = ''; + match($parts[0]) { 'contact' => $value = $this->resolveClientContactKey($parts[1], $entity, $transformer), 'client' => $value = $this->resolveClientKey($parts[1], $entity, $transformer), @@ -385,7 +387,7 @@ class BaseExport 'purchase_order' => $value = $this->resolvePurchaseOrderKey($parts[1], $entity, $transformer), 'payment' => $value = $this->resolvePaymentKey($parts[1], $entity, $transformer), 'task' => $value = $this->resolveTaskKey($parts[1], $entity, $transformer), - default => $value = '' + default => $value = '', }; return $value; @@ -580,6 +582,7 @@ class BaseExport private function resolveInvoiceKey($column, $entity, $transformer) { nlog("searching for {$column}"); + $transformed_invoice = false; if($transformer instanceof PaymentTransformer) { $transformed_invoices = $transformer->includeInvoices($entity); @@ -615,9 +618,9 @@ class BaseExport } - if(array_key_exists($column, $transformed_invoice)) { + if($transformed_invoice && array_key_exists($column, $transformed_invoice)) { return $transformed_invoice[$column]; - } elseif (array_key_exists(str_replace("invoice.", "", $column), $transformed_invoice)) { + } elseif ($transformed_invoice && array_key_exists(str_replace("invoice.", "", $column), $transformed_invoice)) { return $transformed_invoice[$column]; } diff --git a/phpstan.neon b/phpstan.neon index 4465c0bdf4..e6f2c3534f 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,8 +1,11 @@ +includes: + - ./vendor/nunomaduro/larastan/extension.neon parameters: level: 4 paths: - 'app/' excludePaths: - 'vendor/' + - 'app/Jobs/Ninja/*' universalObjectCratesClasses: - App\DataMapper\Tax\RuleInterface