mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-11 17:39:41 +00:00
Fix code quality with rector [skip ci]
This commit is contained in:
@@ -136,11 +136,7 @@ class UpgradesLiabilitiesEight extends Command
|
||||
if (null === $liabilityJournal) {
|
||||
return false;
|
||||
}
|
||||
if (!$openingJournal->date->isSameDay($liabilityJournal->date)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return (bool) $openingJournal->date->isSameDay($liabilityJournal->date);
|
||||
}
|
||||
|
||||
private function deleteCreditTransaction(Account $account): void
|
||||
|
||||
@@ -77,7 +77,7 @@ class UpgradesTagLocations extends Command
|
||||
|
||||
private function hasLocationDetails(Tag $tag): bool
|
||||
{
|
||||
return null !== $tag->latitude && null !== $tag->longitude && null !== $tag->zoomLevel;
|
||||
return !in_array(null, [$tag->latitude, $tag->longitude, $tag->zoomLevel], true);
|
||||
}
|
||||
|
||||
private function migrateLocationDetails(Tag $tag): void
|
||||
|
||||
@@ -180,7 +180,7 @@ class UpgradesToGroups extends Command
|
||||
private function getDestinationTransactions(TransactionJournal $journal): Collection
|
||||
{
|
||||
return $journal->transactions->filter(
|
||||
static fn (Transaction $transaction) => $transaction->amount > 0
|
||||
static fn (Transaction $transaction): bool => $transaction->amount > 0
|
||||
);
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ class UpgradesToGroups extends Command
|
||||
private function findOpposingTransaction(TransactionJournal $journal, Transaction $transaction): ?Transaction
|
||||
{
|
||||
$set = $journal->transactions->filter(
|
||||
static function (Transaction $subject) use ($transaction) {
|
||||
static function (Transaction $subject) use ($transaction): bool {
|
||||
$amount = (float) $transaction->amount * -1 === (float) $subject->amount; // intentional float
|
||||
$identifier = $transaction->identifier === $subject->identifier;
|
||||
Log::debug(sprintf('Amount the same? %s', var_export($amount, true)));
|
||||
|
||||
@@ -211,7 +211,6 @@ class UpgradesVariousCurrencyInformation extends Command
|
||||
break;
|
||||
}
|
||||
|
||||
/** @var null|Transaction */
|
||||
return $lead;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ class UpgradesWebhooks extends Command
|
||||
$delivery = WebhookDelivery::tryFrom((int)$webhook->delivery);
|
||||
$response = WebhookResponse::tryFrom((int)$webhook->response);
|
||||
$trigger = WebhookTrigger::tryFrom((int)$webhook->trigger);
|
||||
if (null === $delivery || null === $response || null === $trigger) {
|
||||
if (in_array(null, [$delivery, $response, $trigger], true)) {
|
||||
$this->friendlyError(sprintf('[a] Webhook #%d has an invalid delivery, response or trigger value. Will not upgrade.', $webhook->id));
|
||||
|
||||
return;
|
||||
@@ -92,7 +92,7 @@ class UpgradesWebhooks extends Command
|
||||
$deliveryModel = WebhookDeliveryModel::where('key', $delivery->value)->first();
|
||||
$responseModel = WebhookResponseModel::where('key', $response->value)->first();
|
||||
$triggerModel = WebhookTriggerModel::where('key', $trigger->value)->first();
|
||||
if (null === $deliveryModel || null === $responseModel || null === $triggerModel) {
|
||||
if (in_array(null, [$deliveryModel, $responseModel, $triggerModel], true)) {
|
||||
$this->friendlyError(sprintf('[b] Webhook #%d has an invalid delivery, response or trigger model. Will not upgrade.', $webhook->id));
|
||||
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user