mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-25 06:04:06 +00:00
Add return types, typed parameters, and PHPDoc to all model methods
Modernize all 16 models with missing type declarations: - Return types on ~87 methods (string, bool, void, array, mixed, etc.) - Typed parameters where missing - PHPDoc blocks on non-obvious methods explaining their purpose Models updated: Invoice, Estimate, Payment, User, Company, Customer, RecurringInvoice, Setting, CompanySetting, FileDisk, Transaction, EmailLog, ExchangeRateLog, PaymentMethod, CustomField, CustomFieldValue.
This commit is contained in:
@@ -212,12 +212,12 @@ class Payment extends Model implements HasMedia
|
||||
$query->where('payments.customer_id', $customer_id);
|
||||
}
|
||||
|
||||
public function getPDFData()
|
||||
public function getPDFData(): mixed
|
||||
{
|
||||
return app(PaymentService::class)->getPdfData($this);
|
||||
}
|
||||
|
||||
public function getCompanyAddress()
|
||||
public function getCompanyAddress(): string|false
|
||||
{
|
||||
if ($this->company && (! $this->company->address()->exists())) {
|
||||
return false;
|
||||
@@ -228,7 +228,7 @@ class Payment extends Model implements HasMedia
|
||||
return $this->getFormattedString($format);
|
||||
}
|
||||
|
||||
public function getCustomerBillingAddress()
|
||||
public function getCustomerBillingAddress(): string|false
|
||||
{
|
||||
if ($this->customer && (! $this->customer->billingAddress()->exists())) {
|
||||
return false;
|
||||
@@ -239,7 +239,7 @@ class Payment extends Model implements HasMedia
|
||||
return $this->getFormattedString($format);
|
||||
}
|
||||
|
||||
public function getEmailAttachmentSetting()
|
||||
public function getEmailAttachmentSetting(): bool
|
||||
{
|
||||
$paymentAsAttachment = CompanySetting::getSetting('payment_email_attachment', $this->company_id);
|
||||
|
||||
@@ -250,12 +250,12 @@ class Payment extends Model implements HasMedia
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getNotes()
|
||||
public function getNotes(): string
|
||||
{
|
||||
return PdfHtmlSanitizer::sanitize($this->getFormattedString($this->notes));
|
||||
}
|
||||
|
||||
public function getEmailBody($body)
|
||||
public function getEmailBody(string $body): string
|
||||
{
|
||||
$values = array_merge($this->getFieldsArray(), $this->getExtraFields());
|
||||
|
||||
@@ -264,7 +264,7 @@ class Payment extends Model implements HasMedia
|
||||
return preg_replace('/{(.*?)}/', '', $body);
|
||||
}
|
||||
|
||||
public function getExtraFields()
|
||||
public function getExtraFields(): array
|
||||
{
|
||||
return [
|
||||
'{PAYMENT_DATE}' => $this->formattedPaymentDate,
|
||||
|
||||
Reference in New Issue
Block a user