Code cleanup

This commit is contained in:
James Cole 2023-11-04 14:18:49 +01:00
parent 5a35960434
commit ba0843d0bb
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
211 changed files with 566 additions and 568 deletions

View File

@ -118,7 +118,7 @@ class AccountController extends Controller
// custom order. // custom order.
usort( usort(
$return, $return,
function ($a, $b) { static function ($a, $b) {
$order = [AccountType::ASSET, AccountType::REVENUE, AccountType::EXPENSE]; $order = [AccountType::ASSET, AccountType::REVENUE, AccountType::EXPENSE];
$posA = array_search($a['type'], $order, true); $posA = array_search($a['type'], $order, true);
$posB = array_search($b['type'], $order, true); $posB = array_search($b['type'], $order, true);

View File

@ -88,8 +88,8 @@ abstract class Controller extends BaseController
if ($page < 1) { if ($page < 1) {
$page = 1; $page = 1;
} }
if ($page > pow(2, 16)) { if ($page > 2** 16) {
$page = pow(2, 16); $page = 2** 16;
} }
$bag->set('page', $page); $bag->set('page', $page);

View File

@ -255,7 +255,7 @@ class ListController extends Controller
$unfiltered = $recurringRepos->getAll(); $unfiltered = $recurringRepos->getAll();
// filter selection // filter selection
$collection = $unfiltered->filter( // @phpstan-ignore-line $collection = $unfiltered->filter( /** @phpstan-ignore-line */
static function (Recurrence $recurrence) use ($currency) { // @phpstan-ignore-line static function (Recurrence $recurrence) use ($currency) { // @phpstan-ignore-line
/** @var RecurrenceTransaction $transaction */ /** @var RecurrenceTransaction $transaction */
foreach ($recurrence->recurrenceTransactions as $transaction) { foreach ($recurrence->recurrenceTransactions as $transaction) {
@ -305,7 +305,7 @@ class ListController extends Controller
$ruleRepos = app(RuleRepositoryInterface::class); $ruleRepos = app(RuleRepositoryInterface::class);
$unfiltered = $ruleRepos->getAll(); $unfiltered = $ruleRepos->getAll();
$collection = $unfiltered->filter( // @phpstan-ignore-line $collection = $unfiltered->filter( /** @phpstan-ignore-line */
static function (Rule $rule) use ($currency) { // @phpstan-ignore-line static function (Rule $rule) use ($currency) { // @phpstan-ignore-line
/** @var RuleTrigger $trigger */ /** @var RuleTrigger $trigger */
foreach ($rule->ruleTriggers as $trigger) { foreach ($rule->ruleTriggers as $trigger) {

View File

@ -33,8 +33,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class AutocompleteRequest extends FormRequest class AutocompleteRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* @return array * @return array

View File

@ -35,8 +35,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class DateRequest extends FormRequest class DateRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -32,8 +32,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class DestroyRequest extends FormRequest class DestroyRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -35,8 +35,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class SameDateRequest extends FormRequest class SameDateRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -42,8 +42,8 @@ use Illuminate\Support\Collection;
*/ */
class GenericRequest extends FormRequest class GenericRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
private Collection $accounts; private Collection $accounts;
private Collection $bills; private Collection $bills;

View File

@ -40,9 +40,9 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class StoreRequest extends FormRequest class StoreRequest extends FormRequest
{ {
use ConvertsDataTypes;
use AppendsLocationData; use AppendsLocationData;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* @return array * @return array
@ -124,7 +124,7 @@ class StoreRequest extends FormRequest
'liability_start_date' => 'required_with:liability_amount|date', 'liability_start_date' => 'required_with:liability_amount|date',
'liability_direction' => 'nullable|required_if:type,liability|required_if:type,liabilities|in:credit,debit', 'liability_direction' => 'nullable|required_if:type,liability|required_if:type,liabilities|in:credit,debit',
'interest' => 'between:0,100|numeric', 'interest' => 'between:0,100|numeric',
'interest_period' => sprintf('nullable|in:%s', join(',', config('firefly.interest_periods'))), 'interest_period' => sprintf('nullable|in:%s', implode(',', config('firefly.interest_periods'))),
'notes' => 'min:0|max:65536', 'notes' => 'min:0|max:65536',
]; ];

View File

@ -41,9 +41,9 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class UpdateRequest extends FormRequest class UpdateRequest extends FormRequest
{ {
use ConvertsDataTypes;
use AppendsLocationData; use AppendsLocationData;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* @return array * @return array

View File

@ -35,8 +35,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class StoreRequest extends FormRequest class StoreRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -35,8 +35,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class UpdateRequest extends FormRequest class UpdateRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -36,8 +36,8 @@ use Illuminate\Validation\Validator;
*/ */
class Request extends FormRequest class Request extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.
@ -84,7 +84,7 @@ class Request extends FormRequest
public function withValidator(Validator $validator): void public function withValidator(Validator $validator): void
{ {
$validator->after( $validator->after(
function (Validator $validator) { static function (Validator $validator) {
// validate start before end only if both are there. // validate start before end only if both are there.
$data = $validator->getData(); $data = $validator->getData();
if (array_key_exists('start', $data) && array_key_exists('end', $data)) { if (array_key_exists('start', $data) && array_key_exists('end', $data)) {

View File

@ -37,8 +37,8 @@ use Illuminate\Validation\Validator;
*/ */
class StoreRequest extends FormRequest class StoreRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -38,8 +38,8 @@ use Illuminate\Validation\Validator;
*/ */
class UpdateRequest extends FormRequest class UpdateRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -37,9 +37,9 @@ use Illuminate\Validation\Validator;
*/ */
class StoreRequest extends FormRequest class StoreRequest extends FormRequest
{ {
use ChecksLogin;
use ConvertsDataTypes; use ConvertsDataTypes;
use ValidatesAutoBudgetRequest; use ValidatesAutoBudgetRequest;
use ChecksLogin;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -38,9 +38,9 @@ use Illuminate\Validation\Validator;
*/ */
class UpdateRequest extends FormRequest class UpdateRequest extends FormRequest
{ {
use ChecksLogin;
use ConvertsDataTypes; use ConvertsDataTypes;
use ValidatesAutoBudgetRequest; use ValidatesAutoBudgetRequest;
use ChecksLogin;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class StoreRequest extends FormRequest class StoreRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -36,8 +36,8 @@ use Illuminate\Validation\Validator;
*/ */
class UpdateRequest extends FormRequest class UpdateRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.
@ -84,7 +84,7 @@ class UpdateRequest extends FormRequest
public function withValidator(Validator $validator): void public function withValidator(Validator $validator): void
{ {
$validator->after( $validator->after(
function (Validator $validator) { static function (Validator $validator) {
// validate start before end only if both are there. // validate start before end only if both are there.
$data = $validator->getData(); $data = $validator->getData();
if (array_key_exists('start', $data) && array_key_exists('end', $data)) { if (array_key_exists('start', $data) && array_key_exists('end', $data)) {

View File

@ -35,8 +35,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class StoreRequest extends FormRequest class StoreRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -35,8 +35,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class UpdateRequest extends FormRequest class UpdateRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -36,8 +36,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class UpdateRequest extends FormRequest class UpdateRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* @return array * @return array

View File

@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class StoreRequest extends FormRequest class StoreRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -37,8 +37,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class UpdateRequest extends FormRequest class UpdateRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -39,12 +39,12 @@ use Illuminate\Validation\Validator;
*/ */
class StoreRequest extends FormRequest class StoreRequest extends FormRequest
{ {
use ChecksLogin;
use ConvertsDataTypes; use ConvertsDataTypes;
use RecurrenceValidation;
use TransactionValidation;
use CurrencyValidation; use CurrencyValidation;
use GetRecurrenceData; use GetRecurrenceData;
use ChecksLogin; use RecurrenceValidation;
use TransactionValidation;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -40,12 +40,12 @@ use Illuminate\Validation\Validator;
*/ */
class UpdateRequest extends FormRequest class UpdateRequest extends FormRequest
{ {
use ChecksLogin;
use ConvertsDataTypes; use ConvertsDataTypes;
use RecurrenceValidation;
use TransactionValidation;
use CurrencyValidation; use CurrencyValidation;
use GetRecurrenceData; use GetRecurrenceData;
use ChecksLogin; use RecurrenceValidation;
use TransactionValidation;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -35,9 +35,9 @@ use Illuminate\Validation\Validator;
*/ */
class StoreRequest extends FormRequest class StoreRequest extends FormRequest
{ {
use ChecksLogin;
use ConvertsDataTypes; use ConvertsDataTypes;
use GetRuleConfiguration; use GetRuleConfiguration;
use ChecksLogin;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class TestRequest extends FormRequest class TestRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* @return array * @return array

View File

@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class TriggerRequest extends FormRequest class TriggerRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* @return array * @return array

View File

@ -36,9 +36,9 @@ use Illuminate\Validation\Validator;
*/ */
class UpdateRequest extends FormRequest class UpdateRequest extends FormRequest
{ {
use ChecksLogin;
use ConvertsDataTypes; use ConvertsDataTypes;
use GetRuleConfiguration; use GetRuleConfiguration;
use ChecksLogin;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -33,8 +33,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class StoreRequest extends FormRequest class StoreRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class TestRequest extends FormRequest class TestRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* @return array * @return array

View File

@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class TriggerRequest extends FormRequest class TriggerRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* @return array * @return array

View File

@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class UpdateRequest extends FormRequest class UpdateRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -36,9 +36,9 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class StoreRequest extends FormRequest class StoreRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin;
use AppendsLocationData; use AppendsLocationData;
use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -38,9 +38,9 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class UpdateRequest extends FormRequest class UpdateRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin;
use AppendsLocationData; use AppendsLocationData;
use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -42,12 +42,12 @@ use Illuminate\Validation\Validator;
*/ */
class StoreRequest extends FormRequest class StoreRequest extends FormRequest
{ {
use TransactionValidation;
use GroupValidation;
use CurrencyValidation;
use ConvertsDataTypes;
use ChecksLogin;
use AppendsLocationData; use AppendsLocationData;
use ChecksLogin;
use ConvertsDataTypes;
use CurrencyValidation;
use GroupValidation;
use TransactionValidation;
/** /**
* Get all data. Is pretty complex because of all the ??-statements. * Get all data. Is pretty complex because of all the ??-statements.

View File

@ -41,10 +41,10 @@ use Illuminate\Validation\Validator;
*/ */
class UpdateRequest extends FormRequest class UpdateRequest extends FormRequest
{ {
use TransactionValidation;
use GroupValidation;
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
use GroupValidation;
use TransactionValidation;
private array $arrayFields; private array $arrayFields;
private array $booleanFields; private array $booleanFields;

View File

@ -35,8 +35,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class StoreRequest extends FormRequest class StoreRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -36,8 +36,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class UpdateRequest extends FormRequest class UpdateRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -36,8 +36,8 @@ use Illuminate\Validation\Validator;
*/ */
class StoreRequest extends FormRequest class StoreRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -36,8 +36,8 @@ use Illuminate\Validation\Validator;
*/ */
class UpdateRequest extends FormRequest class UpdateRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class StoreRequest extends FormRequest class StoreRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -36,8 +36,8 @@ use Illuminate\Validation\Rule;
*/ */
class UpdateRequest extends FormRequest class UpdateRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -57,9 +57,9 @@ class CreateRequest extends FormRequest
// this is the way. // this is the way.
$return = $this->getAllData($fields); $return = $this->getAllData($fields);
$return['trigger'] = $triggers[$return['trigger']] ?? intval($return['trigger']); $return['trigger'] = $triggers[$return['trigger']] ?? (int) ($return['trigger']);
$return['response'] = $responses[$return['response']] ?? intval($return['response']); $return['response'] = $responses[$return['response']] ?? (int) ($return['response']);
$return['delivery'] = $deliveries[$return['delivery']] ?? intval($return['delivery']); $return['delivery'] = $deliveries[$return['delivery']] ?? (int) ($return['delivery']);
return $return; return $return;
} }

View File

@ -36,8 +36,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class UpdateRequest extends FormRequest class UpdateRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class UserStoreRequest extends FormRequest class UserStoreRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Logged in + owner * Logged in + owner

View File

@ -36,8 +36,8 @@ use Illuminate\Validation\Validator;
*/ */
class UserUpdateRequest extends FormRequest class UserUpdateRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Logged in + owner * Logged in + owner

View File

@ -123,7 +123,7 @@ class AccountController extends Controller
usort( usort(
$allItems, $allItems,
function (array $a, array $b): int { static function (array $a, array $b): int {
$order = [AccountType::ASSET, AccountType::REVENUE, AccountType::EXPENSE]; $order = [AccountType::ASSET, AccountType::REVENUE, AccountType::EXPENSE];
$pos_a = array_search($a['type'], $order, true); $pos_a = array_search($a['type'], $order, true);
$pos_b = array_search($b['type'], $order, true); $pos_b = array_search($b['type'], $order, true);

View File

@ -135,7 +135,7 @@ class CategoryController extends Controller
$return = array_values($return); $return = array_values($return);
// order by native amount // order by native amount
usort($return, function (array $a, array $b) { usort($return, static function (array $a, array $b) {
return (float)$a['native_amount'] < (float)$b['native_amount'] ? 1 : -1; return (float)$a['native_amount'] < (float)$b['native_amount'] ? 1 : -1;
}); });
return response()->json($this->clean($return)); return response()->json($this->clean($return));

View File

@ -35,8 +35,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class AutocompleteRequest extends FormRequest class AutocompleteRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
protected array $acceptedRoles = [UserRoleEnum::MANAGE_TRANSACTIONS]; protected array $acceptedRoles = [UserRoleEnum::MANAGE_TRANSACTIONS];

View File

@ -36,8 +36,8 @@ use Illuminate\Validation\Validator;
*/ */
class BalanceChartRequest extends FormRequest class BalanceChartRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
use ValidatesUserGroupTrait; use ValidatesUserGroupTrait;
/** /**
@ -64,7 +64,7 @@ class BalanceChartRequest extends FormRequest
'start' => 'required|date|after:1900-01-01|before:2099-12-31', 'start' => 'required|date|after:1900-01-01|before:2099-12-31',
'end' => 'required|date|after_or_equal:start|before:2099-12-31|after:1900-01-01', 'end' => 'required|date|after_or_equal:start|before:2099-12-31|after:1900-01-01',
'accounts.*' => 'required|exists:accounts,id', 'accounts.*' => 'required|exists:accounts,id',
'period' => sprintf('required|in:%s', join(',', config('firefly.valid_view_ranges'))), 'period' => sprintf('required|in:%s', implode(',', config('firefly.valid_view_ranges'))),
]; ];
} }
@ -76,7 +76,7 @@ class BalanceChartRequest extends FormRequest
public function withValidator(Validator $validator): void public function withValidator(Validator $validator): void
{ {
$validator->after( $validator->after(
function (Validator $validator) { static function (Validator $validator) {
// validate transaction query data. // validate transaction query data.
$data = $validator->getData(); $data = $validator->getData();
if (!array_key_exists('accounts', $data)) { if (!array_key_exists('accounts', $data)) {

View File

@ -35,8 +35,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class DateRequest extends FormRequest class DateRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -36,8 +36,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class SingleDateRequest extends FormRequest class SingleDateRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Get all data from the request. * Get all data from the request.

View File

@ -50,13 +50,13 @@ use Illuminate\Validation\Validator;
*/ */
class StoreRequest extends FormRequest class StoreRequest extends FormRequest
{ {
use ChecksLogin;
use ConvertsDataTypes;
use TransactionValidation;
use GroupValidation;
use CurrencyValidation;
use AppendsLocationData; use AppendsLocationData;
use ChecksLogin;
use ConvertsDataTypes;
use CurrencyValidation;
use GroupValidation;
use TransactionValidation;
protected array $acceptedRoles = [UserRoleEnum::MANAGE_TRANSACTIONS]; protected array $acceptedRoles = [UserRoleEnum::MANAGE_TRANSACTIONS];

View File

@ -64,7 +64,7 @@ class UpdateMembershipRequest extends FormRequest
return [ return [
'id' => 'exists:users,id|required_without:email', 'id' => 'exists:users,id|required_without:email',
'email' => 'exists:users,email|required_without:id', 'email' => 'exists:users,email|required_without:id',
'roles.*' => 'required|in:' . join(',', $validRoles), 'roles.*' => 'required|in:' . implode(',', $validRoles),
]; ];
} }
} }

View File

@ -80,7 +80,7 @@ class EnableCurrencies extends Command
$found = array_values( $found = array_values(
array_filter( array_filter(
$found, $found,
function (int $currencyId) { static function (int $currencyId) {
return $currencyId !== 0; return $currencyId !== 0;
} }
) )

View File

@ -81,11 +81,11 @@ class FixAccountTypes extends Command
->leftJoin('account_types as destination_account_type', 'destination_account.account_type_id', '=', 'destination_account_type.id'); ->leftJoin('account_types as destination_account_type', 'destination_account.account_type_id', '=', 'destination_account_type.id');
// list all valid combinations, those are allowed. So we select those which are broken. // list all valid combinations, those are allowed. So we select those which are broken.
$query->where(function (Builder $q) use ($expected) { $query->where(static function (Builder $q) use ($expected) {
foreach ($expected as $transactionType => $info) { foreach ($expected as $transactionType => $info) {
foreach ($info as $source => $destinations) { foreach ($info as $source => $destinations) {
foreach ($destinations as $destination) { foreach ($destinations as $destination) {
$q->whereNot(function (Builder $q1) use ($transactionType, $source, $destination) { $q->whereNot(static function (Builder $q1) use ($transactionType, $source, $destination) {
$q1->where('transaction_types.type', $transactionType); $q1->where('transaction_types.type', $transactionType);
$q1->where('source_account_type.type', $source); $q1->where('source_account_type.type', $source);
$q1->where('destination_account_type.type', $destination); $q1->where('destination_account_type.type', $destination);

View File

@ -56,7 +56,7 @@ class FixUnevenAmount extends Command
foreach ($journals as $entry) { foreach ($journals as $entry) {
$sum = (string)$entry->the_sum; $sum = (string)$entry->the_sum;
if (!is_numeric($sum) || if (!is_numeric($sum) ||
0 === strlen($sum) || // @phpstan-ignore-line '' === $sum || // @phpstan-ignore-line
str_contains($sum, 'e') || str_contains($sum, 'e') ||
str_contains($sum, ',')) { str_contains($sum, ',')) {
$message = sprintf( $message = sprintf(

View File

@ -136,7 +136,7 @@ class ForceDecimalSize extends Command
{ {
// if sqlite, add function? // if sqlite, add function?
if ('sqlite' === (string)config('database.default')) { if ('sqlite' === (string)config('database.default')) {
DB::connection()->getPdo()->sqliteCreateFunction('REGEXP', function ($pattern, $value) { DB::connection()->getPdo()->sqliteCreateFunction('REGEXP', static function ($pattern, $value) {
mb_regex_encoding('UTF-8'); mb_regex_encoding('UTF-8');
$pattern = trim($pattern, '"'); $pattern = trim($pattern, '"');
@ -259,7 +259,7 @@ class ForceDecimalSize extends Command
continue; continue;
} }
// fix $field by rounding it down correctly. // fix $field by rounding it down correctly.
$pow = pow(10, (int)$currency->decimal_places); $pow = 10** (int)$currency->decimal_places;
$correct = bcdiv((string)round($value * $pow), (string)$pow, 12); $correct = bcdiv((string)round($value * $pow), (string)$pow, 12);
$this->friendlyInfo(sprintf('Account #%d has %s with value "%s", this has been corrected to "%s".', $account->id, $field, $value, $correct)); $this->friendlyInfo(sprintf('Account #%d has %s with value "%s", this has been corrected to "%s".', $account->id, $field, $value, $correct));
Account::find($account->id)->update([$field => $correct]); Account::find($account->id)->update([$field => $correct]);
@ -310,7 +310,7 @@ class ForceDecimalSize extends Command
continue; continue;
} }
// fix $field by rounding it down correctly. // fix $field by rounding it down correctly.
$pow = pow(10, (int)$currency->decimal_places); $pow = 10** (int)$currency->decimal_places;
$correct = bcdiv((string)round($value * $pow), (string)$pow, 12); $correct = bcdiv((string)round($value * $pow), (string)$pow, 12);
$this->friendlyWarning(sprintf('%s #%d has %s with value "%s", this has been corrected to "%s".', $table, $item->id, $field, $value, $correct)); $this->friendlyWarning(sprintf('%s #%d has %s with value "%s", this has been corrected to "%s".', $table, $item->id, $field, $value, $correct));
$class::find($item->id)->update([$field => $correct]); $class::find($item->id)->update([$field => $correct]);
@ -362,7 +362,7 @@ class ForceDecimalSize extends Command
continue; continue;
} }
// fix $field by rounding it down correctly. // fix $field by rounding it down correctly.
$pow = pow(10, (int)$currency->decimal_places); $pow = 10** (int)$currency->decimal_places;
$correct = bcdiv((string)round($value * $pow), (string)$pow, 12); $correct = bcdiv((string)round($value * $pow), (string)$pow, 12);
$this->friendlyWarning( $this->friendlyWarning(
sprintf('Piggy bank event #%d has %s with value "%s", this has been corrected to "%s".', $item->id, $field, $value, $correct) sprintf('Piggy bank event #%d has %s with value "%s", this has been corrected to "%s".', $item->id, $field, $value, $correct)
@ -416,7 +416,7 @@ class ForceDecimalSize extends Command
continue; continue;
} }
// fix $field by rounding it down correctly. // fix $field by rounding it down correctly.
$pow = pow(10, (int)$currency->decimal_places); $pow = 10** (int)$currency->decimal_places;
$correct = bcdiv((string)round($value * $pow), (string)$pow, 12); $correct = bcdiv((string)round($value * $pow), (string)$pow, 12);
$this->friendlyWarning( $this->friendlyWarning(
sprintf('Piggy bank repetition #%d has %s with value "%s", this has been corrected to "%s".', $item->id, $field, $value, $correct) sprintf('Piggy bank repetition #%d has %s with value "%s", this has been corrected to "%s".', $item->id, $field, $value, $correct)
@ -469,7 +469,7 @@ class ForceDecimalSize extends Command
continue; continue;
} }
// fix $field by rounding it down correctly. // fix $field by rounding it down correctly.
$pow = pow(10, (int)$currency->decimal_places); $pow = 10** (int)$currency->decimal_places;
$correct = bcdiv((string)round($value * $pow), (string)$pow, 12); $correct = bcdiv((string)round($value * $pow), (string)$pow, 12);
$this->friendlyWarning(sprintf('Piggy bank #%d has %s with value "%s", this has been corrected to "%s".', $item->id, $field, $value, $correct)); $this->friendlyWarning(sprintf('Piggy bank #%d has %s with value "%s", this has been corrected to "%s".', $item->id, $field, $value, $correct));
PiggyBank::find($item->id)->update([$field => $correct]); PiggyBank::find($item->id)->update([$field => $correct]);
@ -506,7 +506,7 @@ class ForceDecimalSize extends Command
continue; continue;
} }
// fix $field by rounding it down correctly. // fix $field by rounding it down correctly.
$pow = (float)pow(10, (int)$currency->decimal_places); $pow = (float)10** (int)$currency->decimal_places;
$correct = bcdiv((string)round((float)$value * $pow), (string)$pow, 12); $correct = bcdiv((string)round((float)$value * $pow), (string)$pow, 12);
$this->friendlyWarning(sprintf('Transaction #%d has amount with value "%s", this has been corrected to "%s".', $item->id, $value, $correct)); $this->friendlyWarning(sprintf('Transaction #%d has amount with value "%s", this has been corrected to "%s".', $item->id, $value, $correct));
Transaction::find($item->id)->update(['amount' => $correct]); Transaction::find($item->id)->update(['amount' => $correct]);
@ -533,7 +533,7 @@ class ForceDecimalSize extends Command
continue; continue;
} }
// fix $field by rounding it down correctly. // fix $field by rounding it down correctly.
$pow = (float)pow(10, (int)$currency->decimal_places); $pow = (float)10** (int)$currency->decimal_places;
$correct = bcdiv((string)round((float)$value * $pow), (string)$pow, 12); $correct = bcdiv((string)round((float)$value * $pow), (string)$pow, 12);
$this->friendlyWarning( $this->friendlyWarning(
sprintf('Transaction #%d has foreign amount with value "%s", this has been corrected to "%s".', $item->id, $value, $correct) sprintf('Transaction #%d has foreign amount with value "%s", this has been corrected to "%s".', $item->id, $value, $correct)

View File

@ -33,7 +33,7 @@ class DestroyedTransactionLink extends Event
{ {
use SerializesModels; use SerializesModels;
private TransactionJournalLink $link; // @phpstan-ignore-line private TransactionJournalLink $link; /** @phpstan-ignore-line */
/** /**
* DestroyedTransactionLink constructor. * DestroyedTransactionLink constructor.

View File

@ -231,14 +231,12 @@ class Handler extends ExceptionHandler
*/ */
private function shouldntReportLocal(Throwable $e): bool private function shouldntReportLocal(Throwable $e): bool
{ {
return !is_null( return null !== Arr::first(
Arr::first(
$this->dontReport, $this->dontReport,
function ($type) use ($e) { static function ($type) use ($e) {
return $e instanceof $type; return $e instanceof $type;
} }
) );
);
} }
/** /**

View File

@ -59,14 +59,14 @@ final class IntervalException extends Exception
array $intervals, array $intervals,
int $code = 0, int $code = 0,
?Throwable $previous = null ?Throwable $previous = null
): IntervalException { ): self {
$message = sprintf( $message = sprintf(
'The periodicity %s is unknown. Choose one of available periodicity: %s', 'The periodicity %s is unknown. Choose one of available periodicity: %s',
$periodicity->name, $periodicity->name,
join(', ', $intervals) implode(', ', $intervals)
); );
$exception = new IntervalException($message, $code, $previous); $exception = new self($message, $code, $previous);
$exception->periodicity = $periodicity; $exception->periodicity = $periodicity;
$exception->availableIntervals = $intervals; $exception->availableIntervals = $intervals;
return $exception; return $exception;

View File

@ -37,8 +37,8 @@ use JsonException;
*/ */
class RecurrenceFactory class RecurrenceFactory
{ {
use TransactionTypeTrait;
use RecurringTransactionTrait; use RecurringTransactionTrait;
use TransactionTypeTrait;
private MessageBag $errors; private MessageBag $errors;
private User $user; private User $user;

View File

@ -45,7 +45,7 @@ interface ReportGeneratorInterface
* *
* @return ReportGeneratorInterface * @return ReportGeneratorInterface
*/ */
public function setAccounts(Collection $accounts): ReportGeneratorInterface; public function setAccounts(Collection $accounts): self;
/** /**
* Set the involved budgets. * Set the involved budgets.
@ -54,7 +54,7 @@ interface ReportGeneratorInterface
* *
* @return ReportGeneratorInterface * @return ReportGeneratorInterface
*/ */
public function setBudgets(Collection $budgets): ReportGeneratorInterface; public function setBudgets(Collection $budgets): self;
/** /**
* Set the involved categories. * Set the involved categories.
@ -63,7 +63,7 @@ interface ReportGeneratorInterface
* *
* @return ReportGeneratorInterface * @return ReportGeneratorInterface
*/ */
public function setCategories(Collection $categories): ReportGeneratorInterface; public function setCategories(Collection $categories): self;
/** /**
* Set the end date. * Set the end date.
@ -72,7 +72,7 @@ interface ReportGeneratorInterface
* *
* @return ReportGeneratorInterface * @return ReportGeneratorInterface
*/ */
public function setEndDate(Carbon $date): ReportGeneratorInterface; public function setEndDate(Carbon $date): self;
/** /**
* Set the expense accounts. * Set the expense accounts.
@ -81,7 +81,7 @@ interface ReportGeneratorInterface
* *
* @return ReportGeneratorInterface * @return ReportGeneratorInterface
*/ */
public function setExpense(Collection $expense): ReportGeneratorInterface; public function setExpense(Collection $expense): self;
/** /**
* Set the start date. * Set the start date.
@ -90,7 +90,7 @@ interface ReportGeneratorInterface
* *
* @return ReportGeneratorInterface * @return ReportGeneratorInterface
*/ */
public function setStartDate(Carbon $date): ReportGeneratorInterface; public function setStartDate(Carbon $date): self;
/** /**
* Set the tags. * Set the tags.
@ -99,5 +99,5 @@ interface ReportGeneratorInterface
* *
* @return ReportGeneratorInterface * @return ReportGeneratorInterface
*/ */
public function setTags(Collection $tags): ReportGeneratorInterface; public function setTags(Collection $tags): self;
} }

View File

@ -50,7 +50,7 @@ class APIEventHandler
if (null !== $user) { if (null !== $user) {
try { try {
Notification::send($user, new NewAccessToken()); Notification::send($user, new NewAccessToken());
} catch (Exception $e) { // @phpstan-ignore-line } catch (Exception $e) { /** @phpstan-ignore-line */
$message = $e->getMessage(); $message = $e->getMessage();
if (str_contains($message, 'Bcc')) { if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');

View File

@ -58,7 +58,7 @@ class AdminEventHandler
if ($repository->hasRole($user, 'owner')) { if ($repository->hasRole($user, 'owner')) {
try { try {
Notification::send($user, new UserInvitation($event->invitee)); Notification::send($user, new UserInvitation($event->invitee));
} catch (Exception $e) { // @phpstan-ignore-line } catch (Exception $e) { /** @phpstan-ignore-line */
$message = $e->getMessage(); $message = $e->getMessage();
if (str_contains($message, 'Bcc')) { if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@ -96,7 +96,7 @@ class AdminEventHandler
if ($repository->hasRole($user, 'owner')) { if ($repository->hasRole($user, 'owner')) {
try { try {
Notification::send($user, new VersionCheckResult($event->message)); Notification::send($user, new VersionCheckResult($event->message));
} catch (Exception $e) { // @phpstan-ignore-line } catch (Exception $e) { /** @phpstan-ignore-line */
$message = $e->getMessage(); $message = $e->getMessage();
if (str_contains($message, 'Bcc')) { if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@ -130,7 +130,7 @@ class AdminEventHandler
} }
try { try {
Notification::send($event->user, new TestNotification($event->user->email)); Notification::send($event->user, new TestNotification($event->user->email));
} catch (Exception $e) { // @phpstan-ignore-line } catch (Exception $e) { /** @phpstan-ignore-line */
$message = $e->getMessage(); $message = $e->getMessage();
if (str_contains($message, 'Bcc')) { if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');

View File

@ -75,7 +75,7 @@ class AutomationHandler
} }
try { try {
Notification::send($user, new TransactionCreation($groups)); Notification::send($user, new TransactionCreation($groups));
} catch (Exception $e) { // @phpstan-ignore-line } catch (Exception $e) { /** @phpstan-ignore-line */
$message = $e->getMessage(); $message = $e->getMessage();
if (str_contains($message, 'Bcc')) { if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');

View File

@ -51,7 +51,7 @@ class BillEventHandler
app('log')->debug('Bill reminder is true!'); app('log')->debug('Bill reminder is true!');
try { try {
Notification::send($bill->user, new BillReminder($bill, $event->field, $event->diff)); Notification::send($bill->user, new BillReminder($bill, $event->field, $event->diff));
} catch (Exception $e) { // @phpstan-ignore-line } catch (Exception $e) { /** @phpstan-ignore-line */
$message = $e->getMessage(); $message = $e->getMessage();
if (str_contains($message, 'Bcc')) { if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');

View File

@ -203,7 +203,7 @@ class UserEventHandler
if (false === $entry['notified']) { if (false === $entry['notified']) {
try { try {
Notification::send($user, new UserLogin($ipAddress)); Notification::send($user, new UserLogin($ipAddress));
} catch (Exception $e) { // @phpstan-ignore-line } catch (Exception $e) { /** @phpstan-ignore-line */
$message = $e->getMessage(); $message = $e->getMessage();
if (str_contains($message, 'Bcc')) { if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@ -237,7 +237,7 @@ class UserEventHandler
if ($repository->hasRole($user, 'owner')) { if ($repository->hasRole($user, 'owner')) {
try { try {
Notification::send($user, new AdminRegistrationNotification($event->user)); Notification::send($user, new AdminRegistrationNotification($event->user));
} catch (Exception $e) { // @phpstan-ignore-line } catch (Exception $e) { /** @phpstan-ignore-line */
$message = $e->getMessage(); $message = $e->getMessage();
if (str_contains($message, 'Bcc')) { if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@ -314,7 +314,7 @@ class UserEventHandler
{ {
try { try {
Notification::send($event->user, new UserNewPassword(route('password.reset', [$event->token]))); Notification::send($event->user, new UserNewPassword(route('password.reset', [$event->token])));
} catch (Exception $e) { // @phpstan-ignore-line } catch (Exception $e) { /** @phpstan-ignore-line */
$message = $e->getMessage(); $message = $e->getMessage();
if (str_contains($message, 'Bcc')) { if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@ -362,7 +362,7 @@ class UserEventHandler
if ($sendMail) { if ($sendMail) {
try { try {
Notification::send($event->user, new UserRegistrationNotification()); Notification::send($event->user, new UserRegistrationNotification());
} catch (Exception $e) { // @phpstan-ignore-line } catch (Exception $e) { /** @phpstan-ignore-line */
$message = $e->getMessage(); $message = $e->getMessage();
if (str_contains($message, 'Bcc')) { if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');

View File

@ -41,7 +41,7 @@ class WebhookEventHandler
$messages = WebhookMessage::where('webhook_messages.sent', false) $messages = WebhookMessage::where('webhook_messages.sent', false)
->get(['webhook_messages.*']) ->get(['webhook_messages.*'])
->filter( ->filter(
function (WebhookMessage $message) { static function (WebhookMessage $message) {
return $message->webhookAttempts()->count() <= 2; return $message->webhookAttempts()->count() <= 2;
} }
)->splice(0, 5); )->splice(0, 5);

View File

@ -40,7 +40,7 @@ class TransactionJournalObserver
app('log')->debug('Observe "deleting" of a transaction journal.'); app('log')->debug('Observe "deleting" of a transaction journal.');
// to make sure the listener doesn't get back to use and loop // to make sure the listener doesn't get back to use and loop
TransactionJournal::withoutEvents(function () use ($transactionJournal) { TransactionJournal::withoutEvents(static function () use ($transactionJournal) {
foreach ($transactionJournal->transactions()->get() as $transaction) { foreach ($transactionJournal->transactions()->get() as $transaction) {
$transaction->delete(); $transaction->delete();
} }

View File

@ -95,7 +95,7 @@ class AttachmentHelper implements AttachmentHelperInterface
*/ */
public function getAttachmentLocation(Attachment $attachment): string public function getAttachmentLocation(Attachment $attachment): string
{ {
return sprintf('%sat-%d.data', DIRECTORY_SEPARATOR, (int)$attachment->id); return sprintf('%sat-%d.data', \DIRECTORY_SEPARATOR, (int)$attachment->id);
} }
/** /**

View File

@ -74,7 +74,7 @@ trait AmountCollection
public function amountLess(string $amount): GroupCollectorInterface public function amountLess(string $amount): GroupCollectorInterface
{ {
$this->query->where( $this->query->where(
function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line
$q->where('destination.amount', '<=', app('steam')->positive($amount)); $q->where('destination.amount', '<=', app('steam')->positive($amount));
} }
); );
@ -92,7 +92,7 @@ trait AmountCollection
public function amountMore(string $amount): GroupCollectorInterface public function amountMore(string $amount): GroupCollectorInterface
{ {
$this->query->where( $this->query->where(
function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line
$q->where('destination.amount', '>=', app('steam')->positive($amount)); $q->where('destination.amount', '>=', app('steam')->positive($amount));
} }
); );
@ -148,7 +148,7 @@ trait AmountCollection
public function foreignAmountLess(string $amount): GroupCollectorInterface public function foreignAmountLess(string $amount): GroupCollectorInterface
{ {
$this->query->where( $this->query->where(
function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line
$q->whereNotNull('destination.foreign_amount'); $q->whereNotNull('destination.foreign_amount');
$q->where('destination.foreign_amount', '<=', app('steam')->positive($amount)); $q->where('destination.foreign_amount', '<=', app('steam')->positive($amount));
} }
@ -167,7 +167,7 @@ trait AmountCollection
public function foreignAmountMore(string $amount): GroupCollectorInterface public function foreignAmountMore(string $amount): GroupCollectorInterface
{ {
$this->query->where( $this->query->where(
function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line
$q->whereNotNull('destination.foreign_amount'); $q->whereNotNull('destination.foreign_amount');
$q->where('destination.foreign_amount', '>=', app('steam')->positive($amount)); $q->where('destination.foreign_amount', '>=', app('steam')->positive($amount));
} }

View File

@ -44,7 +44,7 @@ trait AttachmentCollection
{ {
$this->hasAttachments(); $this->hasAttachments();
$this->withAttachmentInformation(); $this->withAttachmentInformation();
$filter = function (int $index, array $object) use ($name): bool { $filter = static function (int $index, array $object) use ($name): bool {
/** @var array $transaction */ /** @var array $transaction */
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */ /** @var array $attachment */
@ -123,7 +123,7 @@ trait AttachmentCollection
{ {
$this->hasAttachments(); $this->hasAttachments();
$this->withAttachmentInformation(); $this->withAttachmentInformation();
$filter = function (int $index, array $object) use ($name): bool { $filter = static function (int $index, array $object) use ($name): bool {
/** @var array $transaction */ /** @var array $transaction */
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */ /** @var array $attachment */
@ -153,7 +153,7 @@ trait AttachmentCollection
{ {
$this->hasAttachments(); $this->hasAttachments();
$this->withAttachmentInformation(); $this->withAttachmentInformation();
$filter = function (int $index, array $object) use ($name): bool { $filter = static function (int $index, array $object) use ($name): bool {
/** @var array $transaction */ /** @var array $transaction */
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */ /** @var array $attachment */
@ -183,7 +183,7 @@ trait AttachmentCollection
{ {
$this->hasAttachments(); $this->hasAttachments();
$this->withAttachmentInformation(); $this->withAttachmentInformation();
$filter = function (int $index, array $object) use ($name): bool { $filter = static function (int $index, array $object) use ($name): bool {
/** @var array $transaction */ /** @var array $transaction */
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */ /** @var array $attachment */
@ -213,7 +213,7 @@ trait AttachmentCollection
{ {
$this->hasAttachments(); $this->hasAttachments();
$this->withAttachmentInformation(); $this->withAttachmentInformation();
$filter = function (int $index, array $object) use ($name): bool { $filter = static function (int $index, array $object) use ($name): bool {
/** @var array $transaction */ /** @var array $transaction */
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */ /** @var array $attachment */
@ -243,7 +243,7 @@ trait AttachmentCollection
{ {
$this->hasAttachments(); $this->hasAttachments();
$this->withAttachmentInformation(); $this->withAttachmentInformation();
$filter = function (int $index, array $object) use ($name): bool { $filter = static function (int $index, array $object) use ($name): bool {
/** @var array $transaction */ /** @var array $transaction */
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */ /** @var array $attachment */
@ -270,7 +270,7 @@ trait AttachmentCollection
{ {
$this->hasAttachments(); $this->hasAttachments();
$this->withAttachmentInformation(); $this->withAttachmentInformation();
$filter = function (int $index, array $object) use ($name): bool { $filter = static function (int $index, array $object) use ($name): bool {
/** @var array $transaction */ /** @var array $transaction */
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */ /** @var array $attachment */
@ -297,7 +297,7 @@ trait AttachmentCollection
{ {
$this->hasAttachments(); $this->hasAttachments();
$this->withAttachmentInformation(); $this->withAttachmentInformation();
$filter = function (int $index, array $object) use ($name): bool { $filter = static function (int $index, array $object) use ($name): bool {
/** @var array $transaction */ /** @var array $transaction */
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */ /** @var array $attachment */
@ -327,7 +327,7 @@ trait AttachmentCollection
{ {
$this->hasAttachments(); $this->hasAttachments();
$this->withAttachmentInformation(); $this->withAttachmentInformation();
$filter = function (int $index, array $object) use ($value): bool { $filter = static function (int $index, array $object) use ($value): bool {
/** @var array $transaction */ /** @var array $transaction */
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */ /** @var array $attachment */
@ -354,7 +354,7 @@ trait AttachmentCollection
{ {
$this->hasAttachments(); $this->hasAttachments();
$this->withAttachmentInformation(); $this->withAttachmentInformation();
$filter = function (int $index, array $object) use ($value): bool { $filter = static function (int $index, array $object) use ($value): bool {
/** @var array $transaction */ /** @var array $transaction */
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */ /** @var array $attachment */
@ -381,7 +381,7 @@ trait AttachmentCollection
{ {
$this->hasAttachments(); $this->hasAttachments();
$this->withAttachmentInformation(); $this->withAttachmentInformation();
$filter = function (int $index, array $object) use ($value): bool { $filter = static function (int $index, array $object) use ($value): bool {
/** @var array $transaction */ /** @var array $transaction */
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */ /** @var array $attachment */
@ -408,7 +408,7 @@ trait AttachmentCollection
{ {
$this->hasAttachments(); $this->hasAttachments();
$this->withAttachmentInformation(); $this->withAttachmentInformation();
$filter = function (int $index, array $object) use ($value): bool { $filter = static function (int $index, array $object) use ($value): bool {
/** @var array $transaction */ /** @var array $transaction */
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */ /** @var array $attachment */
@ -435,7 +435,7 @@ trait AttachmentCollection
{ {
$this->hasAttachments(); $this->hasAttachments();
$this->withAttachmentInformation(); $this->withAttachmentInformation();
$filter = function (int $index, array $object) use ($value): bool { $filter = static function (int $index, array $object) use ($value): bool {
/** @var array $transaction */ /** @var array $transaction */
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */ /** @var array $attachment */
@ -462,7 +462,7 @@ trait AttachmentCollection
{ {
$this->hasAttachments(); $this->hasAttachments();
$this->withAttachmentInformation(); $this->withAttachmentInformation();
$filter = function (int $index, array $object) use ($value): bool { $filter = static function (int $index, array $object) use ($value): bool {
/** @var array $transaction */ /** @var array $transaction */
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */ /** @var array $attachment */
@ -489,7 +489,7 @@ trait AttachmentCollection
{ {
$this->hasAttachments(); $this->hasAttachments();
$this->withAttachmentInformation(); $this->withAttachmentInformation();
$filter = function (int $index, array $object) use ($value): bool { $filter = static function (int $index, array $object) use ($value): bool {
/** @var array $transaction */ /** @var array $transaction */
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */ /** @var array $attachment */
@ -516,7 +516,7 @@ trait AttachmentCollection
{ {
$this->hasAttachments(); $this->hasAttachments();
$this->withAttachmentInformation(); $this->withAttachmentInformation();
$filter = function (int $index, array $object) use ($value): bool { $filter = static function (int $index, array $object) use ($value): bool {
/** @var array $transaction */ /** @var array $transaction */
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */ /** @var array $attachment */
@ -544,10 +544,10 @@ trait AttachmentCollection
app('log')->debug('Add filter on no attachments.'); app('log')->debug('Add filter on no attachments.');
$this->joinAttachmentTables(); $this->joinAttachmentTables();
$this->query->where(function (Builder $q1) { // @phpstan-ignore-line $this->query->where(static function (Builder $q1) { // @phpstan-ignore-line
$q1 $q1
->whereNull('attachments.attachable_id') ->whereNull('attachments.attachable_id')
->orWhere(function (Builder $q2) { ->orWhere(static function (Builder $q2) {
$q2 $q2
->whereNotNull('attachments.attachable_id') ->whereNotNull('attachments.attachable_id')
->whereNotNull('attachments.deleted_at'); ->whereNotNull('attachments.deleted_at');

View File

@ -915,7 +915,7 @@ trait MetaCollection
// this method adds a "postFilter" to the collector. // this method adds a "postFilter" to the collector.
$list = $tags->pluck('tag')->toArray(); $list = $tags->pluck('tag')->toArray();
$filter = function (int $index, array $object) use ($list): bool { $filter = static function (int $index, array $object) use ($list): bool {
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
foreach ($transaction['tags'] as $tag) { foreach ($transaction['tags'] as $tag) {
if (in_array($tag['name'], $list, true)) { if (in_array($tag['name'], $list, true)) {
@ -1050,13 +1050,13 @@ trait MetaCollection
{ {
$this->joinMetaDataTables(); $this->joinMetaDataTables();
// TODO not sure if this will work properly. // TODO not sure if this will work properly.
$this->query->where(function (Builder $q1) { // @phpstan-ignore-line $this->query->where(static function (Builder $q1) { // @phpstan-ignore-line
$q1->where(function (Builder $q2) { $q1->where(static function (Builder $q2) {
$q2->where('journal_meta.name', '=', 'external_id'); $q2->where('journal_meta.name', '=', 'external_id');
$q2->whereNull('journal_meta.data'); $q2->whereNull('journal_meta.data');
})->orWhere(function (Builder $q3) { })->orWhere(static function (Builder $q3) {
$q3->where('journal_meta.name', '!=', 'external_id'); $q3->where('journal_meta.name', '!=', 'external_id');
})->orWhere(function (Builder $q4) { })->orWhere(static function (Builder $q4) {
$q4->whereNull('journal_meta.name'); $q4->whereNull('journal_meta.name');
}); });
}); });
@ -1071,13 +1071,13 @@ trait MetaCollection
{ {
$this->joinMetaDataTables(); $this->joinMetaDataTables();
// TODO not sure if this will work properly. // TODO not sure if this will work properly.
$this->query->where(function (Builder $q1) { // @phpstan-ignore-line $this->query->where(static function (Builder $q1) { // @phpstan-ignore-line
$q1->where(function (Builder $q2) { $q1->where(static function (Builder $q2) {
$q2->where('journal_meta.name', '=', 'external_url'); $q2->where('journal_meta.name', '=', 'external_url');
$q2->whereNull('journal_meta.data'); $q2->whereNull('journal_meta.data');
})->orWhere(function (Builder $q3) { })->orWhere(static function (Builder $q3) {
$q3->where('journal_meta.name', '!=', 'external_url'); $q3->where('journal_meta.name', '!=', 'external_url');
})->orWhere(function (Builder $q4) { })->orWhere(static function (Builder $q4) {
$q4->whereNull('journal_meta.name'); $q4->whereNull('journal_meta.name');
}); });
}); });
@ -1091,7 +1091,7 @@ trait MetaCollection
public function withoutNotes(): GroupCollectorInterface public function withoutNotes(): GroupCollectorInterface
{ {
$this->withNotes(); $this->withNotes();
$this->query->where(function (Builder $q) { // @phpstan-ignore-line $this->query->where(static function (Builder $q) { // @phpstan-ignore-line
$q->whereNull('notes.text'); $q->whereNull('notes.text');
$q->orWhere('notes.text', ''); $q->orWhere('notes.text', '');
}); });

View File

@ -93,7 +93,7 @@ trait TimeCollection
$start->startOfDay(); $start->startOfDay();
$this->withMetaDate($field); $this->withMetaDate($field);
$filter = function (int $index, array $object) use ($field, $start, $end): bool { $filter = static function (int $index, array $object) use ($field, $start, $end): bool {
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon) {
return $transaction[$field]->lt($start) || $transaction[$field]->gt($end); return $transaction[$field]->lt($start) || $transaction[$field]->gt($end);
@ -166,7 +166,7 @@ trait TimeCollection
public function metaDayAfter(string $day, string $field): GroupCollectorInterface public function metaDayAfter(string $day, string $field): GroupCollectorInterface
{ {
$this->withMetaDate($field); $this->withMetaDate($field);
$filter = function (int $index, array $object) use ($field, $day): bool { $filter = static function (int $index, array $object) use ($field, $day): bool {
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) { ) {
@ -190,7 +190,7 @@ trait TimeCollection
public function metaDayBefore(string $day, string $field): GroupCollectorInterface public function metaDayBefore(string $day, string $field): GroupCollectorInterface
{ {
$this->withMetaDate($field); $this->withMetaDate($field);
$filter = function (int $index, array $object) use ($field, $day): bool { $filter = static function (int $index, array $object) use ($field, $day): bool {
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) { ) {
@ -214,7 +214,7 @@ trait TimeCollection
public function metaDayIs(string $day, string $field): GroupCollectorInterface public function metaDayIs(string $day, string $field): GroupCollectorInterface
{ {
$this->withMetaDate($field); $this->withMetaDate($field);
$filter = function (int $index, array $object) use ($field, $day): bool { $filter = static function (int $index, array $object) use ($field, $day): bool {
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) { ) {
@ -237,7 +237,7 @@ trait TimeCollection
public function metaDayIsNot(string $day, string $field): GroupCollectorInterface public function metaDayIsNot(string $day, string $field): GroupCollectorInterface
{ {
$this->withMetaDate($field); $this->withMetaDate($field);
$filter = function (int $index, array $object) use ($field, $day): bool { $filter = static function (int $index, array $object) use ($field, $day): bool {
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) { ) {
@ -260,7 +260,7 @@ trait TimeCollection
public function metaMonthAfter(string $month, string $field): GroupCollectorInterface public function metaMonthAfter(string $month, string $field): GroupCollectorInterface
{ {
$this->withMetaDate($field); $this->withMetaDate($field);
$filter = function (int $index, array $object) use ($field, $month): bool { $filter = static function (int $index, array $object) use ($field, $month): bool {
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) { ) {
@ -284,7 +284,7 @@ trait TimeCollection
public function metaMonthBefore(string $month, string $field): GroupCollectorInterface public function metaMonthBefore(string $month, string $field): GroupCollectorInterface
{ {
$this->withMetaDate($field); $this->withMetaDate($field);
$filter = function (int $index, array $object) use ($field, $month): bool { $filter = static function (int $index, array $object) use ($field, $month): bool {
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) { ) {
@ -308,7 +308,7 @@ trait TimeCollection
public function metaMonthIs(string $month, string $field): GroupCollectorInterface public function metaMonthIs(string $month, string $field): GroupCollectorInterface
{ {
$this->withMetaDate($field); $this->withMetaDate($field);
$filter = function (int $index, array $object) use ($field, $month): bool { $filter = static function (int $index, array $object) use ($field, $month): bool {
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) { ) {
@ -331,7 +331,7 @@ trait TimeCollection
public function metaMonthIsNot(string $month, string $field): GroupCollectorInterface public function metaMonthIsNot(string $month, string $field): GroupCollectorInterface
{ {
$this->withMetaDate($field); $this->withMetaDate($field);
$filter = function (int $index, array $object) use ($field, $month): bool { $filter = static function (int $index, array $object) use ($field, $month): bool {
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) { ) {
@ -354,7 +354,7 @@ trait TimeCollection
public function metaYearAfter(string $year, string $field): GroupCollectorInterface public function metaYearAfter(string $year, string $field): GroupCollectorInterface
{ {
$this->withMetaDate($field); $this->withMetaDate($field);
$filter = function (int $index, array $object) use ($field, $year): bool { $filter = static function (int $index, array $object) use ($field, $year): bool {
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) { ) {
@ -378,7 +378,7 @@ trait TimeCollection
public function metaYearBefore(string $year, string $field): GroupCollectorInterface public function metaYearBefore(string $year, string $field): GroupCollectorInterface
{ {
$this->withMetaDate($field); $this->withMetaDate($field);
$filter = function (int $index, array $object) use ($field, $year): bool { $filter = static function (int $index, array $object) use ($field, $year): bool {
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) { ) {
@ -402,7 +402,7 @@ trait TimeCollection
public function metaYearIs(string $year, string $field): GroupCollectorInterface public function metaYearIs(string $year, string $field): GroupCollectorInterface
{ {
$this->withMetaDate($field); $this->withMetaDate($field);
$filter = function (int $index, array $object) use ($field, $year): bool { $filter = static function (int $index, array $object) use ($field, $year): bool {
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) { ) {
@ -426,7 +426,7 @@ trait TimeCollection
public function metaYearIsNot(string $year, string $field): GroupCollectorInterface public function metaYearIsNot(string $year, string $field): GroupCollectorInterface
{ {
$this->withMetaDate($field); $this->withMetaDate($field);
$filter = function (int $index, array $object) use ($field, $year): bool { $filter = static function (int $index, array $object) use ($field, $year): bool {
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) { ) {
@ -702,7 +702,7 @@ trait TimeCollection
{ {
$this->withMetaDate($field); $this->withMetaDate($field);
$date->startOfDay(); $date->startOfDay();
$filter = function (int $index, array $object) use ($field, $date): bool { $filter = static function (int $index, array $object) use ($field, $date): bool {
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) { ) {
@ -726,7 +726,7 @@ trait TimeCollection
public function setMetaBefore(Carbon $date, string $field): GroupCollectorInterface public function setMetaBefore(Carbon $date, string $field): GroupCollectorInterface
{ {
$this->withMetaDate($field); $this->withMetaDate($field);
$filter = function (int $index, array $object) use ($field, $date): bool { $filter = static function (int $index, array $object) use ($field, $date): bool {
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) { ) {
@ -758,7 +758,7 @@ trait TimeCollection
$start->startOfDay(); $start->startOfDay();
$this->withMetaDate($field); $this->withMetaDate($field);
$filter = function (int $index, array $object) use ($field, $start, $end): bool { $filter = static function (int $index, array $object) use ($field, $start, $end): bool {
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
) { ) {

View File

@ -52,12 +52,12 @@ use Illuminate\Support\Collection;
*/ */
class GroupCollector implements GroupCollectorInterface class GroupCollector implements GroupCollectorInterface
{ {
use CollectorProperties;
use AccountCollection; use AccountCollection;
use AmountCollection; use AmountCollection;
use TimeCollection;
use MetaCollection;
use AttachmentCollection; use AttachmentCollection;
use CollectorProperties;
use MetaCollection;
use TimeCollection;
/** /**
* Group collector constructor. * Group collector constructor.
@ -1077,7 +1077,7 @@ class GroupCollector implements GroupCollectorInterface
// join source transaction. // join source transaction.
->leftJoin( ->leftJoin(
'transactions as source', 'transactions as source',
function (JoinClause $join) { static function (JoinClause $join) {
$join->on('source.transaction_journal_id', '=', 'transaction_journals.id') $join->on('source.transaction_journal_id', '=', 'transaction_journals.id')
->where('source.amount', '<', 0); ->where('source.amount', '<', 0);
} }
@ -1085,7 +1085,7 @@ class GroupCollector implements GroupCollectorInterface
// join destination transaction // join destination transaction
->leftJoin( ->leftJoin(
'transactions as destination', 'transactions as destination',
function (JoinClause $join) { static function (JoinClause $join) {
$join->on('destination.transaction_journal_id', '=', 'transaction_journals.id') $join->on('destination.transaction_journal_id', '=', 'transaction_journals.id')
->where('destination.amount', '>', 0); ->where('destination.amount', '>', 0);
} }
@ -1135,7 +1135,7 @@ class GroupCollector implements GroupCollectorInterface
// join source transaction. // join source transaction.
->leftJoin( ->leftJoin(
'transactions as source', 'transactions as source',
function (JoinClause $join) { static function (JoinClause $join) {
$join->on('source.transaction_journal_id', '=', 'transaction_journals.id') $join->on('source.transaction_journal_id', '=', 'transaction_journals.id')
->where('source.amount', '<', 0); ->where('source.amount', '<', 0);
} }
@ -1143,7 +1143,7 @@ class GroupCollector implements GroupCollectorInterface
// join destination transaction // join destination transaction
->leftJoin( ->leftJoin(
'transactions as destination', 'transactions as destination',
function (JoinClause $join) { static function (JoinClause $join) {
$join->on('destination.transaction_journal_id', '=', 'transaction_journals.id') $join->on('destination.transaction_journal_id', '=', 'transaction_journals.id')
->where('destination.amount', '>', 0); ->where('destination.amount', '>', 0);
} }

File diff suppressed because it is too large Load Diff

View File

@ -51,8 +51,8 @@ use Psr\Container\NotFoundExceptionInterface;
*/ */
class RegisterController extends Controller class RegisterController extends Controller
{ {
use RegistersUsers;
use CreateStuff; use CreateStuff;
use RegistersUsers;
/** /**
* Where to redirect users after registration. * Where to redirect users after registration.

View File

@ -46,8 +46,8 @@ use Psr\Container\NotFoundExceptionInterface;
*/ */
class ShowController extends Controller class ShowController extends Controller
{ {
use PeriodOverview;
use AugumentData; use AugumentData;
use PeriodOverview;
protected JournalRepositoryInterface $journalRepos; protected JournalRepositoryInterface $journalRepos;
private BudgetRepositoryInterface $repository; private BudgetRepositoryInterface $repository;

View File

@ -50,9 +50,9 @@ use Psr\Container\NotFoundExceptionInterface;
*/ */
class AccountController extends Controller class AccountController extends Controller
{ {
use DateCalculation;
use AugumentData; use AugumentData;
use ChartGeneration; use ChartGeneration;
use DateCalculation;
protected GeneratorInterface $generator; protected GeneratorInterface $generator;
private AccountRepositoryInterface $accountRepository; private AccountRepositoryInterface $accountRepository;

View File

@ -49,8 +49,8 @@ use Illuminate\Support\Collection;
*/ */
class BudgetController extends Controller class BudgetController extends Controller
{ {
use DateCalculation;
use AugumentData; use AugumentData;
use DateCalculation;
protected GeneratorInterface $generator; protected GeneratorInterface $generator;
protected OperationsRepositoryInterface $opsRepository; protected OperationsRepositoryInterface $opsRepository;

View File

@ -47,9 +47,9 @@ use Psr\Container\NotFoundExceptionInterface;
*/ */
class CategoryController extends Controller class CategoryController extends Controller
{ {
use DateCalculation;
use AugumentData; use AugumentData;
use ChartGeneration; use ChartGeneration;
use DateCalculation;
/** @var GeneratorInterface Chart generation methods. */ /** @var GeneratorInterface Chart generation methods. */
protected $generator; protected $generator;

View File

@ -96,7 +96,7 @@ class PiggyBankController extends Controller
$chartData = []; $chartData = [];
while ($oldest <= $today) { while ($oldest <= $today) {
$filtered = $set->filter( $filtered = $set->filter(
function (PiggyBankEvent $event) use ($oldest) { static function (PiggyBankEvent $event) use ($oldest) {
return $event->date->lte($oldest); return $event->date->lte($oldest);
} }
); );
@ -106,7 +106,7 @@ class PiggyBankController extends Controller
$oldest = app('navigation')->addPeriod($oldest, $step, 0); $oldest = app('navigation')->addPeriod($oldest, $step, 0);
} }
$finalFiltered = $set->filter( $finalFiltered = $set->filter(
function (PiggyBankEvent $event) use ($today) { static function (PiggyBankEvent $event) use ($today) {
return $event->date->lte($today); return $event->date->lte($today);
} }
); );

View File

@ -39,9 +39,9 @@ abstract class Controller extends BaseController
{ {
use AuthorizesRequests; use AuthorizesRequests;
use DispatchesJobs; use DispatchesJobs;
use ValidatesRequests;
use RequestInformation; use RequestInformation;
use UserNavigation; use UserNavigation;
use ValidatesRequests;
protected string $dateTimeFormat; protected string $dateTimeFormat;
protected string $monthAndDayFormat; protected string $monthAndDayFormat;

View File

@ -129,7 +129,7 @@ class DebugController extends Controller
// get latest log file: // get latest log file:
$logger = Log::driver(); $logger = Log::driver();
// PHPstan doesn't recognize the method because of its polymorphic nature. // PHPstan doesn't recognize the method because of its polymorphic nature.
$handlers = $logger->getHandlers(); // @phpstan-ignore-line $handlers = $logger->getHandlers(); /** @phpstan-ignore-line */
$logContent = ''; $logContent = '';
foreach ($handlers as $handler) { foreach ($handlers as $handler) {
if ($handler instanceof RotatingFileHandler) { if ($handler instanceof RotatingFileHandler) {
@ -174,7 +174,7 @@ class DebugController extends Controller
'db_version' => app('fireflyconfig')->get('db_version', 1)->data, 'db_version' => app('fireflyconfig')->get('db_version', 1)->data,
'php_version' => PHP_VERSION, 'php_version' => PHP_VERSION,
'php_os' => PHP_OS, 'php_os' => PHP_OS,
'interface' => PHP_SAPI, 'interface' => \PHP_SAPI,
'bcscale' => bcscale(), 'bcscale' => bcscale(),
'display_errors' => ini_get('display_errors'), 'display_errors' => ini_get('display_errors'),
'error_reporting' => $this->errorReporting((int)ini_get('error_reporting')), 'error_reporting' => $this->errorReporting((int)ini_get('error_reporting')),
@ -246,7 +246,7 @@ class DebugController extends Controller
'default_locale' => (string)config('firefly.default_locale'), 'default_locale' => (string)config('firefly.default_locale'),
'remote_header' => $userGuard === 'remote_user_guard' ? config('auth.guard_header') : 'N/A', 'remote_header' => $userGuard === 'remote_user_guard' ? config('auth.guard_header') : 'N/A',
'remote_mail_header' => $userGuard === 'remote_user_guard' ? config('auth.guard_email') : 'N/A', 'remote_mail_header' => $userGuard === 'remote_user_guard' ? config('auth.guard_email') : 'N/A',
'stateful_domains' => join(', ', config('sanctum.stateful')), 'stateful_domains' => implode(', ', config('sanctum.stateful')),
// the dates for the cron job are based on the recurring cron job's times. // the dates for the cron job are based on the recurring cron job's times.
// any of the cron jobs will do, they always run at the same time. // any of the cron jobs will do, they always run at the same time.
@ -339,7 +339,7 @@ class DebugController extends Controller
if ($user->bills()->count() > 0) { if ($user->bills()->count() > 0) {
$flags[] = '<span title="Has subscriptions">:email:</span>'; $flags[] = '<span title="Has subscriptions">:email:</span>';
} }
return join(' ', $flags); return implode(' ', $flags);
} }
/** /**

View File

@ -118,7 +118,7 @@ class BoxController extends Controller
$leftToSpendAmount = bcadd($totalAvailableSum, $spentAmount); $leftToSpendAmount = bcadd($totalAvailableSum, $spentAmount);
app('log')->debug(sprintf('So left to spend is %s', $leftToSpendAmount)); app('log')->debug(sprintf('So left to spend is %s', $leftToSpendAmount));
if (1 === bccomp($leftToSpendAmount, '0')) { if (1 === bccomp($leftToSpendAmount, '0')) {
app('log')->debug(sprintf('Left to spend is positive!')); app('log')->debug('Left to spend is positive!');
$boxTitle = (string)trans('firefly.left_to_spend'); $boxTitle = (string)trans('firefly.left_to_spend');
$days = $today->diffInDays($end) + 1; $days = $today->diffInDays($end) + 1;
$display = 1; // not overspent $display = 1; // not overspent
@ -255,7 +255,7 @@ class BoxController extends Controller
// filter list on preference of being included. // filter list on preference of being included.
$filtered = $allAccounts->filter( $filtered = $allAccounts->filter(
function (Account $account) use ($accountRepository) { static function (Account $account) use ($accountRepository) {
$includeNetWorth = $accountRepository->getMetaValue($account, 'include_net_worth'); $includeNetWorth = $accountRepository->getMetaValue($account, 'include_net_worth');
$result = null === $includeNetWorth ? true : '1' === $includeNetWorth; $result = null === $includeNetWorth ? true : '1' === $includeNetWorth;
if (false === $result) { if (false === $result) {

View File

@ -53,7 +53,7 @@ class PreferencesController extends Controller
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { static function ($request, $next) {
app('view')->share('title', (string)trans('firefly.preferences')); app('view')->share('title', (string)trans('firefly.preferences'));
app('view')->share('mainTitleIcon', 'fa-gear'); app('view')->share('mainTitleIcon', 'fa-gear');

View File

@ -45,8 +45,8 @@ use Illuminate\View\View;
*/ */
class CreateController extends Controller class CreateController extends Controller
{ {
use RuleManagement;
use ModelInformation; use ModelInformation;
use RuleManagement;
private RuleRepositoryInterface $ruleRepos; private RuleRepositoryInterface $ruleRepos;

View File

@ -44,8 +44,8 @@ use Throwable;
*/ */
class EditController extends Controller class EditController extends Controller
{ {
use RuleManagement;
use RenderPartialViews; use RenderPartialViews;
use RuleManagement;
private RuleRepositoryInterface $ruleRepos; private RuleRepositoryInterface $ruleRepos;

View File

@ -57,7 +57,7 @@ class SelectController extends Controller
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { static function ($request, $next) {
app('view')->share('title', (string)trans('firefly.rules')); app('view')->share('title', (string)trans('firefly.rules'));
app('view')->share('mainTitleIcon', 'fa-random'); app('view')->share('mainTitleIcon', 'fa-random');

View File

@ -84,7 +84,7 @@ class IndexController extends Controller
// order so default is on top: // order so default is on top:
$collection = $collection->sortBy( $collection = $collection->sortBy(
function (TransactionCurrency $currency) { static function (TransactionCurrency $currency) {
$default = true === $currency->userDefault ? 0 : 1; $default = true === $currency->userDefault ? 0 : 1;
$enabled = true === $currency->userEnabled ? 0 : 1; $enabled = true === $currency->userEnabled ? 0 : 1;
return sprintf('%s-%s-%s', $default, $enabled, $currency->code); return sprintf('%s-%s-%s', $default, $enabled, $currency->code);

View File

@ -42,7 +42,7 @@ class CreateController extends Controller
// translations: // translations:
$this->middleware( $this->middleware(
function ($request, $next) { static function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-bolt'); app('view')->share('mainTitleIcon', 'fa-bolt');
app('view')->share('subTitleIcon', 'fa-plus'); app('view')->share('subTitleIcon', 'fa-plus');
app('view')->share('title', (string)trans('firefly.webhooks')); app('view')->share('title', (string)trans('firefly.webhooks'));

View File

@ -45,7 +45,7 @@ class DeleteController extends Controller
// translations: // translations:
$this->middleware( $this->middleware(
function ($request, $next) { static function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-bolt'); app('view')->share('mainTitleIcon', 'fa-bolt');
app('view')->share('subTitleIcon', 'fa-trash'); app('view')->share('subTitleIcon', 'fa-trash');
app('view')->share('title', (string)trans('firefly.webhooks')); app('view')->share('title', (string)trans('firefly.webhooks'));

View File

@ -45,7 +45,7 @@ class EditController extends Controller
// translations: // translations:
$this->middleware( $this->middleware(
function ($request, $next) { static function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-bolt'); app('view')->share('mainTitleIcon', 'fa-bolt');
app('view')->share('subTitleIcon', 'fa-pencil'); app('view')->share('subTitleIcon', 'fa-pencil');
app('view')->share('title', (string)trans('firefly.webhooks')); app('view')->share('title', (string)trans('firefly.webhooks'));

View File

@ -43,7 +43,7 @@ class IndexController extends Controller
// translations: // translations:
$this->middleware( $this->middleware(
function ($request, $next) { static function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-bolt'); app('view')->share('mainTitleIcon', 'fa-bolt');
app('view')->share('title', (string)trans('firefly.webhooks')); app('view')->share('title', (string)trans('firefly.webhooks'));

View File

@ -45,7 +45,7 @@ class ShowController extends Controller
// translations: // translations:
$this->middleware( $this->middleware(
function ($request, $next) { static function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-bolt'); app('view')->share('mainTitleIcon', 'fa-bolt');
app('view')->share('subTitleIcon', 'fa-bolt'); app('view')->share('subTitleIcon', 'fa-bolt');
app('view')->share('title', (string)trans('firefly.webhooks')); app('view')->share('title', (string)trans('firefly.webhooks'));

View File

@ -37,9 +37,9 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class AccountFormRequest extends FormRequest class AccountFormRequest extends FormRequest
{ {
use ConvertsDataTypes;
use AppendsLocationData; use AppendsLocationData;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
protected array $acceptedRoles = [UserRoleEnum::MANAGE_TRANSACTIONS]; protected array $acceptedRoles = [UserRoleEnum::MANAGE_TRANSACTIONS];

View File

@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest;
*/ */
class AttachmentFormRequest extends FormRequest class AttachmentFormRequest extends FormRequest
{ {
use ConvertsDataTypes;
use ChecksLogin; use ChecksLogin;
use ConvertsDataTypes;
/** /**
* Returns the data required by the controller. * Returns the data required by the controller.

Some files were not shown because too many files have changed in this diff Show More