diff --git a/app/Export/CSV/ContactExport.php b/app/Export/CSV/ContactExport.php index 21c673b49d..74d0b00bdc 100644 --- a/app/Export/CSV/ContactExport.php +++ b/app/Export/CSV/ContactExport.php @@ -82,6 +82,7 @@ class ContactExport extends BaseExport $this->csv->insertOne($this->buildHeader()); $query->cursor()->each(function ($contact) { + /** @var \App\Models\ClientContact $contact */ $this->csv->insertOne($this->buildRow($contact)); }); @@ -101,6 +102,7 @@ class ContactExport extends BaseExport $report = $query->cursor() ->map(function ($contact) { + /** @var \App\Models\ClientContact $contact */ $row = $this->buildRow($contact); return $this->processMetaData($row, $contact); })->toArray(); diff --git a/app/Export/CSV/CreditExport.php b/app/Export/CSV/CreditExport.php index 5f1e8b56d1..7450b41146 100644 --- a/app/Export/CSV/CreditExport.php +++ b/app/Export/CSV/CreditExport.php @@ -52,6 +52,8 @@ class CreditExport extends BaseExport $report = $query->cursor() ->map(function ($credit) { + + /** @var \App\Models\Credit $credit */ $row = $this->buildRow($credit); return $this->processMetaData($row, $credit); })->toArray(); @@ -139,6 +141,7 @@ class CreditExport extends BaseExport $query->cursor() ->each(function ($credit) { + /** @var \App\Models\Credit $credit */ $this->csv->insertOne($this->buildRow($credit)); }); diff --git a/app/Export/CSV/DocumentExport.php b/app/Export/CSV/DocumentExport.php index 8adfe57a05..cfcebbc062 100644 --- a/app/Export/CSV/DocumentExport.php +++ b/app/Export/CSV/DocumentExport.php @@ -54,6 +54,8 @@ class DocumentExport extends BaseExport $report = $query->cursor() ->map(function ($document) { + + /** @var \App\Models\Document $document */ $row = $this->buildRow($document); return $this->processMetaData($row, $document); })->toArray(); @@ -99,6 +101,7 @@ class DocumentExport extends BaseExport $query->cursor() ->each(function ($entity) { + /** @var mixed $entity */ $this->csv->insertOne($this->buildRow($entity)); }); diff --git a/app/Export/CSV/ExpenseExport.php b/app/Export/CSV/ExpenseExport.php index 0af4d3faf7..6789495463 100644 --- a/app/Export/CSV/ExpenseExport.php +++ b/app/Export/CSV/ExpenseExport.php @@ -52,6 +52,8 @@ class ExpenseExport extends BaseExport $report = $query->cursor() ->map(function ($resource) { + + /** @var \App\Models\Expense $resource */ $row = $this->buildRow($resource); return $this->processMetaData($row, $resource); })->toArray(); @@ -132,6 +134,8 @@ class ExpenseExport extends BaseExport $query->cursor() ->each(function ($expense) { + + /** @var \App\Models\Expense $expense */ $this->csv->insertOne($this->buildRow($expense)); }); diff --git a/app/Export/CSV/InvoiceExport.php b/app/Export/CSV/InvoiceExport.php index d0839d03d6..d87c49ff94 100644 --- a/app/Export/CSV/InvoiceExport.php +++ b/app/Export/CSV/InvoiceExport.php @@ -99,6 +99,8 @@ class InvoiceExport extends BaseExport $report = $query->cursor() ->map(function ($resource) { + + /** @var \App\Models\Invoice $resource */ $row = $this->buildRow($resource); return $this->processMetaData($row, $resource); })->toArray(); @@ -119,6 +121,8 @@ class InvoiceExport extends BaseExport $query->cursor() ->each(function ($invoice) { + + /** @var \App\Models\Invoice $invoice */ $this->csv->insertOne($this->buildRow($invoice)); }); diff --git a/app/Export/CSV/InvoiceItemExport.php b/app/Export/CSV/InvoiceItemExport.php index 0e5efcac0b..14a38aebee 100644 --- a/app/Export/CSV/InvoiceItemExport.php +++ b/app/Export/CSV/InvoiceItemExport.php @@ -113,6 +113,8 @@ class InvoiceItemExport extends BaseExport $query->cursor() ->each(function ($resource) { + + /** @var \App\Models\Invoice $resource */ $this->iterateItems($resource); foreach($this->storage_array as $row) { @@ -141,6 +143,8 @@ class InvoiceItemExport extends BaseExport $query->cursor() ->each(function ($invoice) { + + /** @var \App\Models\Invoice $invoice */ $this->iterateItems($invoice); }); diff --git a/app/Export/CSV/PaymentExport.php b/app/Export/CSV/PaymentExport.php index d427b3ebe1..1675147812 100644 --- a/app/Export/CSV/PaymentExport.php +++ b/app/Export/CSV/PaymentExport.php @@ -92,6 +92,8 @@ class PaymentExport extends BaseExport $report = $query->cursor() ->map(function ($resource) { + + /** @var \App\Models\Payment $resource */ $row = $this->buildRow($resource); return $this->processMetaData($row, $resource); })->toArray(); @@ -112,6 +114,8 @@ class PaymentExport extends BaseExport $query->cursor() ->each(function ($entity) { + + /** @var \App\Models\Payment $entity */ $this->csv->insertOne($this->buildRow($entity)); }); diff --git a/app/Export/CSV/ProductExport.php b/app/Export/CSV/ProductExport.php index 69bdca55cf..dba1b86228 100644 --- a/app/Export/CSV/ProductExport.php +++ b/app/Export/CSV/ProductExport.php @@ -51,6 +51,8 @@ class ProductExport extends BaseExport $report = $query->cursor() ->map(function ($resource) { + + /** @var \App\Models\Product $resource */ $row = $this->buildRow($resource); return $this->processMetaData($row, $resource); })->toArray(); @@ -103,7 +105,9 @@ class ProductExport extends BaseExport $query->cursor() ->each(function ($entity) { - $this->csv->insertOne($this->buildRow($entity)); + + /** @var \App\Models\Product $entity */ + $this->csv->insertOne($this->buildRow($entity)); }); return $this->csv->toString(); diff --git a/app/Export/CSV/PurchaseOrderExport.php b/app/Export/CSV/PurchaseOrderExport.php index e1091dd667..1e60e26424 100644 --- a/app/Export/CSV/PurchaseOrderExport.php +++ b/app/Export/CSV/PurchaseOrderExport.php @@ -98,6 +98,8 @@ class PurchaseOrderExport extends BaseExport $report = $query->cursor() ->map(function ($resource) { + + /** @var \App\Models\PurchaseOrder $resource */ $row = $this->buildRow($resource); return $this->processMetaData($row, $resource); })->toArray(); @@ -119,7 +121,9 @@ class PurchaseOrderExport extends BaseExport $query->cursor() ->each(function ($purchase_order) { - $this->csv->insertOne($this->buildRow($purchase_order)); + + /** @var \App\Models\PurchaseOrder $purchase_order */ + $this->csv->insertOne($this->buildRow($purchase_order)); }); return $this->csv->toString(); diff --git a/app/Export/CSV/PurchaseOrderItemExport.php b/app/Export/CSV/PurchaseOrderItemExport.php index bf39cc26ef..4892436a60 100644 --- a/app/Export/CSV/PurchaseOrderItemExport.php +++ b/app/Export/CSV/PurchaseOrderItemExport.php @@ -101,13 +101,15 @@ class PurchaseOrderItemExport extends BaseExport $query->cursor() ->each(function ($resource) { - $this->iterateItems($resource); + + /** @var \App\Models\PurchaseOrder $resource */ + $this->iterateItems($resource); - foreach($this->storage_array as $row) { - $this->storage_item_array[] = $this->processItemMetaData($row, $resource); - } + foreach($this->storage_array as $row) { + $this->storage_item_array[] = $this->processItemMetaData($row, $resource); + } - $this->storage_array = []; + $this->storage_array = []; }); @@ -127,7 +129,9 @@ class PurchaseOrderItemExport extends BaseExport $query->cursor() ->each(function ($purchase_order) { - $this->iterateItems($purchase_order); + + /** @var \App\Models\PurchaseOrder $purchase_order */ + $this->iterateItems($purchase_order); }); $this->csv->insertAll($this->storage_array); diff --git a/app/Export/CSV/QuoteExport.php b/app/Export/CSV/QuoteExport.php index 7c77fd9905..4d404d4ca3 100644 --- a/app/Export/CSV/QuoteExport.php +++ b/app/Export/CSV/QuoteExport.php @@ -103,6 +103,8 @@ class QuoteExport extends BaseExport $report = $query->cursor() ->map(function ($resource) { + + /** @var \App\Models\Quote $resource */ $row = $this->buildRow($resource); return $this->processMetaData($row, $resource); })->toArray(); @@ -125,6 +127,8 @@ class QuoteExport extends BaseExport $query->cursor() ->each(function ($quote) { + + /** @var \App\Models\Quote $quote */ $this->csv->insertOne($this->buildRow($quote)); }); diff --git a/app/Export/CSV/QuoteItemExport.php b/app/Export/CSV/QuoteItemExport.php index ddc7279605..2e8e5a0089 100644 --- a/app/Export/CSV/QuoteItemExport.php +++ b/app/Export/CSV/QuoteItemExport.php @@ -104,6 +104,8 @@ class QuoteItemExport extends BaseExport $query->cursor() ->each(function ($resource) { + + /** @var \App\Models\Quote $resource */ $this->iterateItems($resource); foreach($this->storage_array as $row) { @@ -134,6 +136,8 @@ class QuoteItemExport extends BaseExport $query->cursor() ->each(function ($quote) { + + /** @var \App\Models\Quote $quote */ $this->iterateItems($quote); }); diff --git a/app/Export/CSV/RecurringInvoiceExport.php b/app/Export/CSV/RecurringInvoiceExport.php index d6d26e2834..62a2c78364 100644 --- a/app/Export/CSV/RecurringInvoiceExport.php +++ b/app/Export/CSV/RecurringInvoiceExport.php @@ -93,6 +93,8 @@ class RecurringInvoiceExport extends BaseExport $query->cursor() ->each(function ($invoice) { + + /** @var \App\Models\RecurringInvoice $invoice */ $this->csv->insertOne($this->buildRow($invoice)); }); @@ -112,6 +114,8 @@ class RecurringInvoiceExport extends BaseExport $report = $query->cursor() ->map(function ($resource) { + + /** @var \App\Models\RecurringInvoice $resource */ $row = $this->buildRow($resource); return $this->processMetaData($row, $resource); })->toArray(); diff --git a/app/Export/CSV/TaskExport.php b/app/Export/CSV/TaskExport.php index 98da6fda17..2acd8faa64 100644 --- a/app/Export/CSV/TaskExport.php +++ b/app/Export/CSV/TaskExport.php @@ -106,7 +106,9 @@ class TaskExport extends BaseExport $query->cursor() ->each(function ($entity) { - $this->buildRow($entity); + + /** @var \App\Models\Task $entity*/ + $this->buildRow($entity); }); $this->csv->insertAll($this->storage_array); @@ -128,6 +130,7 @@ class TaskExport extends BaseExport $query->cursor() ->each(function ($resource) { + /** @var \App\Models\Task $resource*/ $this->buildRow($resource); foreach($this->storage_array as $row) { diff --git a/app/Export/CSV/VendorExport.php b/app/Export/CSV/VendorExport.php index abb682f655..799fca7a07 100644 --- a/app/Export/CSV/VendorExport.php +++ b/app/Export/CSV/VendorExport.php @@ -90,6 +90,8 @@ class VendorExport extends BaseExport $report = $query->cursor() ->map(function ($resource) { + + /** @var \App\Models\Vendor $resource */ $row = $this->buildRow($resource); return $this->processMetaData($row, $resource); })->toArray(); @@ -107,7 +109,9 @@ class VendorExport extends BaseExport $query->cursor() ->each(function ($vendor) { - $this->csv->insertOne($this->buildRow($vendor)); + + /** @var \App\Models\Vendor $vendor */ + $this->csv->insertOne($this->buildRow($vendor)); }); return $this->csv->toString(); diff --git a/app/Helpers/Mail/GmailTransport.php b/app/Helpers/Mail/GmailTransport.php index 1be44af736..5dd8492191 100644 --- a/app/Helpers/Mail/GmailTransport.php +++ b/app/Helpers/Mail/GmailTransport.php @@ -31,7 +31,7 @@ class GmailTransport extends AbstractTransport protected function doSend(SentMessage $message): void { nlog("In Do Send"); - $message = MessageConverter::toEmail($message->getOriginalMessage()); + $message = MessageConverter::toEmail($message->getOriginalMessage()); //@phpstan-ignore-line /** @phpstan-ignore-next-line **/ $token = $message->getHeaders()->get('gmailtoken')->getValue(); // @phpstan-ignore-line diff --git a/app/Helpers/Mail/Office365MailTransport.php b/app/Helpers/Mail/Office365MailTransport.php index c5cf6fa912..4a6f49a70b 100644 --- a/app/Helpers/Mail/Office365MailTransport.php +++ b/app/Helpers/Mail/Office365MailTransport.php @@ -25,7 +25,8 @@ class Office365MailTransport extends AbstractTransport protected function doSend(SentMessage $message): void { - $symfony_message = MessageConverter::toEmail($message->getOriginalMessage()); + $symfony_message = MessageConverter::toEmail($message->getOriginalMessage()); //@phpstan-ignore-line + $graph = new Graph(); diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index fdad076770..3f8201c75a 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -376,6 +376,7 @@ class LoginController extends BaseController /** @var \App\Models\User $user */ $user = auth()->user(); + /** @var Builder $cu */ $cu = CompanyUser::query()->where('user_id', $user->id); if ($cu->count() == 0) { @@ -398,18 +399,15 @@ class LoginController extends BaseController $truth->setCompany($set_company); //21-03-2024 + + $cu->each(function ($cu) { - if(CompanyToken::where('company_id', $cu->company_id)->where('user_id', $cu->user_id)->where('is_system', true)->doesntExist()) { + /** @var \App\Models\CompanyUser $cu */ + if(CompanyToken::query()->where('company_id', $cu->company_id)->where('user_id', $cu->user_id)->where('is_system', true)->doesntExist()) { (new CreateCompanyToken($cu->company, $cu->user, request()->server('HTTP_USER_AGENT')))->handle(); } }); - // $user->account->companies->each(function ($company) use ($user) { - // if ($company->tokens()->where('user_id',$user->id)->where('is_system', true)->count() == 0) { - // (new CreateCompanyToken($company, $user, request()->server('HTTP_USER_AGENT')))->handle(); - // } - // }); - $truth->setCompanyToken(CompanyToken::where('user_id', $user->id)->where('company_id', $set_company->id)->where('is_system', true)->first()); return CompanyUser::query()->where('user_id', $user->id); diff --git a/app/Http/Controllers/Bank/YodleeController.php b/app/Http/Controllers/Bank/YodleeController.php index 84dae2618a..d7057848eb 100644 --- a/app/Http/Controllers/Bank/YodleeController.php +++ b/app/Http/Controllers/Bank/YodleeController.php @@ -97,7 +97,7 @@ class YodleeController extends BaseController } $company->account->bank_integrations->where("integration_type", BankIntegration::INTEGRATION_TYPE_YODLEE)->where('auto_sync', true)->each(function ($bank_integration) use ($company) { // TODO: filter to yodlee only - ProcessBankTransactionsYodlee::dispatch($company->account->id, $bank_integration); + ProcessBankTransactionsYodlee::dispatch($company->account->bank_integration_account_id, $bank_integration); }); } diff --git a/app/Http/Controllers/BankIntegrationController.php b/app/Http/Controllers/BankIntegrationController.php index 1cc7e3a219..6701f1e65f 100644 --- a/app/Http/Controllers/BankIntegrationController.php +++ b/app/Http/Controllers/BankIntegrationController.php @@ -197,6 +197,7 @@ class BankIntegrationController extends BaseController /** @var \App\Models\User $user */ $user = auth()->user(); + /** @var \App\Models\Account $user_account */ $user_account = $user->account; $this->refreshAccountsYodlee($user); @@ -210,12 +211,14 @@ class BankIntegrationController extends BaseController // Processing transactions for each bank account if (Ninja::isHosted() && $user->account->bank_integration_account_id) { $user_account->bank_integrations->where("integration_type", BankIntegration::INTEGRATION_TYPE_YODLEE)->each(function ($bank_integration) use ($user_account) { - ProcessBankTransactionsYodlee::dispatch($user_account->id, $bank_integration); + /** @var \App\Models\BankIntegration $bank_integration */ + ProcessBankTransactionsYodlee::dispatch($user_account->bank_integration_account_id, $bank_integration); }); } if (config('ninja.nordigen.secret_id') && config('ninja.nordigen.secret_key') && (Ninja::isSelfHost() || (Ninja::isHosted() && $user_account->isEnterprisePaidClient()))) { - $user_account->bank_integrations->where("integration_type", BankIntegration::INTEGRATION_TYPE_NORDIGEN)->each(function ($bank_integration) { + $user_account->bank_integrations->where("integration_type", BankIntegration::INTEGRATION_TYPE_NORDIGEN)->each(function ($bank_integration) { + /** @var \App\Models\BankIntegration $bank_integration */ ProcessBankTransactionsNordigen::dispatch($bank_integration); }); } @@ -345,7 +348,7 @@ class BankIntegrationController extends BaseController if (Ninja::isHosted() && $account->isPaid() && $account->plan == 'enterprise') { $account->bank_integrations()->where('integration_type', BankIntegration::INTEGRATION_TYPE_YODLEE)->where('auto_sync', true)->cursor()->each(function ($bank_integration) use ($account) { - (new ProcessBankTransactionsYodlee($account->id, $bank_integration))->handle(); + (new ProcessBankTransactionsYodlee($account->bank_integration_account_id, $bank_integration))->handle(); }); } diff --git a/app/Http/Controllers/BaseController.php b/app/Http/Controllers/BaseController.php index 74934925da..55c82d0aeb 100644 --- a/app/Http/Controllers/BaseController.php +++ b/app/Http/Controllers/BaseController.php @@ -653,7 +653,7 @@ class BaseController extends Controller /** * Passes back the miniloaded data response * - * @param Builder $query + * @param mixed $query * */ protected function timeConstrainedResponse($query) @@ -894,11 +894,7 @@ class BaseController extends Controller $resource->setPaginator(new IlluminatePaginatorAdapter($paginator)); } - // else { - // $resource = new Collection($query, $transformer, $this->entity_type); - // } - - return $this->response($this->manager->createData($resource)->toArray()); + return $this->response($this->manager->createData($resource)->toArray()); //@phpstan-ignore-line } /** diff --git a/app/Http/Controllers/ClientPortal/PaymentController.php b/app/Http/Controllers/ClientPortal/PaymentController.php index 7efd13510a..728df5eb1d 100644 --- a/app/Http/Controllers/ClientPortal/PaymentController.php +++ b/app/Http/Controllers/ClientPortal/PaymentController.php @@ -209,7 +209,7 @@ class PaymentController extends Controller if (property_exists($payment_hash->data, 'billing_context')) { $billing_subscription = \App\Models\Subscription::find($this->decodePrimaryKey($payment_hash->data->billing_context->subscription_id)); - + /** @var \App\Models\Subscription $billing_subscription */ return (new SubscriptionService($billing_subscription))->completePurchase($payment_hash); } diff --git a/app/Http/Controllers/DocumentController.php b/app/Http/Controllers/DocumentController.php index 2a66c150f3..776390a401 100644 --- a/app/Http/Controllers/DocumentController.php +++ b/app/Http/Controllers/DocumentController.php @@ -183,7 +183,7 @@ class DocumentController extends BaseController } if ($action == 'download') { - ZipDocuments::dispatch($documents->pluck('id'), $user->company(), auth()->user()); + ZipDocuments::dispatch($documents->pluck('id'), $user->company(), auth()->user()); //@phpstan-ignore-line return response()->json(['message' => ctrans('texts.sent_message')], 200); } diff --git a/app/Http/Controllers/PaymentNotificationWebhookController.php b/app/Http/Controllers/PaymentNotificationWebhookController.php index 2eb637d5e1..a7ab8b0c3c 100644 --- a/app/Http/Controllers/PaymentNotificationWebhookController.php +++ b/app/Http/Controllers/PaymentNotificationWebhookController.php @@ -24,8 +24,9 @@ class PaymentNotificationWebhookController extends Controller public function __invoke(PaymentNotificationWebhookRequest $request, string $company_key, string $company_gateway_id, string $client_hash) { /** @var \App\Models\CompanyGateway $company_gateway */ - $company_gateway = CompanyGateway::find($this->decodePrimaryKey($company_gateway_id)); + + /** @var \App\Models\Client $client */ $client = Client::find($this->decodePrimaryKey($client_hash)); return $company_gateway diff --git a/app/Http/Controllers/PreviewController.php b/app/Http/Controllers/PreviewController.php index e1db201eab..db7b705898 100644 --- a/app/Http/Controllers/PreviewController.php +++ b/app/Http/Controllers/PreviewController.php @@ -125,7 +125,7 @@ class PreviewController extends BaseController $response = Response::make($pdf, 200); $response->header('Content-Type', 'application/pdf'); - $response->header('Server-Timing', microtime(true) - $start); + $response->header('Server-Timing', (string) (microtime(true) - $start)); return $response; } diff --git a/app/Http/Requests/Client/UpdateClientRequest.php b/app/Http/Requests/Client/UpdateClientRequest.php index 81da5af205..ad8944c2df 100644 --- a/app/Http/Requests/Client/UpdateClientRequest.php +++ b/app/Http/Requests/Client/UpdateClientRequest.php @@ -11,13 +11,14 @@ namespace App\Http\Requests\Client; -use App\DataMapper\CompanySettings; use App\Http\Requests\Request; -use App\Http\ValidationRules\ValidClientGroupSettingsRule; -use App\Utils\Traits\ChecksEntityStatus; use App\Utils\Traits\MakesHash; -use Illuminate\Support\Facades\Cache; use Illuminate\Validation\Rule; +use App\DataMapper\CompanySettings; +use Illuminate\Support\Facades\Cache; +use App\Utils\Traits\ChecksEntityStatus; +use App\Http\ValidationRules\EInvoice\ValidClientScheme; +use App\Http\ValidationRules\ValidClientGroupSettingsRule; class UpdateClientRequest extends Request { @@ -66,6 +67,8 @@ class UpdateClientRequest extends Request $rules['id_number'] = ['sometimes', 'bail', 'nullable', Rule::unique('clients')->where('company_id', $user->company()->id)->ignore($this->client->id)]; $rules['number'] = ['sometimes', 'bail', Rule::unique('clients')->where('company_id', $user->company()->id)->ignore($this->client->id)]; + $rules['e_invoice'] = ['sometimes','nullable', new ValidClientScheme()]; + $rules['settings'] = new ValidClientGroupSettingsRule(); $rules['contacts'] = 'array'; $rules['contacts.*.email'] = 'bail|nullable|distinct|sometimes|email'; diff --git a/app/Http/Requests/ClientPortal/PaymentMethod/CreatePaymentMethodRequest.php b/app/Http/Requests/ClientPortal/PaymentMethod/CreatePaymentMethodRequest.php index 272e8e1bf2..a50352b9b0 100644 --- a/app/Http/Requests/ClientPortal/PaymentMethod/CreatePaymentMethodRequest.php +++ b/app/Http/Requests/ClientPortal/PaymentMethod/CreatePaymentMethodRequest.php @@ -29,7 +29,7 @@ class CreatePaymentMethodRequest extends FormRequest $available_methods = []; collect($client->service()->getPaymentMethods(-1)) - ->filter(function ($method) use (&$available_methods) { + ->filter(function ($method) use (&$available_methods) { //@phpstan-ignore-line $available_methods[] = $method['gateway_type_id']; }); diff --git a/app/Http/Requests/CompanyGateway/StoreCompanyGatewayRequest.php b/app/Http/Requests/CompanyGateway/StoreCompanyGatewayRequest.php index d182cb52b3..c010614953 100644 --- a/app/Http/Requests/CompanyGateway/StoreCompanyGatewayRequest.php +++ b/app/Http/Requests/CompanyGateway/StoreCompanyGatewayRequest.php @@ -48,7 +48,7 @@ class StoreCompanyGatewayRequest extends Request { $input = $this->all(); - if ($gateway = Gateway::where('key', $input['gateway_key'])->first()) { + if ($gateway = Gateway::query()->where('key', $input['gateway_key'])->first()) { $default_gateway_fields = json_decode($gateway->fields); /*Force gateway properties */ diff --git a/app/Http/Requests/CompanyGateway/UpdateCompanyGatewayRequest.php b/app/Http/Requests/CompanyGateway/UpdateCompanyGatewayRequest.php index 61feb38b7d..1aafecd709 100644 --- a/app/Http/Requests/CompanyGateway/UpdateCompanyGatewayRequest.php +++ b/app/Http/Requests/CompanyGateway/UpdateCompanyGatewayRequest.php @@ -48,7 +48,7 @@ class UpdateCompanyGatewayRequest extends Request /*Force gateway properties */ if (isset($input['config']) && is_object(json_decode($input['config'])) && array_key_exists('gateway_key', $input)) { - $gateway = Gateway::where('key', $input['gateway_key'])->first(); + $gateway = Gateway::query()->where('key', $input['gateway_key'])->first(); $default_gateway_fields = json_decode($gateway->fields); foreach (json_decode($input['config']) as $key => $value) { diff --git a/app/Http/Requests/RecurringExpense/BulkRecurringExpenseRequest.php b/app/Http/Requests/RecurringExpense/BulkRecurringExpenseRequest.php index 9dffb4f437..2c2cdc9e7d 100644 --- a/app/Http/Requests/RecurringExpense/BulkRecurringExpenseRequest.php +++ b/app/Http/Requests/RecurringExpense/BulkRecurringExpenseRequest.php @@ -34,7 +34,10 @@ class BulkRecurringExpenseRequest extends Request return false; } - return auth()->user()->can(auth()->user()->isAdmin(), RecurringExpense::class); + /** @var \App\Models\User $user */ + $user = auth()->user(); + + return $user->can('edit', RecurringExpense::class); } /** diff --git a/app/Http/Requests/Vendor/BulkVendorRequest.php b/app/Http/Requests/Vendor/BulkVendorRequest.php index fb0dd93ef9..5f9d01e56a 100644 --- a/app/Http/Requests/Vendor/BulkVendorRequest.php +++ b/app/Http/Requests/Vendor/BulkVendorRequest.php @@ -34,7 +34,11 @@ class BulkVendorRequest extends Request return false; } - return auth()->user()->can(auth()->user()->isAdmin(), Vendor::class); + /** @var \App\Models\User $user */ + $user = auth()->user(); + + return $user->can('edit', Vendor::class); + } /** diff --git a/app/Jobs/Bank/MatchBankTransactions.php b/app/Jobs/Bank/MatchBankTransactions.php index c377a9c05d..326d995258 100644 --- a/app/Jobs/Bank/MatchBankTransactions.php +++ b/app/Jobs/Bank/MatchBankTransactions.php @@ -448,6 +448,6 @@ class MatchBankTransactions implements ShouldQueue public function middleware() { - return [new WithoutOverlapping($this->company_id)]; + return [new WithoutOverlapping($this->company->account->bank_integration_account_id)]; } } diff --git a/app/Jobs/Bank/ProcessBankTransactionsYodlee.php b/app/Jobs/Bank/ProcessBankTransactionsYodlee.php index 3b651fc9a0..7ffb7791fa 100644 --- a/app/Jobs/Bank/ProcessBankTransactionsYodlee.php +++ b/app/Jobs/Bank/ProcessBankTransactionsYodlee.php @@ -35,10 +35,6 @@ class ProcessBankTransactionsYodlee implements ShouldQueue use Queueable; use SerializesModels; - private string $bank_integration_account_id; - - private BankIntegration $bank_integration; - private ?string $from_date; private bool $stop_loop = true; @@ -50,10 +46,8 @@ class ProcessBankTransactionsYodlee implements ShouldQueue /** * Create a new job instance. */ - public function __construct(string $bank_integration_account_id, BankIntegration $bank_integration) + public function __construct(private string $bank_integration_account_id, private BankIntegration $bank_integration) { - $this->bank_integration_account_id = $bank_integration_account_id; - $this->bank_integration = $bank_integration; $this->from_date = $bank_integration->from_date; $this->company = $this->bank_integration->company; } diff --git a/app/Jobs/Brevo/ProcessBrevoWebhook.php b/app/Jobs/Brevo/ProcessBrevoWebhook.php index e6ef60a752..b81772fd2c 100644 --- a/app/Jobs/Brevo/ProcessBrevoWebhook.php +++ b/app/Jobs/Brevo/ProcessBrevoWebhook.php @@ -93,8 +93,7 @@ class ProcessBrevoWebhook implements ShouldQueue { MultiDB::findAndSetDbByCompanyKey($this->request['tags'][0]); - /** @phpstan-ignore-next-line */ - $this->company = Company::where('company_key', $this->request['tags'][0])->first(); + $this->company = Company::query()->where('company_key', $this->request['tags'][0])->first(); $this->invitation = $this->discoverInvitation($this->request['message-id']); diff --git a/app/Jobs/Client/CheckVat.php b/app/Jobs/Client/CheckVat.php index d8637b9f6a..ed35f1eaf2 100644 --- a/app/Jobs/Client/CheckVat.php +++ b/app/Jobs/Client/CheckVat.php @@ -58,7 +58,7 @@ class CheckVat implements ShouldQueue public function middleware() { - return [new WithoutOverlapping($this->client->id)]; + return [new WithoutOverlapping($this->client->client_hash)]; } } diff --git a/app/Jobs/Company/CompanyExport.php b/app/Jobs/Company/CompanyExport.php index 4f7c571ec4..3885c05e7d 100644 --- a/app/Jobs/Company/CompanyExport.php +++ b/app/Jobs/Company/CompanyExport.php @@ -108,7 +108,8 @@ class CompanyExport implements ShouldQueue $this->export_data['users'] = $this->company->users()->withTrashed()->cursor()->map(function ($user) { - $user->account_id = $this->encodePrimaryKey($user->account_id); + /** @var \App\Models\User $user */ + $user->account_id = $this->encodePrimaryKey($user->account_id); //@phpstan-ignore-line return $user; })->all(); diff --git a/app/Jobs/Company/CompanyTaxRate.php b/app/Jobs/Company/CompanyTaxRate.php index ec659ed052..684065952a 100644 --- a/app/Jobs/Company/CompanyTaxRate.php +++ b/app/Jobs/Company/CompanyTaxRate.php @@ -94,7 +94,7 @@ class CompanyTaxRate implements ShouldQueue public function middleware() { - return [new WithoutOverlapping($this->company->id)]; + return [new WithoutOverlapping($this->company->company_key)]; } public function failed($e) diff --git a/app/Jobs/Cron/AutoBillCron.php b/app/Jobs/Cron/AutoBillCron.php index ddd8e6ca2b..9f708d95c7 100644 --- a/app/Jobs/Cron/AutoBillCron.php +++ b/app/Jobs/Cron/AutoBillCron.php @@ -65,7 +65,7 @@ class AutoBillCron $auto_bill_partial_invoices->chunk(400, function ($invoices) { foreach ($invoices as $invoice) { - AutoBill::dispatch($invoice->id, false); + AutoBill::dispatch($invoice->id, null); } sleep(2); @@ -87,7 +87,7 @@ class AutoBillCron $auto_bill_invoices->chunk(400, function ($invoices) { foreach ($invoices as $invoice) { - AutoBill::dispatch($invoice->id, false); + AutoBill::dispatch($invoice->id, null); } sleep(2); diff --git a/app/Jobs/Document/CopyDocs.php b/app/Jobs/Document/CopyDocs.php index e0f091b301..5cbe9e6d61 100644 --- a/app/Jobs/Document/CopyDocs.php +++ b/app/Jobs/Document/CopyDocs.php @@ -47,10 +47,12 @@ class CopyDocs implements ShouldQueue { MultiDB::setDb($this->db); - Document::whereIn('id', $this->document_ids) + Document::query() + ->whereIn('id', $this->document_ids) ->where('company_id', $this->entity->company_id) ->each(function ($document) { + /** @var \App\Models\Document $document */ $file = $document->getFile(); $extension = pathinfo($document->name, PATHINFO_EXTENSION); diff --git a/app/Jobs/Invoice/CreateUbl.php b/app/Jobs/Invoice/CreateUbl.php index cd018b4ed9..b98c3e91ab 100644 --- a/app/Jobs/Invoice/CreateUbl.php +++ b/app/Jobs/Invoice/CreateUbl.php @@ -63,7 +63,7 @@ class CreateUbl implements ShouldQueue // invoice $ubl_invoice->setId($invoice->number); $ubl_invoice->setIssueDate(date_create($invoice->date)); - $ubl_invoice->setInvoiceTypeCode($invoice->amount < 0 ? self::INVOICE_TYPE_CREDIT : self::INVOICE_TYPE_STANDARD); + $ubl_invoice->setInvoiceTypeCode($invoice->amount < 0 ? (string)self::INVOICE_TYPE_CREDIT : (string)self::INVOICE_TYPE_STANDARD); $supplier_party = $this->createParty($company, $invoice->user); $ubl_invoice->setAccountingSupplierParty($supplier_party); diff --git a/app/Jobs/Ledger/ClientLedgerBalanceUpdate.php b/app/Jobs/Ledger/ClientLedgerBalanceUpdate.php index a8171e517e..628344fe16 100644 --- a/app/Jobs/Ledger/ClientLedgerBalanceUpdate.php +++ b/app/Jobs/Ledger/ClientLedgerBalanceUpdate.php @@ -75,6 +75,6 @@ class ClientLedgerBalanceUpdate implements ShouldQueue public function middleware() { - return [(new WithoutOverlapping($this->client->id))->dontRelease()]; + return [(new WithoutOverlapping($this->client->client_hash))->dontRelease()]; } } diff --git a/app/Jobs/Mailgun/ProcessMailgunWebhook.php b/app/Jobs/Mailgun/ProcessMailgunWebhook.php index 62f400a2bf..73d32f39e9 100644 --- a/app/Jobs/Mailgun/ProcessMailgunWebhook.php +++ b/app/Jobs/Mailgun/ProcessMailgunWebhook.php @@ -94,7 +94,7 @@ class ProcessMailgunWebhook implements ShouldQueue } MultiDB::findAndSetDbByCompanyKey($this->request['event-data']['tags'][0]); - $company = Company::where('company_key', $this->request['event-data']['tags'][0])->first(); + $company = Company::query()->where('company_key', $this->request['event-data']['tags'][0])->first(); if ($company && $this->request['event-data']['event'] == 'complained' && config('ninja.notification.slack')) { $company->notification(new EmailSpamNotification($company))->ninja(); diff --git a/app/Jobs/PostMark/ProcessPostmarkWebhook.php b/app/Jobs/PostMark/ProcessPostmarkWebhook.php index 5f56945a2d..9e489bb6b6 100644 --- a/app/Jobs/PostMark/ProcessPostmarkWebhook.php +++ b/app/Jobs/PostMark/ProcessPostmarkWebhook.php @@ -87,7 +87,7 @@ class ProcessPostmarkWebhook implements ShouldQueue public function handle() { MultiDB::findAndSetDbByCompanyKey($this->request['Tag']); - $this->company = Company::where('company_key', $this->request['Tag'])->first(); /** @phpstan-ignore-line */ + $this->company = Company::query()->where('company_key', $this->request['Tag'])->first(); /** @phpstan-ignore-line */ $this->invitation = $this->discoverInvitation($this->request['MessageID']); diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index 01775fee78..f422c4014c 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -253,7 +253,7 @@ class Import implements ShouldQueue $this->setInitialCompanyLedgerBalances(); // $this->fixClientBalances(); - $check_data = (new CheckCompanyData($this->company, md5(time())))->handle(); + $check_data = (new CheckCompanyData($this->company, md5(time())))->handle(); //@phpstan-ignore-line // if(Ninja::isHosted() && array_key_exists('ninja_tokens', $data)) $this->processNinjaTokens($data['ninja_tokens']); diff --git a/app/Jobs/Util/UploadAvatar.php b/app/Jobs/Util/UploadAvatar.php index d010eebef9..e4bd904373 100644 --- a/app/Jobs/Util/UploadAvatar.php +++ b/app/Jobs/Util/UploadAvatar.php @@ -38,7 +38,7 @@ class UploadAvatar implements ShouldQueue public function handle(): ?string { - $tmp_file = sha1(time()).'.png'; + $tmp_file = sha1(time()).'.png'; //@phpstan-ignore-line $im = imagecreatefromstring(file_get_contents($this->file)); imagealphablending($im, false); diff --git a/app/Jobs/Util/VersionCheck.php b/app/Jobs/Util/VersionCheck.php index 9e604ab030..e829c41f55 100644 --- a/app/Jobs/Util/VersionCheck.php +++ b/app/Jobs/Util/VersionCheck.php @@ -94,7 +94,7 @@ class VersionCheck implements ShouldQueue Client::doesntHave('contacts') ->cursor() - ->each(function (Client $client) { + ->each(function (Client $client) { //@phpstan-ignore-line $new_contact = ClientContactFactory::create($client->company_id, $client->user_id); $new_contact->client_id = $client->id; @@ -107,7 +107,7 @@ class VersionCheck implements ShouldQueue Vendor::doesntHave('contacts') ->cursor() - ->each(function (Vendor $vendor) { + ->each(function (Vendor $vendor) { //@phpstan-ignore-line $new_contact = VendorContactFactory::create($vendor->company_id, $vendor->user_id); $new_contact->vendor_id = $vendor->id; diff --git a/app/Libraries/InApp/StoreKit/Apple.php b/app/Libraries/InApp/StoreKit/Apple.php index 7416c8aa17..72a280b44d 100644 --- a/app/Libraries/InApp/StoreKit/Apple.php +++ b/app/Libraries/InApp/StoreKit/Apple.php @@ -58,7 +58,7 @@ class Apple 'bid' => $this->bundle_id, ]; - $jwt = JWT::encode($payload, $this->private_key, $this->alg, $header); + $jwt = JWT::encode($payload, $this->private_key, $this->alg, null, $header); $decoded = JWT::decode($jwt, new Key($this->private_key, $this->alg)); diff --git a/app/Models/Backup.php b/app/Models/Backup.php index 409399ce91..62a393d7cf 100644 --- a/app/Models/Backup.php +++ b/app/Models/Backup.php @@ -61,7 +61,7 @@ class Backup extends BaseModel } $path = $client_or_vendor->backup_path().'/'; - $filename = now()->format('Y_m_d').'_'.md5(time()).'.html'; + $filename = now()->format('Y_m_d').'_'.md5(time()).'.html'; //@phpstan-ignore-line $file_path = $path.$filename; Storage::disk(config('filesystems.default'))->put($file_path, $html); diff --git a/app/Models/BankTransaction.php b/app/Models/BankTransaction.php index 77f2219f90..8dd87d8834 100644 --- a/app/Models/BankTransaction.php +++ b/app/Models/BankTransaction.php @@ -38,7 +38,7 @@ use Illuminate\Database\Eloquent\SoftDeletes; * @property string|null $participant * @property string|null $participant_name * @property string $invoice_ids - * @property int|null $expense_id + * @property string|null $expense_id * @property int|null $vendor_id * @property int $status_id * @property bool $is_deleted diff --git a/app/Models/Client.php b/app/Models/Client.php index 171fbd97ec..3aa29455c3 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -573,7 +573,7 @@ class Client extends BaseModel implements HasLocalePreference if ($pm['gateway_type_id'] == GatewayType::BACS) { $cg = CompanyGateway::query()->find($pm['company_gateway_id']); - if ($cg && ! property_exists($cg->fees_and_limits, GatewayType::BACS)) { + if ($cg && ! property_exists($cg->fees_and_limits, GatewayType::BACS)) { //@phpstan-ignore-line $fees_and_limits = $cg->fees_and_limits; $fees_and_limits->{GatewayType::BACS} = new FeesAndLimits(); $cg->fees_and_limits = $fees_and_limits; @@ -597,7 +597,7 @@ class Client extends BaseModel implements HasLocalePreference if ($pm['gateway_type_id'] == GatewayType::ACSS) { $cg = CompanyGateway::query()->find($pm['company_gateway_id']); - if ($cg && ! property_exists($cg->fees_and_limits, GatewayType::ACSS)) { + if ($cg && ! property_exists($cg->fees_and_limits, GatewayType::ACSS)) { //@phpstan-ignore-line $fees_and_limits = $cg->fees_and_limits; $fees_and_limits->{GatewayType::ACSS} = new FeesAndLimits(); $cg->fees_and_limits = $fees_and_limits; @@ -624,7 +624,7 @@ class Client extends BaseModel implements HasLocalePreference if ($pm['gateway_type_id'] == GatewayType::BANK_TRANSFER) { $cg = CompanyGateway::query()->find($pm['company_gateway_id']); - if ($cg && ! property_exists($cg->fees_and_limits, GatewayType::BANK_TRANSFER)) { + if ($cg && ! property_exists($cg->fees_and_limits, GatewayType::BANK_TRANSFER)) { //@phpstan-ignore-line $fees_and_limits = $cg->fees_and_limits; $fees_and_limits->{GatewayType::BANK_TRANSFER} = new FeesAndLimits(); $cg->fees_and_limits = $fees_and_limits; diff --git a/app/Models/DateFormat.php b/app/Models/DateFormat.php index 3801e1146a..3df85c6501 100644 --- a/app/Models/DateFormat.php +++ b/app/Models/DateFormat.php @@ -59,7 +59,7 @@ class DateFormat extends StaticModel */ public function __toString() { - $date = mktime(0, 0, 0, 12, 31, date('Y')); + $date = mktime(0, 0, 0, 12, 31, date('Y')); //@phpstan-ignore-line return date($this->format, $date); } diff --git a/app/Models/DatetimeFormat.php b/app/Models/DatetimeFormat.php index 0c9e88c223..7c031b00d4 100644 --- a/app/Models/DatetimeFormat.php +++ b/app/Models/DatetimeFormat.php @@ -32,7 +32,7 @@ class DatetimeFormat extends StaticModel */ public function __toString() { - $date = mktime(0, 0, 0, 12, 31, date('Y')); + $date = mktime(0, 0, 0, 12, 31, date('Y')); //@phpstan-ignore-line return date($this->format, $date); } diff --git a/app/Models/Gateway.php b/app/Models/Gateway.php index 5d8c20d7c4..46ae2abc56 100644 --- a/app/Models/Gateway.php +++ b/app/Models/Gateway.php @@ -24,7 +24,7 @@ namespace App\Models; * @property string|null $site_url * @property bool $is_offsite * @property bool $is_secure - * @property object|null $fields + * @property object|null|string $fields * @property string $default_gateway_type_id * @property int|null $created_at * @property int|null $updated_at diff --git a/app/PaymentDrivers/BaseDriver.php b/app/PaymentDrivers/BaseDriver.php index e3720e0a3d..3b134ba355 100644 --- a/app/PaymentDrivers/BaseDriver.php +++ b/app/PaymentDrivers/BaseDriver.php @@ -375,6 +375,7 @@ class BaseDriver extends AbstractPaymentDriver // To access campaign data => Cache::get(CAMPAIGN_HASH) // To access utm data => session()->get('utm-' . CAMPAIGN_HASH); + /** @var \App\Models\Subscription $billing_subscription */ (new SubscriptionService($billing_subscription))->completePurchase($this->payment_hash); } diff --git a/app/PaymentDrivers/Braintree/CreditCard.php b/app/PaymentDrivers/Braintree/CreditCard.php index 8ba6e0154f..3ab0fdbe3d 100644 --- a/app/PaymentDrivers/Braintree/CreditCard.php +++ b/app/PaymentDrivers/Braintree/CreditCard.php @@ -83,7 +83,7 @@ class CreditCard if ($this->braintree->company_gateway->getConfigField('merchantAccountId')) { /** https://developer.paypal.com/braintree/docs/reference/request/client-token/generate#merchant_account_id */ - $data['client_token'] = $this->braintree->gateway->clientToken()->generate([ + $data['client_token'] = $this->braintree->gateway->clientToken()->generate([ //@phpstan-ignore-line 'merchantAccountId' => $this->braintree->company_gateway->getConfigField('merchantAccountId'), ]); } @@ -118,7 +118,7 @@ class CreditCard $token = $this->getPaymentToken($request->all(), $customer->id); $data = [ - 'amount' => $this->braintree->payment_hash->data->amount_with_fee, + 'amount' => $this->braintree->payment_hash->data->amount_with_fee, //@phpstan-ignore-line 'paymentMethodToken' => $token, 'deviceData' => $state['client-data'], 'options' => [ diff --git a/app/PaymentDrivers/BraintreePaymentDriver.php b/app/PaymentDrivers/BraintreePaymentDriver.php index 74a7e7813e..2e95394fe5 100644 --- a/app/PaymentDrivers/BraintreePaymentDriver.php +++ b/app/PaymentDrivers/BraintreePaymentDriver.php @@ -387,7 +387,7 @@ class BraintreePaymentDriver extends BaseDriver foreach($cards as $card) { - if($this->getToken($card->token, $card->customerId) || Carbon::createFromDate($card->expirationYear, $card->expirationMonth, '1')->lt(now())) { + if($this->getToken($card->token, $card->customerId) || Carbon::createFromDate($card->expirationYear, $card->expirationMonth, '1')->lt(now())) { //@phpstan-ignore-line continue; } diff --git a/app/PaymentDrivers/CheckoutComPaymentDriver.php b/app/PaymentDrivers/CheckoutComPaymentDriver.php index 03b161d076..b90ce37226 100644 --- a/app/PaymentDrivers/CheckoutComPaymentDriver.php +++ b/app/PaymentDrivers/CheckoutComPaymentDriver.php @@ -592,7 +592,7 @@ class CheckoutComPaymentDriver extends BaseDriver foreach($customer['instruments'] as $card) { if( $card['type'] != 'card' || - Carbon::createFromDate($card['expiry_year'], $card['expiry_month'], '1')->lt(now()) || + Carbon::createFromDate($card['expiry_year'], $card['expiry_month'], '1')->lt(now()) || //@phpstan-ignore-line $this->getToken($card['id'], $customer['id']) ) { continue; diff --git a/app/PaymentDrivers/PayPal/PayPalWebhook.php b/app/PaymentDrivers/PayPal/PayPalWebhook.php index 701f2817c3..744230dee6 100644 --- a/app/PaymentDrivers/PayPal/PayPalWebhook.php +++ b/app/PaymentDrivers/PayPal/PayPalWebhook.php @@ -297,7 +297,6 @@ class PayPalWebhook implements ShouldQueue $gateway = CompanyGateway::query() ->where('company_id', $company->id) ->where('gateway_key', $this->gateway_key) - ->cursor() ->first(function ($cg) use ($merchant_id) { $config = $cg->getConfig(); diff --git a/app/PaymentDrivers/SquarePaymentDriver.php b/app/PaymentDrivers/SquarePaymentDriver.php index 8e590059e5..456d69586e 100644 --- a/app/PaymentDrivers/SquarePaymentDriver.php +++ b/app/PaymentDrivers/SquarePaymentDriver.php @@ -188,7 +188,7 @@ class SquarePaymentDriver extends BaseDriver } else { /** @var \Square\Models\Error $error */ - $error = end($apiResponse->getErrors()); + $error = end($apiResponse->getErrors()); //@phpstan-ignore-line $data = [ 'transaction_reference' => $payment->transaction_reference, diff --git a/app/PaymentDrivers/Stripe/ACSS.php b/app/PaymentDrivers/Stripe/ACSS.php index 38e3a8162c..7ef4fa2dde 100644 --- a/app/PaymentDrivers/Stripe/ACSS.php +++ b/app/PaymentDrivers/Stripe/ACSS.php @@ -267,6 +267,7 @@ class ACSS $gateway_response = json_decode($request->gateway_response); + /** @var \App\Models\ClientGatewayToken $cgt */ $cgt = ClientGatewayToken::find($this->decodePrimaryKey($request->token)); /** @var \Stripe\PaymentIntent $intent */ diff --git a/app/PaymentDrivers/Stripe/ImportCustomers.php b/app/PaymentDrivers/Stripe/ImportCustomers.php index 3f96dd97d9..7eef0391e6 100644 --- a/app/PaymentDrivers/Stripe/ImportCustomers.php +++ b/app/PaymentDrivers/Stripe/ImportCustomers.php @@ -208,7 +208,7 @@ class ImportCustomers if (! $cgt) { nlog('customer '.$searchResults->data[0]->id.' does not exist.'); - $this->update_payment_methods->updateMethods($searchResults->data[0], $client); + $this->update_payment_methods->updateMethods($searchResults->data[0], $client); //@phpstan-ignore-line } } } diff --git a/app/Repositories/ActivityRepository.php b/app/Repositories/ActivityRepository.php index 035faa5efa..81874524b1 100644 --- a/app/Repositories/ActivityRepository.php +++ b/app/Repositories/ActivityRepository.php @@ -41,7 +41,7 @@ class ActivityRepository extends BaseRepository * Save the Activity. * * @param \stdClass $fields The fields - * @param \App\Models\Invoice | \App\Models\Quote | \App\Models\Credit | \App\Models\PurchaseOrder | \App\Models\Expense $entity + * @param \App\Models\Invoice | \App\Models\Quote | \App\Models\Credit | \App\Models\PurchaseOrder | \App\Models\Expense | \App\Models\Payment $entity * @param array $event_vars */ public function save($fields, $entity, $event_vars) diff --git a/app/Repositories/SubscriptionRepository.php b/app/Repositories/SubscriptionRepository.php index e7d971f0d3..eb53fc6e03 100644 --- a/app/Repositories/SubscriptionRepository.php +++ b/app/Repositories/SubscriptionRepository.php @@ -124,7 +124,7 @@ class SubscriptionRepository extends BaseRepository * * Removing the nested keys of the items array * - * @param array $bundle + * @param mixed $bundle * @return array */ private function convertV3Bundle($bundle): array diff --git a/app/Services/Client/PaymentMethod.php b/app/Services/Client/PaymentMethod.php index 492f907e13..8a27f31831 100644 --- a/app/Services/Client/PaymentMethod.php +++ b/app/Services/Client/PaymentMethod.php @@ -166,7 +166,7 @@ class PaymentMethod //note we have to use GatewayType::CREDIT_CARD as alias for CUSTOM foreach ($this->gateways as $gateway) { foreach ($gateway->driver($this->client)->gatewayTypes() as $type) { - if (isset($gateway->fees_and_limits) && is_object($gateway->fees_and_limits) && property_exists($gateway->fees_and_limits, GatewayType::CREDIT_CARD)) { + if (isset($gateway->fees_and_limits) && is_object($gateway->fees_and_limits) && property_exists($gateway->fees_and_limits, GatewayType::CREDIT_CARD)) { //@phpstan-ignore-line if ($this->validGatewayForAmount($gateway->fees_and_limits->{GatewayType::CREDIT_CARD}, $this->amount)) { // $this->payment_methods[] = [$gateway->id => $type]; //@15-06-2024 diff --git a/app/Services/Client/Statement.php b/app/Services/Client/Statement.php index 9b574e0674..d001103885 100644 --- a/app/Services/Client/Statement.php +++ b/app/Services/Client/Statement.php @@ -187,7 +187,7 @@ class Statement $pdf = $this->makePdf(null, null, $html); } } catch (\Exception $e) { - nlog(print_r($e->getMessage(), 1)); + nlog(print_r($e->getMessage(), true)); } @@ -385,7 +385,6 @@ class Statement /** * Get correct invitation ID. * - * @return int|bool */ protected function getInvitation() { diff --git a/app/Services/EDocument/Standards/Validation/Peppol/CompanyLevel.php b/app/Services/EDocument/Standards/Validation/Peppol/CompanyLevel.php index 04624c51b8..d78d526b1a 100644 --- a/app/Services/EDocument/Standards/Validation/Peppol/CompanyLevel.php +++ b/app/Services/EDocument/Standards/Validation/Peppol/CompanyLevel.php @@ -231,9 +231,9 @@ class CompanyLevel // #[SerializedName('cac:BuyerCustomerParty')] // public $BuyerCustomerParty; - // /** @var SellerSupplierParty */ - // #[SerializedName('cac:SellerSupplierParty')] - // public $SellerSupplierParty; + /** @var SellerSupplierParty */ + #[SerializedName('cac:SellerSupplierParty')] + public $SellerSupplierParty; /** @var TaxRepresentativeParty */ #[SerializedName('cac:TaxRepresentativeParty')] diff --git a/app/Services/Invoice/AutoBillInvoice.php b/app/Services/Invoice/AutoBillInvoice.php index 782b0fac9a..5e6844fffa 100644 --- a/app/Services/Invoice/AutoBillInvoice.php +++ b/app/Services/Invoice/AutoBillInvoice.php @@ -433,7 +433,7 @@ class AutoBillInvoice extends AbstractService $company_gateway = $gateway_token->gateway; //check if fees and limits are set - if (isset($company_gateway->fees_and_limits) && ! is_array($company_gateway->fees_and_limits) && property_exists($company_gateway->fees_and_limits, $gateway_token->gateway_type_id)) { + if (isset($company_gateway->fees_and_limits) && ! is_array($company_gateway->fees_and_limits) && property_exists($company_gateway->fees_and_limits, $gateway_token->gateway_type_id)) { //@phpstan-ignore-line //if valid we keep this gateway_token if ($this->invoice->client->validGatewayForAmount($company_gateway->fees_and_limits->{$gateway_token->gateway_type_id}, $amount)) { return true; diff --git a/app/Services/Pdf/PdfConfiguration.php b/app/Services/Pdf/PdfConfiguration.php index 4c9548bdb9..f639a01892 100644 --- a/app/Services/Pdf/PdfConfiguration.php +++ b/app/Services/Pdf/PdfConfiguration.php @@ -306,7 +306,7 @@ class PdfConfiguration $decimal = $this->country->decimal_separator; } - if (isset($this->country->swap_currency_symbol) && strlen($this->country->swap_currency_symbol) >= 1) { + if (isset($this->country->swap_currency_symbol) && $this->country->swap_currency_symbol) { $swapSymbol = $this->country->swap_currency_symbol; } diff --git a/app/Utils/SystemHealth.php b/app/Utils/SystemHealth.php index 96522a0427..34f06d597b 100644 --- a/app/Utils/SystemHealth.php +++ b/app/Utils/SystemHealth.php @@ -175,7 +175,7 @@ class SystemHealth public static function checkOpenBaseDir() { - if (strlen(ini_get('open_basedir') == 0)) { + if (strlen(ini_get('open_basedir')) == 0) { return true; } diff --git a/app/Utils/Traits/CompanySettingsSaver.php b/app/Utils/Traits/CompanySettingsSaver.php index e9fd86e492..1b3c304071 100644 --- a/app/Utils/Traits/CompanySettingsSaver.php +++ b/app/Utils/Traits/CompanySettingsSaver.php @@ -39,7 +39,7 @@ trait CompanySettingsSaver * Saves a setting object. * * Works for groups|clients|companies - * @param array $settings The request input settings array + * @param mixed $settings The request input settings array * @param object $entity The entity which the settings belongs to * @return void */ diff --git a/app/Utils/Traits/GeneratesCounter.php b/app/Utils/Traits/GeneratesCounter.php index f67288de67..82e93c6afd 100644 --- a/app/Utils/Traits/GeneratesCounter.php +++ b/app/Utils/Traits/GeneratesCounter.php @@ -441,7 +441,7 @@ trait GeneratesCounter /** * Formats the entity number according to pattern, prefix and padding. * - * @param Collection $entity The entity ie App\Models\Client, Invoice, Quote etc + * @param mixed $entity The entity ie App\Models\Client, Invoice, Quote etc * @param int $counter The counter * @param int $padding The padding * @param string $pattern