mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-15 19:09:50 +00:00
Fix code quality with rector [skip ci]
This commit is contained in:
@@ -59,7 +59,6 @@ class SubscriptionEnrichment implements EnrichmentInterface
|
||||
private ?Carbon $start = null;
|
||||
private array $subscriptionIds = [];
|
||||
private User $user;
|
||||
private UserGroup $userGroup;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -84,7 +83,7 @@ class SubscriptionEnrichment implements EnrichmentInterface
|
||||
$notes = $this->notes;
|
||||
$paidDates = $this->paidDates;
|
||||
$payDates = $this->payDates;
|
||||
$this->collection = $this->collection->map(function (Bill $item) use ($notes, $paidDates, $payDates) {
|
||||
$this->collection = $this->collection->map(function (Bill $item) use ($notes, $paidDates, $payDates): Bill {
|
||||
$id = (int)$item->id;
|
||||
$currency = $item->transactionCurrency;
|
||||
$nem = $this->getNextExpectedMatch($payDates[$id] ?? []);
|
||||
@@ -165,12 +164,10 @@ class SubscriptionEnrichment implements EnrichmentInterface
|
||||
public function setUser(User $user): void
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->userGroup = $user->userGroup;
|
||||
}
|
||||
|
||||
public function setUserGroup(UserGroup $userGroup): void
|
||||
{
|
||||
$this->userGroup = $userGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -178,7 +175,7 @@ class SubscriptionEnrichment implements EnrichmentInterface
|
||||
*/
|
||||
protected function lastPaidDate(Bill $subscription, Collection $dates, Carbon $default): Carbon
|
||||
{
|
||||
$filtered = $dates->filter(fn (TransactionJournal $journal) => (int)$journal->bill_id === (int)$subscription->id);
|
||||
$filtered = $dates->filter(fn (TransactionJournal $journal): bool => (int)$journal->bill_id === (int)$subscription->id);
|
||||
Log::debug(sprintf('Filtered down from %d to %d entries for bill #%d.', $dates->count(), $filtered->count(), $subscription->id));
|
||||
if (0 === $filtered->count()) {
|
||||
return $default;
|
||||
@@ -299,7 +296,7 @@ class SubscriptionEnrichment implements EnrichmentInterface
|
||||
|
||||
// At this point the "next match" is exactly after the last time the bill was paid.
|
||||
$result = [];
|
||||
$filtered = $set->filter(fn (TransactionJournal $journal) => (int)$journal->bill_id === (int)$subscription->id);
|
||||
$filtered = $set->filter(fn (TransactionJournal $journal): bool => (int)$journal->bill_id === (int)$subscription->id);
|
||||
foreach ($filtered as $entry) {
|
||||
$array = [
|
||||
'transaction_group_id' => (string)$entry->transaction_group_id,
|
||||
@@ -390,7 +387,7 @@ class SubscriptionEnrichment implements EnrichmentInterface
|
||||
|
||||
private function filterPaidDates(array $entries): array
|
||||
{
|
||||
return array_map(function (array $entry) {
|
||||
return array_map(function (array $entry): array {
|
||||
unset($entry['date_object']);
|
||||
|
||||
return $entry;
|
||||
|
||||
Reference in New Issue
Block a user