Use PSR-12 code style

This commit is contained in:
James Cole
2022-10-30 12:24:51 +01:00
parent bdcd9825ec
commit b27fe59ab4
44 changed files with 414 additions and 332 deletions

View File

@@ -37,6 +37,8 @@ use FireflyIII\Services\Internal\Destroy\JournalDestroyService;
use Illuminate\Console\Command;
use Illuminate\Support\Collection;
use Log;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/**
* This command will take split transactions and migrate them to "transaction groups".
@@ -129,14 +131,14 @@ class MigrateToGroups extends Command
/**
* @return bool
* @throws FireflyException
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
private function isMigrated(): bool
{
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
if (null !== $configVar) {
return (bool) $configVar->data;
return (bool)$configVar->data;
}
return false;
@@ -161,7 +163,7 @@ class MigrateToGroups extends Command
}
/**
* @param TransactionJournal $journal
* @param TransactionJournal $journal
*
* @throws Exception
*/
@@ -303,7 +305,7 @@ class MigrateToGroups extends Command
}
/**
* @param TransactionJournal $journal
* @param TransactionJournal $journal
*
* @return Collection
*/
@@ -317,8 +319,8 @@ class MigrateToGroups extends Command
}
/**
* @param TransactionJournal $journal
* @param Transaction $transaction
* @param TransactionJournal $journal
* @param Transaction $transaction
*
* @return Transaction|null
*/
@@ -326,7 +328,7 @@ class MigrateToGroups extends Command
{
$set = $journal->transactions->filter(
static function (Transaction $subject) use ($transaction) {
$amount = (float) $transaction->amount * -1 === (float) $subject->amount;
$amount = (float)$transaction->amount * -1 === (float)$subject->amount;
$identifier = $transaction->identifier === $subject->identifier;
Log::debug(sprintf('Amount the same? %s', var_export($amount, true)));
Log::debug(sprintf('ID the same? %s', var_export($identifier, true)));
@@ -339,8 +341,8 @@ class MigrateToGroups extends Command
}
/**
* @param Transaction $left
* @param Transaction $right
* @param Transaction $left
* @param Transaction $right
*
* @return int|null
*/
@@ -354,7 +356,7 @@ class MigrateToGroups extends Command
if (null !== $budget) {
Log::debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $left->id));
return (int) $budget->id;
return (int)$budget->id;
}
// try to get a budget ID from the right transaction:
@@ -363,7 +365,7 @@ class MigrateToGroups extends Command
if (null !== $budget) {
Log::debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $right->id));
return (int) $budget->id;
return (int)$budget->id;
}
Log::debug('Neither left or right have a budget, return NULL');
@@ -372,8 +374,8 @@ class MigrateToGroups extends Command
}
/**
* @param Transaction $left
* @param Transaction $right
* @param Transaction $left
* @param Transaction $right
*
* @return int|null
*/
@@ -387,7 +389,7 @@ class MigrateToGroups extends Command
if (null !== $category) {
Log::debug(sprintf('Return category #%d, from transaction #%d', $category->id, $left->id));
return (int) $category->id;
return (int)$category->id;
}
// try to get a category ID from the left transaction:
@@ -396,7 +398,7 @@ class MigrateToGroups extends Command
if (null !== $category) {
Log::debug(sprintf('Return category #%d, from transaction #%d', $category->id, $category->id));
return (int) $category->id;
return (int)$category->id;
}
Log::debug('Neither left or right have a category, return NULL');
@@ -425,7 +427,7 @@ class MigrateToGroups extends Command
}
/**
* @param array $array
* @param array $array
*/
private function giveGroup(array $array): void
{