Always great when using conflicting tools

This commit is contained in:
James Cole 2023-12-10 06:57:41 +01:00
parent 46e130fdfe
commit ce023f2580
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
28 changed files with 115 additions and 114 deletions

View File

@ -13,6 +13,7 @@ parameters:
- '#is not allowed to extend#'
- '#switch is forbidden to use#'
- '#is neither abstract nor final#'
- '#on left side of \?\?\= always exists and is not nullable#'
- '#has a nullable return type declaration#' # perhaps throw errors instead?
- '#with a nullable type declaration#' # decide what action should be if param is null.
- '#with null as default value#'

View File

@ -43,8 +43,8 @@ class FixAccountTypes extends Command
{
use ShowsFriendlyMessages;
protected $description = 'Make sure all journals have the correct from/to account types.';
protected $signature = 'firefly-iii:fix-account-types';
protected $description = 'Make sure all journals have the correct from/to account types.';
protected $signature = 'firefly-iii:fix-account-types';
private int $count;
private array $expected;
private AccountFactory $factory;

View File

@ -37,8 +37,8 @@ class FixIbans extends Command
{
use ShowsFriendlyMessages;
protected $description = 'Removes spaces from IBANs';
protected $signature = 'firefly-iii:fix-ibans';
protected $description = 'Removes spaces from IBANs';
protected $signature = 'firefly-iii:fix-ibans';
private int $count = 0;
/**

View File

@ -40,8 +40,8 @@ class FixRecurringTransactions extends Command
{
use ShowsFriendlyMessages;
protected $description = 'Fixes recurring transactions with the wrong transaction type.';
protected $signature = 'firefly-iii:fix-recurring-transactions';
protected $description = 'Fixes recurring transactions with the wrong transaction type.';
protected $signature = 'firefly-iii:fix-recurring-transactions';
private int $count = 0;
private RecurringRepositoryInterface $recurringRepos;
private UserRepositoryInterface $userRepos;

View File

@ -51,7 +51,7 @@ class ExportData extends Command
protected $description = 'Command to export data from Firefly III.';
protected $signature = 'firefly-iii:export-data
protected $signature = 'firefly-iii:export-data
{--user=1 : The user ID that the export should run for.}
{--token= : The user\'s access token.}
{--start= : First transaction to export. Defaults to your very first transaction. Only applies to transaction export.}

View File

@ -42,7 +42,7 @@ class CreateFirstUser extends Command
protected $description = 'Creates a new user and gives admin rights. Outputs the password on the command line. Strictly for testing.';
protected $signature = 'firefly-iii:create-first-user {email}';
protected $signature = 'firefly-iii:create-first-user {email}';
private UserRepositoryInterface $repository;
/**

View File

@ -53,8 +53,8 @@ class ForceDecimalSize extends Command
{
use ShowsFriendlyMessages;
protected $description = 'This command resizes DECIMAL columns in MySQL or PostgreSQL and correct amounts (only MySQL).';
protected $signature = 'firefly-iii:force-decimal-size';
protected $description = 'This command resizes DECIMAL columns in MySQL or PostgreSQL and correct amounts (only MySQL).';
protected $signature = 'firefly-iii:force-decimal-size';
private string $cast;
private array $classes
= [

View File

@ -50,7 +50,7 @@ class ApplyRules extends Command
protected $description = 'This command will apply your rules and rule groups on a selection of your transactions.';
protected $signature
protected $signature
= 'firefly-iii:apply-rules
{--user=1 : The user ID.}
{--token= : The user\'s access token.}

View File

@ -46,8 +46,8 @@ class AccountCurrencies extends Command
public const string CONFIG_NAME = '480_account_currencies';
protected $description = 'Give all accounts proper currency info.';
protected $signature = 'firefly-iii:account-currencies {--F|force : Force the execution of this command.}';
protected $description = 'Give all accounts proper currency info.';
protected $signature = 'firefly-iii:account-currencies {--F|force : Force the execution of this command.}';
private AccountRepositoryInterface $accountRepos;
private int $count;
private UserRepositoryInterface $userRepos;

View File

@ -51,8 +51,8 @@ class MigrateToGroups extends Command
use ShowsFriendlyMessages;
public const string CONFIG_NAME = '480_migrated_to_groups';
protected $description = 'Migrates a pre-4.7.8 transaction structure to the 4.7.8+ transaction structure.';
protected $signature = 'firefly-iii:migrate-to-groups {--F|force : Force the migration, even if it fired before.}';
protected $description = 'Migrates a pre-4.7.8 transaction structure to the 4.7.8+ transaction structure.';
protected $signature = 'firefly-iii:migrate-to-groups {--F|force : Force the migration, even if it fired before.}';
private JournalCLIRepositoryInterface $cliRepository;
private int $count;
private TransactionGroupFactory $groupFactory;

View File

@ -48,7 +48,7 @@ class MigrateToRules extends Command
protected $description = 'Migrate bills to rules.';
protected $signature = 'firefly-iii:bills-to-rules {--F|force : Force the execution of this command.}';
protected $signature = 'firefly-iii:bills-to-rules {--F|force : Force the execution of this command.}';
private BillRepositoryInterface $billRepository;
private int $count;
private RuleGroupRepositoryInterface $ruleGroupRepository;

View File

@ -45,8 +45,8 @@ class OtherCurrenciesCorrections extends Command
use ShowsFriendlyMessages;
public const string CONFIG_NAME = '480_other_currencies';
protected $description = 'Update all journal currency information.';
protected $signature = 'firefly-iii:other-currencies {--F|force : Force the execution of this command.}';
protected $description = 'Update all journal currency information.';
protected $signature = 'firefly-iii:other-currencies {--F|force : Force the execution of this command.}';
private array $accountCurrencies;
private AccountRepositoryInterface $accountRepos;
private JournalCLIRepositoryInterface $cliRepos;

View File

@ -42,8 +42,8 @@ class TransactionIdentifier extends Command
use ShowsFriendlyMessages;
public const string CONFIG_NAME = '480_transaction_identifier';
protected $description = 'Fixes transaction identifiers.';
protected $signature = 'firefly-iii:transaction-identifiers {--F|force : Force the execution of this command.}';
protected $description = 'Fixes transaction identifiers.';
protected $signature = 'firefly-iii:transaction-identifiers {--F|force : Force the execution of this command.}';
private JournalCLIRepositoryInterface $cliRepository;
private int $count;

View File

@ -43,8 +43,8 @@ class TransferCurrenciesCorrections extends Command
use ShowsFriendlyMessages;
public const string CONFIG_NAME = '480_transfer_currencies';
protected $description = 'Updates transfer currency information.';
protected $signature = 'firefly-iii:transfer-currencies {--F|force : Force the execution of this command.}';
protected $description = 'Updates transfer currency information.';
protected $signature = 'firefly-iii:transfer-currencies {--F|force : Force the execution of this command.}';
private array $accountCurrencies;
private AccountRepositoryInterface $accountRepos;
private JournalCLIRepositoryInterface $cliRepos;

View File

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

View File

@ -190,8 +190,8 @@ class BudgetLimitHandler
);
// overlap in days:
$limitPeriod = Period::make(
$budgetLimit->start_date,
$budgetLimit->end_date,
$budgetLimit->start_date,
$budgetLimit->end_date,
precision : Precision::DAY(),
boundaries: Boundaries::EXCLUDE_NONE()
);
@ -236,8 +236,8 @@ class BudgetLimitHandler
return '0';
}
$limitPeriod = Period::make(
$budgetLimit->start_date,
$budgetLimit->end_date,
$budgetLimit->start_date,
$budgetLimit->end_date,
precision : Precision::DAY(),
boundaries: Boundaries::EXCLUDE_NONE()
);

View File

@ -56,9 +56,9 @@ trait AttachmentCollection
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
$result = str_contains(strtolower($attachment['filename']), strtolower($name)) || str_contains(
strtolower($attachment['title']),
strtolower($name)
);
strtolower($attachment['title']),
strtolower($name)
);
if (true === $result) {
return true;
}
@ -142,9 +142,9 @@ trait AttachmentCollection
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
$result = !str_contains(strtolower($attachment['filename']), strtolower($name)) && !str_contains(
strtolower($attachment['title']),
strtolower($name)
);
strtolower($attachment['title']),
strtolower($name)
);
if (true === $result) {
return true;
}
@ -179,9 +179,9 @@ trait AttachmentCollection
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
$result = !str_ends_with(strtolower($attachment['filename']), strtolower($name)) && !str_ends_with(
strtolower($attachment['title']),
strtolower($name)
);
strtolower($attachment['title']),
strtolower($name)
);
if (true === $result) {
return true;
}
@ -216,9 +216,9 @@ trait AttachmentCollection
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
$result = !str_starts_with(strtolower($attachment['filename']), strtolower($name)) && !str_starts_with(
strtolower($attachment['title']),
strtolower($name)
);
strtolower($attachment['title']),
strtolower($name)
);
if (true === $result) {
return true;
}
@ -246,9 +246,9 @@ trait AttachmentCollection
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
$result = str_ends_with(strtolower($attachment['filename']), strtolower($name)) || str_ends_with(
strtolower($attachment['title']),
strtolower($name)
);
strtolower($attachment['title']),
strtolower($name)
);
if (true === $result) {
return true;
}
@ -330,9 +330,9 @@ trait AttachmentCollection
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
$result = str_starts_with(strtolower($attachment['filename']), strtolower($name)) || str_starts_with(
strtolower($attachment['title']),
strtolower($name)
);
strtolower($attachment['title']),
strtolower($name)
);
if (true === $result) {
return true;
}

View File

@ -135,7 +135,7 @@ class IndexController extends Controller
// get budgeted for default currency:
if (0 === count($availableBudgets)) {
$budgeted = $this->blRepository->budgeted($start, $end, $defaultCurrency,);
$budgeted = $this->blRepository->budgeted($start, $end, $defaultCurrency, );
$spentArr = $this->opsRepository->sumExpenses($start, $end, null, null, $defaultCurrency);
$spent = $spentArr[$defaultCurrency->id]['sum'] ?? '0';
unset($spentArr);
@ -194,7 +194,7 @@ class IndexController extends Controller
$array['spent'] = $spentArr[$entry->transaction_currency_id]['sum'] ?? '0';
// budgeted in period:
$budgeted = $this->blRepository->budgeted($entry->start_date, $entry->end_date, $entry->transactionCurrency,);
$budgeted = $this->blRepository->budgeted($entry->start_date, $entry->end_date, $entry->transactionCurrency, );
$array['budgeted'] = $budgeted;
$availableBudgets[] = $array;
unset($spentArr);

View File

@ -86,12 +86,12 @@ class BoxController extends Controller
static function (AvailableBudget $availableBudget) use ($currency) { // @phpstan-ignore-line
if ($availableBudget->transaction_currency_id === $currency->id) {
app('log')->debug(sprintf(
'Will include AB #%d: from %s-%s amount %s',
$availableBudget->id,
$availableBudget->start_date->format('Y-m-d'),
$availableBudget->end_date->format('Y-m-d'),
$availableBudget->amount
));
'Will include AB #%d: from %s-%s amount %s',
$availableBudget->id,
$availableBudget->start_date->format('Y-m-d'),
$availableBudget->end_date->format('Y-m-d'),
$availableBudget->amount
));
return $availableBudget;
}

View File

@ -161,9 +161,9 @@ class ShowController extends Controller
$amounts[$symbol]['amount'] = bcadd($amounts[$symbol]['amount'], $transaction['amount']);
if (null !== $transaction['foreign_amount'] && '' !== $transaction['foreign_amount']
&& bccomp(
'0',
$transaction['foreign_amount']
) !== 0) {
'0',
$transaction['foreign_amount']
) !== 0) {
// same for foreign currency:
$foreignSymbol = $transaction['foreign_currency_symbol'];
if (!array_key_exists($foreignSymbol, $amounts)) {

View File

@ -127,7 +127,7 @@ class Account extends Model
protected $fillable = ['user_id', 'user_group_id', 'account_type_id', 'name', 'active', 'virtual_balance', 'iban'];
protected $hidden = ['encrypted'];
protected $hidden = ['encrypted'];
private bool $joinedAccountTypes = false;
/**

View File

@ -84,7 +84,7 @@ class TransactionCurrency extends Model
public ?bool $userDefault;
public ?bool $userEnabled;
protected $casts
protected $casts
= [
'created_at' => 'datetime',
'updated_at' => 'datetime',

View File

@ -373,12 +373,12 @@ class BillRepository implements BillRepositoryInterface
return $bill->transactionJournals()
->before($end)->after($start)->get(
[
[
'transaction_journals.id',
'transaction_journals.date',
'transaction_journals.transaction_group_id',
]
);
);
}
/**

View File

@ -60,7 +60,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
// same complex where query as below.
->where(
static function (Builder $q5) use ($start, $end) {
static function (Builder $q5) use ($start, $end) {
$q5->where(
static function (Builder $q1) use ($start, $end) {
$q1->where(
@ -85,7 +85,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
}
);
}
)
)
->where('budget_limits.transaction_currency_id', $currency->id)
->whereNull('budgets.deleted_at')
->where('budgets.active', true)
@ -252,11 +252,11 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
)
// budget limit start within period
->orWhere(
static function (Builder $q3) use ($start, $end) {
static function (Builder $q3) use ($start, $end) {
$q3->where('budget_limits.start_date', '>=', $start->format('Y-m-d 00:00:00'));
$q3->where('budget_limits.start_date', '<=', $end->format('Y-m-d 23:59:59'));
}
);
);
}
)
->orWhere(

View File

@ -497,9 +497,9 @@ class JournalUpdateService
{
$type = $this->transactionJournal->transactionType->type;
if ((
array_key_exists('bill_id', $this->data)
array_key_exists('bill_id', $this->data)
|| array_key_exists('bill_name', $this->data)
)
)
&& TransactionType::WITHDRAWAL === $type
) {
$billId = (int)($this->data['bill_id'] ?? 0);

View File

@ -89,10 +89,10 @@ class Navigation
if (!array_key_exists($repeatFreq, $functionMap)) {
Log::error(sprintf(
'The periodicity %s is unknown. Choose one of available periodicity: %s',
$repeatFreq,
implode(', ', array_keys($functionMap))
));
'The periodicity %s is unknown. Choose one of available periodicity: %s',
$repeatFreq,
implode(', ', array_keys($functionMap))
));
return $theDate;
}
@ -352,12 +352,12 @@ class Navigation
public function diffInPeriods(string $period, int $skip, Carbon $beginning, Carbon $end): int
{
Log::debug(sprintf(
'diffInPeriods: %s (skip: %d), between %s and %s.',
$period,
$skip,
$beginning->format('Y-m-d'),
$end->format('Y-m-d')
));
'diffInPeriods: %s (skip: %d), between %s and %s.',
$period,
$skip,
$beginning->format('Y-m-d'),
$end->format('Y-m-d')
));
$map = [
'daily' => 'floatDiffInDays',
'weekly' => 'floatDiffInWeeks',
@ -394,11 +394,11 @@ class Navigation
$parameter = $skip + 1;
$diff = ceil($diff / $parameter) * $parameter;
Log::debug(sprintf(
'diffInPeriods: skip is %d, so param is %d, and diff becomes %d',
$skip,
$parameter,
$diff
));
'diffInPeriods: skip is %d, so param is %d, and diff becomes %d',
$skip,
$parameter,
$diff
));
}
return (int)$diff;

View File

@ -326,15 +326,15 @@ class Steam
$balances[$format] = $currentBalance;
app('log')->debug(sprintf(
'%s: transaction in %s(!). Conversion rate is %s. %s %s = %s %s',
$format,
$currency->code,
$rate,
$currency->code,
$transaction['amount'],
$native->code,
$convertedAmount
));
'%s: transaction in %s(!). Conversion rate is %s. %s %s = %s %s',
$format,
$currency->code,
$rate,
$currency->code,
$transaction['amount'],
$native->code,
$convertedAmount
));
}

View File

@ -416,37 +416,37 @@ class User extends Authenticatable
->where('user_group_id', $userGroup->id)->get();
if (0 === $groupMemberships->count()) {
app('log')->error(sprintf(
'User #%d "%s" does not have roles %s in user group #%d "%s"',
$this->id,
$this->email,
implode(', ', $roles),
$userGroup->id,
$userGroup->title
));
'User #%d "%s" does not have roles %s in user group #%d "%s"',
$this->id,
$this->email,
implode(', ', $roles),
$userGroup->id,
$userGroup->title
));
return false;
}
foreach ($groupMemberships as $membership) {
app('log')->debug(sprintf(
'User #%d "%s" has role "%s" in user group #%d "%s"',
$this->id,
$this->email,
$membership->userRole->title,
$userGroup->id,
$userGroup->title
));
'User #%d "%s" has role "%s" in user group #%d "%s"',
$this->id,
$this->email,
$membership->userRole->title,
$userGroup->id,
$userGroup->title
));
if (in_array($membership->userRole->title, $dbRolesTitles, true)) {
app('log')->debug(sprintf('Return true, found role "%s"', $membership->userRole->title));
return true;
}
}
app('log')->error(sprintf(
'User #%d "%s" does not have roles %s in user group #%d "%s"',
$this->id,
$this->email,
implode(', ', $roles),
$userGroup->id,
$userGroup->title
));
'User #%d "%s" does not have roles %s in user group #%d "%s"',
$this->id,
$this->email,
implode(', ', $roles),
$userGroup->id,
$userGroup->title
));
return false;
}
@ -696,7 +696,7 @@ class User extends Authenticatable
*/
public function userGroup(): BelongsTo
{
return $this->belongsTo(UserGroup::class,);
return $this->belongsTo(UserGroup::class, );
}
/**