Fix code quality with rector [skip ci]

This commit is contained in:
James Cole
2025-11-09 09:07:14 +01:00
parent 38691d6fdf
commit d2610be790
262 changed files with 873 additions and 1186 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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)));

View File

@@ -211,7 +211,6 @@ class UpgradesVariousCurrencyInformation extends Command
break;
}
/** @var null|Transaction */
return $lead;
}

View File

@@ -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;