Static Analysis

This commit is contained in:
David Bomba 2024-08-30 14:45:16 +10:00
parent f69cfb0ffa
commit c52bc3dae7
7 changed files with 18 additions and 18 deletions

View File

@ -23,12 +23,12 @@ class ProRata
* the time interval and the frequency duration
*
* @param float $amount
* @param Carbon $from_date
* @param Carbon $to_date
* @param \Illuminate\Support\Carbon | \Carbon\Carbon $from_date
* @param \Illuminate\Support\Carbon | \Carbon\Carbon $to_date
* @param int $frequency
* @return float
*/
public function refund(float $amount, Carbon $from_date, Carbon $to_date, int $frequency): float
public function refund(float $amount, $from_date, $to_date, int $frequency): float
{
$days = intval(abs($from_date->copy()->diffInDays($to_date)));
$days_in_frequency = $this->getDaysInFrequency($frequency);
@ -41,12 +41,12 @@ class ProRata
* the time interval and the frequency duration
*
* @param float $amount
* @param Carbon $from_date
* @param Carbon $to_date
* @param \Illuminate\Support\Carbon | \Carbon\Carbon $from_date
* @param \Illuminate\Support\Carbon | \Carbon\Carbon $to_date
* @param int $frequency
* @return float
*/
public function charge(float $amount, Carbon $from_date, Carbon $to_date, int $frequency): float
public function charge(float $amount, $from_date, $to_date, int $frequency): float
{
$days = intval(abs($from_date->copy()->diffInDays($to_date)));
$days_in_frequency = $this->getDaysInFrequency($frequency);

View File

@ -165,6 +165,7 @@ class InvoicePay extends Component
return $this->required_fields = true;
}
/** @var \App\Models\ClientContact $contact */
$contact = $this->getContext()['contact'];
foreach ($fields as $index => $field) {
@ -173,7 +174,7 @@ class InvoicePay extends Component
if (\Illuminate\Support\Str::startsWith($field['name'], 'client_')) {
if (
empty($contact->client->{$_field})
|| is_null($contact->client->{$_field})
|| is_null($contact->client->{$_field}) //@phpstan-ignore-line
) {
return $this->required_fields = true;
@ -182,7 +183,7 @@ class InvoicePay extends Component
}
if (\Illuminate\Support\Str::startsWith($field['name'], 'contact_')) {
if (empty($contact->{$_field}) || is_null($contact->{$_field}) || str_contains($contact->{$_field}, '@example.com')) {
if (empty($contact->{$_field}) || is_null($contact->{$_field}) || str_contains($contact->{$_field}, '@example.com')) { //@phpstan-ignore-line
return $this->required_fields = true;
}
}

View File

@ -147,8 +147,7 @@ class BaseRepository
* @throws \ReflectionException
*/
protected function alternativeSave($data, $model)
{ //$start = microtime(true);
//forces the client_id if it doesn't exist
{
if (array_key_exists('client_id', $data)) {
$model->client_id = $data['client_id'];
}
@ -167,7 +166,7 @@ class BaseRepository
$company_defaults = $client->setCompanyDefaults($data, lcfirst($resource));
$data['exchange_rate'] = $company_defaults['exchange_rate'];
$model->uses_inclusive_taxes = $client->getSetting('inclusive_taxes');
// $data = array_merge($company_defaults, $data);
$data = array_merge($data, $company_defaults);
}

View File

@ -69,7 +69,7 @@ class RFFService
if (Str::startsWith($field['name'], 'client_')) {
if (
empty($_contact->client->{$_field})
|| is_null($_contact->client->{$_field})
|| is_null($_contact->client->{$_field}) //@phpstan-ignore-line
) {
// $this->show_form = true;
$this->unfilled_fields++;
@ -79,7 +79,7 @@ class RFFService
}
if (Str::startsWith($field['name'], 'contact_')) {
if (empty($_contact->{$_field}) || is_null($_contact->{$_field}) || str_contains($_contact->{$_field}, '@example.com')) {
if (empty($_contact->{$_field}) || is_null($_contact->{$_field}) || str_contains($_contact->{$_field}, '@example.com')) { //@phpstan-ignore-line
$this->unfilled_fields++;
} else {
$this->fields[$index]['filled'] = true;

View File

@ -100,7 +100,7 @@ class OrderXDocument extends AbstractService
$this->orderxdocument->setDocumentShipToAddress($settings_entity->shipping_address1, $settings_entity->shipping_address2, "", $settings_entity->shipping_postal_code, $settings_entity->shipping_city, $settings_entity->shipping_country->iso_3166_2, $settings_entity->shipping_state);
}
$this->orderxdocument->addDocumentPaymentMean(68, ctrans("texts.xinvoice_online_payment"));
$this->orderxdocument->addDocumentPaymentMean('68', ctrans("texts.xinvoice_online_payment"));
if (str_contains($company->getSetting('vat_number'), "/")) {
$this->orderxdocument->addDocumentSellerTaxRegistration("FC", $company->getSetting('vat_number'));

View File

@ -124,9 +124,9 @@ class ZugferdEDokument extends AbstractService
//Payment Means - Switcher
if($company->settings->custom_value1 == '42') {
$this->xdocument->addDocumentPaymentMean(typecode: 42, payeeIban: $company->settings->custom_value2, payeeAccountName: $company->settings->custom_value4, payeeBic: $company->settings->custom_value3);
$this->xdocument->addDocumentPaymentMean(typecode: '42', payeeIban: $company->settings->custom_value2, payeeAccountName: $company->settings->custom_value4, payeeBic: $company->settings->custom_value3);
} else {
$this->xdocument->addDocumentPaymentMean(68, ctrans("texts.xinvoice_online_payment"));
$this->xdocument->addDocumentPaymentMean('68', ctrans("texts.xinvoice_online_payment"));
}
if (str_contains($company->getSetting('vat_number'), "/")) {

View File

@ -102,9 +102,9 @@ class QuickbooksSync implements ShouldQueue
private function processEntitySync(string $entity, $records)
{
match($entity){
// 'client' => $this->syncQbToNinjaClients($records),
'client' => $this->syncQbToNinjaClients($records),
'product' => $this->syncQbToNinjaProducts($records),
// 'invoice' => $this->syncQbToNinjaInvoices($records),
'invoice' => $this->syncQbToNinjaInvoices($records),
// 'vendor' => $this->syncQbToNinjaClients($records),
// 'quote' => $this->syncInvoices($records),
// 'purchase_order' => $this->syncInvoices($records),