1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 00:11:35 +02:00

Static analysis

This commit is contained in:
David Bomba 2024-07-15 13:35:21 +10:00
parent 7b0b5216a8
commit 745c594f3b
12 changed files with 15 additions and 16 deletions

View File

@ -1545,7 +1545,6 @@ class Import implements ShouldQueue
$file_path, $file_path,
$file_name, $file_name,
$file_info, $file_info,
filesize($file_path),
0, 0,
false false
); );

View File

@ -46,7 +46,7 @@ class MailSentListener implements ShouldQueue
try { try {
$message_id = $event->sent->getMessageId(); $message_id = $event->sent->getMessageId();
$message = MessageConverter::toEmail($event->sent->getOriginalMessage()); $message = MessageConverter::toEmail($event->sent->getOriginalMessage()); //@phpstan-ignore-line
if (!$message->getHeaders()->get('x-invitation')) { if (!$message->getHeaders()->get('x-invitation')) {
return; return;

View File

@ -39,7 +39,7 @@ class StripeConnectFailed extends Mailable
return new Envelope( return new Envelope(
subject: "Stripe Connect not configured, please login and connect.", subject: "Stripe Connect not configured, please login and connect.",
from: config('ninja.contact.email'), from: config('ninja.contact.email'),
to: $this->user->email, to: $this->user->email, //@phpstan-ignore-line
); );
} }

View File

@ -245,9 +245,9 @@ class Document extends BaseModel
try { try {
$file = base64_encode($image); $file = base64_encode($image);
$img = new \Imagick(); $img = new \Imagick(); //@phpstan-ignore-line
$img->readImageBlob($file); $img->readImageBlob($file);
$img->setImageCompression(true); $img->setImageCompression(true); //@phpstan-ignore-line
$img->setImageCompressionQuality(40); $img->setImageCompressionQuality(40);
return $img->getImageBlob(); return $img->getImageBlob();

View File

@ -297,7 +297,7 @@ class PayPalWebhook implements ShouldQueue
$gateway = CompanyGateway::query() $gateway = CompanyGateway::query()
->where('company_id', $company->id) ->where('company_id', $company->id)
->where('gateway_key', $this->gateway_key) ->where('gateway_key', $this->gateway_key)
->first(function ($cg) use ($merchant_id) { ->first(function ($cg) use ($merchant_id) { //@phpstan-ignore-line
$config = $cg->getConfig(); $config = $cg->getConfig();
if($config->merchantId == $merchant_id) { if($config->merchantId == $merchant_id) {

View File

@ -188,7 +188,7 @@ class RoEInvoice extends AbstractService
$ubl_invoice->setCustomizationID("urn:cen.eu:en16931:2017#compliant#urn:efactura.mfinante.ro:CIUS-RO:1.0.1"); $ubl_invoice->setCustomizationID("urn:cen.eu:en16931:2017#compliant#urn:efactura.mfinante.ro:CIUS-RO:1.0.1");
// invoice // invoice
$ubl_invoice->setId($invoice->number); $ubl_invoice->setId($invoice->number); //@phpstan-ignore-line
$ubl_invoice->setIssueDate(date_create($invoice->date)); $ubl_invoice->setIssueDate(date_create($invoice->date));
$ubl_invoice->setDueDate(date_create($invoice->due_date)); $ubl_invoice->setDueDate(date_create($invoice->due_date));
$ubl_invoice->setInvoiceTypeCode("380"); $ubl_invoice->setInvoiceTypeCode("380");

View File

@ -410,7 +410,7 @@ class PdfConfiguration
$precision = 0; $precision = 0;
} }
$value = number_format($v, $precision, $decimal, $thousand); $value = number_format($v, $precision, $decimal, $thousand); //@phpstan-ignore-line
$symbol = $this->currency->symbol; $symbol = $this->currency->symbol;
if ($this->settings->show_currency_code === true && $this->currency->code == 'CHF') { if ($this->settings->show_currency_code === true && $this->currency->code == 'CHF') {
@ -427,7 +427,7 @@ class PdfConfiguration
return "{$symbol}{$value}"; return "{$symbol}{$value}";
} else { } else {
return $this->formatValue($value); return $this->formatValue($value); // @phpstan-ignore-line
} }
} }

View File

@ -174,7 +174,7 @@ trait DesignHelpers
// evaluating the variable. // evaluating the variable.
if (in_array(sprintf('%s%s.tax', '$', $type), (array) $this->context['pdf_variables']["{$column_type}_columns"])) { if (in_array(sprintf('%s%s.tax', '$', $type), (array) $this->context['pdf_variables']["{$column_type}_columns"])) {
$line_items = collect($this->entity->line_items)->filter(function ($item) use ($type_id) { $line_items = collect($this->entity->line_items)->filter(function ($item) use ($type_id) { //@phpstan-ignore-line
return $item->type_id = $type_id; return $item->type_id = $type_id;
}); });

View File

@ -428,7 +428,7 @@ class SubscriptionService
/** /**
* We refund unused days left. * We refund unused days left.
* *
* @param Invoice $invoice * @param \App\Models\Invoice | \App\Models\Credit $invoice
* @return float * @return float
*/ */
private function calculateProRataRefund($invoice, $subscription = null): float private function calculateProRataRefund($invoice, $subscription = null): float

View File

@ -654,7 +654,7 @@ class TemplateService
'updated_at' => $this->translateDate($invoice->pivot->updated_at, $payment->client->date_format(), $payment->client->locale()), 'updated_at' => $this->translateDate($invoice->pivot->updated_at, $payment->client->date_format(), $payment->client->locale()),
'timestamp' => $invoice->pivot->created_at->timestamp, 'timestamp' => $invoice->pivot->created_at->timestamp,
]; ];
})->merge($credits)->sortBy('timestamp')->toArray(); })->concat($credits)->sortBy('timestamp')->toArray();
return [ return [
'status' => $payment->stringStatus($payment->status_id), 'status' => $payment->stringStatus($payment->status_id),

View File

@ -277,7 +277,7 @@ class Number
return "{$symbol}{$value}"; return "{$symbol}{$value}";
} else { } else {
return self::formatValue($value, $currency); return self::formatValue($value, $currency); //@phpstan-ignore-line
} }
} }
@ -339,7 +339,7 @@ class Number
$precision = 0; $precision = 0;
} }
$value = number_format($v, $precision, $decimal, $thousand); $value = number_format($v, $precision, $decimal, $thousand);//@phpstan-ignore-line
$symbol = $currency->symbol; $symbol = $currency->symbol;
if ($entity->getSetting('show_currency_code') === true && $currency->code == 'CHF') { if ($entity->getSetting('show_currency_code') === true && $currency->code == 'CHF') {
@ -356,7 +356,7 @@ class Number
return "{$symbol}{$value}"; return "{$symbol}{$value}";
} else { } else {
return self::formatValue($value, $currency); return self::formatValue($value, $currency); //@phpstan-ignore-line
} }
} }
} }

View File

@ -17,7 +17,7 @@ class TempFile
{ {
public static function path($url): string public static function path($url): string
{ {
$temp_path = @tempnam(sys_get_temp_dir().'/'.sha1(time()), basename($url)); $temp_path = @tempnam(sys_get_temp_dir().'/'.sha1((string)time()), basename($url));
copy($url, $temp_path); copy($url, $temp_path);
return $temp_path; return $temp_path;