Update more code.

This commit is contained in:
James Cole
2025-05-04 13:04:33 +02:00
parent abd9260193
commit e42107c03c
55 changed files with 106 additions and 278 deletions

View File

@@ -30,13 +30,8 @@ namespace FireflyIII\Support\Search\QueryParser;
*/
class FieldNode extends Node
{
private string $operator;
private string $value;
public function __construct(string $operator, string $value, bool $prohibited = false)
public function __construct(private readonly string $operator, private readonly string $value, bool $prohibited = false)
{
$this->operator = $operator;
$this->value = $value;
$this->prohibited = $prohibited;
}

View File

@@ -33,7 +33,7 @@ use Illuminate\Support\Facades\Log;
class GdbotsQueryParser implements QueryParserInterface
{
private BaseQueryParser $parser;
private readonly BaseQueryParser $parser;
public function __construct()
{
@@ -98,7 +98,7 @@ class GdbotsQueryParser implements QueryParserInterface
default:
throw new FireflyException(
sprintf('Unsupported node type: %s', get_class($node))
sprintf('Unsupported node type: %s', $node::class)
);
}
}

View File

@@ -32,15 +32,11 @@ namespace FireflyIII\Support\Search\QueryParser;
*/
class NodeGroup extends Node
{
/** @var Node[] */
private array $nodes;
/**
* @param Node[] $nodes
*/
public function __construct(array $nodes, bool $prohibited = false)
public function __construct(private readonly array $nodes, bool $prohibited = false)
{
$this->nodes = $nodes;
$this->prohibited = $prohibited;
}

View File

@@ -30,11 +30,8 @@ namespace FireflyIII\Support\Search\QueryParser;
*/
class StringNode extends Node
{
private string $value;
public function __construct(string $value, bool $prohibited = false)
public function __construct(private readonly string $value, bool $prohibited = false)
{
$this->value = $value;
$this->prohibited = $prohibited;
}

View File

@@ -36,7 +36,7 @@ trait GeneratesInstallationId
{
try {
$config = app('fireflyconfig')->get('installation_id');
} catch (FireflyException $e) {
} catch (FireflyException) {
app('log')->info('Could not create or generate installation ID. Do not continue.');
return;

View File

@@ -37,6 +37,7 @@ use Twig\TwigFunction;
*/
class AmountFormat extends AbstractExtension
{
#[\Override]
public function getFilters(): array
{
return [
@@ -71,6 +72,7 @@ class AmountFormat extends AbstractExtension
);
}
#[\Override]
public function getFunctions(): array
{
return [

View File

@@ -43,6 +43,7 @@ use Twig\TwigFunction;
*/
class General extends AbstractExtension
{
#[\Override]
public function getFilters(): array
{
return [
@@ -74,7 +75,7 @@ class General extends AbstractExtension
$default = Amount::getNativeCurrency();
$convertToNative = Amount::convertToNative();
$useNative = $convertToNative && $default->id !== $currency->id;
$currency = null === $currency ? $default : $currency;
$currency ??= $default;
$strings = [];
foreach ($info as $key => $balance) {
if ('balance' === $key) {
@@ -137,77 +138,15 @@ class General extends AbstractExtension
{
return new TwigFilter(
'mimeIcon',
static function (string $string): string {
switch ($string) {
default:
return 'fa-file-o';
case 'application/pdf':
return 'fa-file-pdf-o';
// image
case 'image/png':
case 'image/jpeg':
case 'image/svg+xml':
case 'image/heic':
case 'image/heic-sequence':
case 'application/vnd.oasis.opendocument.image':
return 'fa-file-image-o';
// MS word
case 'application/msword':
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.template':
case 'application/x-iwork-pages-sffpages':
case 'application/vnd.sun.xml.writer':
case 'application/vnd.sun.xml.writer.template':
case 'application/vnd.sun.xml.writer.global':
case 'application/vnd.stardivision.writer':
case 'application/vnd.stardivision.writer-global':
case 'application/vnd.oasis.opendocument.text':
case 'application/vnd.oasis.opendocument.text-template':
case 'application/vnd.oasis.opendocument.text-web':
case 'application/vnd.oasis.opendocument.text-master':
return 'fa-file-word-o';
// MS excel
case 'application/vnd.ms-excel':
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.template':
case 'application/vnd.sun.xml.calc':
case 'application/vnd.sun.xml.calc.template':
case 'application/vnd.stardivision.calc':
case 'application/vnd.oasis.opendocument.spreadsheet':
case 'application/vnd.oasis.opendocument.spreadsheet-template':
return 'fa-file-excel-o';
// MS powerpoint
case 'application/vnd.ms-powerpoint':
case 'application/vnd.openxmlformats-officedocument.presentationml.presentation':
case 'application/vnd.openxmlformats-officedocument.presentationml.template':
case 'application/vnd.openxmlformats-officedocument.presentationml.slideshow':
case 'application/vnd.sun.xml.impress':
case 'application/vnd.sun.xml.impress.template':
case 'application/vnd.stardivision.impress':
case 'application/vnd.oasis.opendocument.presentation':
case 'application/vnd.oasis.opendocument.presentation-template':
return 'fa-file-powerpoint-o';
// calc
case 'application/vnd.sun.xml.draw':
case 'application/vnd.sun.xml.draw.template':
case 'application/vnd.stardivision.draw':
case 'application/vnd.oasis.opendocument.chart':
return 'fa-paint-brush';
case 'application/vnd.oasis.opendocument.graphics':
case 'application/vnd.oasis.opendocument.graphics-template':
case 'application/vnd.sun.xml.math':
case 'application/vnd.stardivision.math':
case 'application/vnd.oasis.opendocument.formula':
case 'application/vnd.oasis.opendocument.database':
return 'fa-calculator';
}
static fn(string $string): string => match ($string) {
'application/pdf' => 'fa-file-pdf-o',
'image/png', 'image/jpeg', 'image/svg+xml', 'image/heic', 'image/heic-sequence', 'application/vnd.oasis.opendocument.image' => 'fa-file-image-o',
'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', 'application/x-iwork-pages-sffpages', 'application/vnd.sun.xml.writer', 'application/vnd.sun.xml.writer.template', 'application/vnd.sun.xml.writer.global', 'application/vnd.stardivision.writer', 'application/vnd.stardivision.writer-global', 'application/vnd.oasis.opendocument.text', 'application/vnd.oasis.opendocument.text-template', 'application/vnd.oasis.opendocument.text-web', 'application/vnd.oasis.opendocument.text-master' => 'fa-file-word-o',
'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', 'application/vnd.sun.xml.calc', 'application/vnd.sun.xml.calc.template', 'application/vnd.stardivision.calc', 'application/vnd.oasis.opendocument.spreadsheet', 'application/vnd.oasis.opendocument.spreadsheet-template' => 'fa-file-excel-o',
'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/vnd.openxmlformats-officedocument.presentationml.template', 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'application/vnd.sun.xml.impress', 'application/vnd.sun.xml.impress.template', 'application/vnd.stardivision.impress', 'application/vnd.oasis.opendocument.presentation', 'application/vnd.oasis.opendocument.presentation-template' => 'fa-file-powerpoint-o',
'application/vnd.sun.xml.draw', 'application/vnd.sun.xml.draw.template', 'application/vnd.stardivision.draw', 'application/vnd.oasis.opendocument.chart' => 'fa-paint-brush',
'application/vnd.oasis.opendocument.graphics', 'application/vnd.oasis.opendocument.graphics-template', 'application/vnd.sun.xml.math', 'application/vnd.stardivision.math', 'application/vnd.oasis.opendocument.formula', 'application/vnd.oasis.opendocument.database' => 'fa-calculator',
default => 'fa-file-o',
},
['is_safe' => ['html']]
);
@@ -248,6 +187,7 @@ class General extends AbstractExtension
);
}
#[\Override]
public function getFunctions(): array
{
return [
@@ -271,9 +211,7 @@ class General extends AbstractExtension
{
return new TwigFunction(
'phpdate',
static function (string $str): string {
return \Safe\date($str);
}
static fn(string $str): string => \Safe\date($str)
);
}
@@ -333,8 +271,8 @@ class General extends AbstractExtension
if ($objectType === $activeObjectType
&& false !== stripos(
\Route::getCurrentRoute()->getName(),
$route
(string) \Route::getCurrentRoute()->getName(),
(string) $route
)) {
return 'active';
}
@@ -435,9 +373,7 @@ class General extends AbstractExtension
{
return new TwigFunction(
'carbonize',
static function (string $date): Carbon {
return new Carbon($date, config('app.timezone'));
}
static fn(string $date): Carbon => new Carbon($date, config('app.timezone'))
);
}
}

View File

@@ -31,6 +31,7 @@ use Twig\TwigFunction;
*/
class Rule extends AbstractExtension
{
#[\Override]
public function getFunctions(): array
{
return [
@@ -44,13 +45,11 @@ class Rule extends AbstractExtension
{
return new TwigFunction(
'allJournalTriggers',
static function () {
return [
static fn() => [
'store-journal' => (string) trans('firefly.rule_trigger_store_journal'),
'update-journal' => (string) trans('firefly.rule_trigger_update_journal'),
'manual-activation' => (string) trans('firefly.rule_trigger_manual'),
];
}
]
);
}

View File

@@ -39,6 +39,7 @@ use Twig\TwigFunction;
*/
class TransactionGroupTwig extends AbstractExtension
{
#[\Override]
public function getFunctions(): array
{
return [

View File

@@ -32,19 +32,19 @@ use Twig\TwigFunction;
*/
class Translation extends AbstractExtension
{
#[\Override]
public function getFilters(): array
{
return [
new TwigFilter(
'_',
static function ($name) {
return (string) trans(sprintf('firefly.%s', $name));
},
static fn($name) => (string) trans(sprintf('firefly.%s', $name)),
['is_safe' => ['html']]
),
];
}
#[\Override]
public function getFunctions(): array
{
return [

View File

@@ -36,14 +36,11 @@ use Illuminate\Support\Facades\DB;
*/
class AddTag implements ActionInterface
{
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private readonly RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -37,14 +37,11 @@ class AppendDescription implements ActionInterface
{
use RefreshNotesTrait;
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -39,14 +39,11 @@ class AppendDescriptionToNotes implements ActionInterface
{
use RefreshNotesTrait;
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -37,14 +37,11 @@ class AppendNotes implements ActionInterface
{
use RefreshNotesTrait;
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -41,14 +41,11 @@ class AppendNotesToDescription implements ActionInterface
use ConvertsDataTypes;
use RefreshNotesTrait;
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -34,14 +34,11 @@ use Illuminate\Support\Facades\DB;
*/
class ClearBudget implements ActionInterface
{
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private readonly RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -34,14 +34,11 @@ use Illuminate\Support\Facades\DB;
*/
class ClearCategory implements ActionInterface
{
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private readonly RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -35,14 +35,11 @@ use Illuminate\Support\Facades\DB;
*/
class ClearNotes implements ActionInterface
{
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private readonly RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -43,14 +43,11 @@ use Illuminate\Support\Facades\DB;
*/
class ConvertToDeposit implements ActionInterface
{
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private readonly RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -42,14 +42,11 @@ use Illuminate\Support\Facades\DB;
*/
class ConvertToTransfer implements ActionInterface
{
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private readonly RuleAction $action)
{
$this->action = $action;
}
/**

View File

@@ -43,14 +43,11 @@ use Illuminate\Support\Facades\DB;
*/
class ConvertToWithdrawal implements ActionInterface
{
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private readonly RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -35,14 +35,11 @@ use FireflyIII\Services\Internal\Destroy\TransactionGroupDestroyService;
*/
class DeleteTransaction implements ActionInterface
{
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private readonly RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -37,14 +37,11 @@ use Illuminate\Support\Facades\DB;
*/
class LinkToBill implements ActionInterface
{
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private readonly RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -36,14 +36,11 @@ use FireflyIII\Models\TransactionJournal;
*/
class MoveDescriptionToNotes implements ActionInterface
{
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private readonly RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -42,14 +42,11 @@ class MoveNotesToDescription implements ActionInterface
{
use ConvertsDataTypes;
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -34,14 +34,11 @@ use Illuminate\Support\Facades\DB;
*/
class PrependDescription implements ActionInterface
{
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private readonly RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -34,14 +34,11 @@ use FireflyIII\Models\TransactionJournal;
*/
class PrependNotes implements ActionInterface
{
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private readonly RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -34,14 +34,11 @@ use Illuminate\Support\Facades\DB;
*/
class RemoveAllTags implements ActionInterface
{
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private readonly RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -35,14 +35,11 @@ use Illuminate\Support\Facades\DB;
*/
class RemoveTag implements ActionInterface
{
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private readonly RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -35,14 +35,11 @@ class SetAmount implements ActionInterface
{
use RefreshNotesTrait;
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -36,14 +36,11 @@ use Illuminate\Support\Facades\DB;
*/
class SetBudget implements ActionInterface
{
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private readonly RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -36,14 +36,11 @@ use Illuminate\Support\Facades\DB;
*/
class SetCategory implements ActionInterface
{
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private readonly RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -36,14 +36,11 @@ class SetDescription implements ActionInterface
{
use RefreshNotesTrait;
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -39,15 +39,13 @@ use Illuminate\Support\Facades\DB;
*/
class SetDestinationAccount implements ActionInterface
{
private RuleAction $action;
private AccountRepositoryInterface $repository;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private readonly RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -39,14 +39,11 @@ use Illuminate\Support\Facades\DB;
*/
class SetDestinationToCashAccount implements ActionInterface
{
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private readonly RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -33,14 +33,11 @@ use FireflyIII\Models\TransactionJournal;
*/
class SetNotes implements ActionInterface
{
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private readonly RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -39,15 +39,13 @@ use Illuminate\Support\Facades\DB;
*/
class SetSourceAccount implements ActionInterface
{
private RuleAction $action;
private AccountRepositoryInterface $repository;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private readonly RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -39,14 +39,11 @@ use Illuminate\Support\Facades\DB;
*/
class SetSourceToCashAccount implements ActionInterface
{
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private readonly RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -36,14 +36,11 @@ use FireflyIII\Models\TransactionJournal;
*/
class SwitchAccounts implements ActionInterface
{
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private readonly RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -37,14 +37,11 @@ use Illuminate\Support\Facades\Log;
class UpdatePiggyBank implements ActionInterface
{
private RuleAction $action;
/**
* TriggerInterface constructor.
*/
public function __construct(RuleAction $action)
public function __construct(private readonly RuleAction $action)
{
$this->action = $action;
}
public function actOnArray(array $journal): bool

View File

@@ -44,11 +44,11 @@ use Illuminate\Support\Facades\Log;
*/
class SearchRuleEngine implements RuleEngineInterface
{
private Collection $groups;
private readonly Collection $groups;
private array $operators;
private bool $refreshTriggers;
private array $resultCount;
private Collection $rules;
private readonly Collection $rules;
private User $user;
public function __construct()

View File

@@ -82,17 +82,15 @@ class ActionExpression
// 'destination_transaction_id',
'notes',
];
private string $expr;
private ExpressionLanguage $expressionLanguage;
private bool $isExpression;
private ?SyntaxError $validationError;
private readonly ExpressionLanguage $expressionLanguage;
private readonly bool $isExpression;
private readonly ?SyntaxError $validationError;
public function __construct(string $expr)
public function __construct(private readonly string $expr)
{
$this->expressionLanguage = app(ExpressionLanguage::class);
$this->expr = $expr;
$this->isExpression = self::isExpression($expr);
$this->isExpression = self::isExpression($this->expr);
$this->validationError = $this->validate();
}

View File

@@ -45,16 +45,12 @@ class ActionExpressionLanguageProvider implements ExpressionFunctionProviderInte
return [
new ExpressionFunction(
'constant2',
static function ($str): string {
return sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str.'!');
},
static fn($str): string => sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str.'!'),
$function
),
new ExpressionFunction(
'constant',
static function ($str): string {
return sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str.'!');
},
static fn($str): string => sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str.'!'),
$function
),

View File

@@ -32,7 +32,7 @@ use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
*/
class AttachmentTransformer extends AbstractTransformer
{
private AttachmentRepositoryInterface $repository;
private readonly AttachmentRepositoryInterface $repository;
/**
* BillTransformer constructor.

View File

@@ -36,11 +36,11 @@ use FireflyIII\Support\Facades\Amount;
*/
class AvailableBudgetTransformer extends AbstractTransformer
{
private NoBudgetRepositoryInterface $noBudgetRepository;
private OperationsRepositoryInterface $opsRepository;
private BudgetRepositoryInterface $repository;
private TransactionCurrency $default;
private bool $convertToNative;
private readonly NoBudgetRepositoryInterface $noBudgetRepository;
private readonly OperationsRepositoryInterface $opsRepository;
private readonly BudgetRepositoryInterface $repository;
private readonly TransactionCurrency $default;
private readonly bool $convertToNative;
/**
* CurrencyTransformer constructor.

View File

@@ -40,10 +40,10 @@ use Illuminate\Support\Collection;
*/
class BillTransformer extends AbstractTransformer
{
private BillDateCalculator $calculator;
private BillRepositoryInterface $repository;
private TransactionCurrency $default;
private bool $convertToNative;
private readonly BillDateCalculator $calculator;
private readonly BillRepositoryInterface $repository;
private readonly TransactionCurrency $default;
private readonly bool $convertToNative;
/**
* BillTransformer constructor.

View File

@@ -38,10 +38,10 @@ use Symfony\Component\HttpFoundation\ParameterBag;
*/
class BudgetTransformer extends AbstractTransformer
{
private OperationsRepositoryInterface $opsRepository;
private BudgetRepositoryInterface $repository;
private bool $convertToNative;
private TransactionCurrency $default;
private readonly OperationsRepositoryInterface $opsRepository;
private readonly BudgetRepositoryInterface $repository;
private readonly bool $convertToNative;
private readonly TransactionCurrency $default;
/**
* BudgetTransformer constructor.

View File

@@ -36,10 +36,10 @@ use Illuminate\Support\Collection;
*/
class CategoryTransformer extends AbstractTransformer
{
private OperationsRepositoryInterface $opsRepository;
private CategoryRepositoryInterface $repository;
private TransactionCurrency $default;
private bool $convertToNative;
private readonly OperationsRepositoryInterface $opsRepository;
private readonly CategoryRepositoryInterface $repository;
private readonly TransactionCurrency $default;
private readonly bool $convertToNative;
/**
* CategoryTransformer constructor.

View File

@@ -34,8 +34,8 @@ use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
*/
class PiggyBankEventTransformer extends AbstractTransformer
{
private PiggyBankRepositoryInterface $piggyRepos;
private AccountRepositoryInterface $repository;
private readonly PiggyBankRepositoryInterface $piggyRepos;
private readonly AccountRepositoryInterface $repository;
/**
* PiggyBankEventTransformer constructor.

View File

@@ -35,8 +35,8 @@ use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
*/
class PiggyBankTransformer extends AbstractTransformer
{
private AccountRepositoryInterface $accountRepos;
private PiggyBankRepositoryInterface $piggyRepos;
private readonly AccountRepositoryInterface $accountRepos;
private readonly PiggyBankRepositoryInterface $piggyRepos;
/**
* PiggyBankTransformer constructor.

View File

@@ -42,11 +42,11 @@ use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
*/
class RecurrenceTransformer extends AbstractTransformer
{
private BillRepositoryInterface $billRepos;
private BudgetRepositoryInterface $budgetRepos;
private CategoryFactory $factory;
private PiggyBankRepositoryInterface $piggyRepos;
private RecurringRepositoryInterface $repository;
private readonly BillRepositoryInterface $billRepos;
private readonly BudgetRepositoryInterface $budgetRepos;
private readonly CategoryFactory $factory;
private readonly PiggyBankRepositoryInterface $piggyRepos;
private readonly RecurringRepositoryInterface $repository;
/**
* RecurrenceTransformer constructor.

View File

@@ -35,7 +35,7 @@ use FireflyIII\Repositories\Rule\RuleRepositoryInterface;
*/
class RuleTransformer extends AbstractTransformer
{
private RuleRepositoryInterface $ruleRepository;
private readonly RuleRepositoryInterface $ruleRepository;
/**
* CurrencyTransformer constructor.

View File

@@ -44,9 +44,9 @@ use Illuminate\Support\Facades\Log;
*/
class TransactionGroupTransformer extends AbstractTransformer
{
private TransactionGroupRepositoryInterface $groupRepos;
private array $metaDateFields;
private array $metaFields;
private readonly TransactionGroupRepositoryInterface $groupRepos;
private readonly array $metaDateFields;
private readonly array $metaFields;
/**
* Constructor.

View File

@@ -325,9 +325,7 @@ class BillTransformer extends AbstractTransformer
}
}
$simple = $set->map( // @phpstan-ignore-line
static function (Carbon $date) {
return $date->toAtomString();
}
static fn(Carbon $date) => $date->toAtomString()
);
return $simple->toArray();

View File

@@ -35,7 +35,5 @@ declare(strict_types=1);
Broadcast::channel(
'App.User.{id}',
static function ($user, $id) {
return (int)$user->id === (int)$id;
}
static fn($user, $id) => (int)$user->id === (int)$id
);