Fix code quality with rector [skip ci]

This commit is contained in:
James Cole
2025-11-09 09:08:03 +01:00
parent d2610be790
commit 68183a0a0e
209 changed files with 1021 additions and 1248 deletions

View File

@@ -61,7 +61,7 @@ class AppServiceProvider extends ServiceProvider
});
// blade extension
Blade::directive('activeXRoutePartial', function (string $route) {
Blade::directive('activeXRoutePartial', function (string $route): string {
$name = Route::getCurrentRoute()->getName() ?? '';
if (str_contains($name, $route)) {
return 'menu-open';
@@ -69,7 +69,7 @@ class AppServiceProvider extends ServiceProvider
return '';
});
Blade::if('partialroute', function (string $route, string $firstParam = '') {
Blade::if('partialroute', function (string $route, string $firstParam = ''): bool {
$name = Route::getCurrentRoute()->getName() ?? '';
if ('' === $firstParam && str_contains($name, $route)) {
return true;
@@ -79,11 +79,7 @@ class AppServiceProvider extends ServiceProvider
$params = Route::getCurrentRoute()->parameters();
$params ??= [];
$objectType = $params['objectType'] ?? '';
if ($objectType === $firstParam && str_contains($name, $route)) {
return true;
}
return false;
return $objectType === $firstParam && str_contains($name, $route);
});
}

View File

@@ -48,12 +48,12 @@ class AuthServiceProvider extends ServiceProvider
{
Auth::provider(
'remote_user_provider',
static fn ($app, array $config) => new RemoteUserProvider()
static fn ($app, array $config): RemoteUserProvider => new RemoteUserProvider()
);
Auth::extend(
'remote_user_guard',
static fn ($app, string $name, array $config) => new RemoteUserGuard(Auth::createUserProvider($config['provider']), $app)
static fn ($app, string $name, array $config): RemoteUserGuard => new RemoteUserGuard(Auth::createUserProvider($config['provider']), $app)
);
Passport::tokensExpireIn(now()->addDays(14));

View File

@@ -51,7 +51,7 @@ class CurrencyServiceProvider extends ServiceProvider
$this->app->bind(
static function (Application $app): GroupCurrencyRepositoryInterface {
/** @var CurrencyRepository $repository */
$repository = app(CurrencyRepository::class);
$repository = app(GroupCurrencyRepository::class);
// phpstan does not get the reference to auth
if ($app->auth->check()) { // @phpstan-ignore-line
$repository->setUser(auth()->user());

View File

@@ -93,7 +93,7 @@ class FireflyServiceProvider extends ServiceProvider
public function boot(): void
{
Validator::resolver(
static fn ($translator, $data, $rules, $messages) => new FireflyValidator($translator, $data, $rules, $messages)
static fn ($translator, $data, $rules, $messages): FireflyValidator => new FireflyValidator($translator, $data, $rules, $messages)
);
}
@@ -107,52 +107,52 @@ class FireflyServiceProvider extends ServiceProvider
{
$this->app->bind(
'preferences',
static fn () => new Preferences()
static fn (): Preferences => new Preferences()
);
$this->app->bind(
'fireflyconfig',
static fn () => new FireflyConfig()
static fn (): FireflyConfig => new FireflyConfig()
);
$this->app->bind(
'navigation',
static fn () => new Navigation()
static fn (): Navigation => new Navigation()
);
$this->app->bind(
'amount',
static fn () => new Amount()
static fn (): Amount => new Amount()
);
$this->app->bind(
'steam',
static fn () => new Steam()
static fn (): Steam => new Steam()
);
$this->app->bind(
'balance',
static fn () => new Balance()
static fn (): Balance => new Balance()
);
$this->app->bind(
'expandedform',
static fn () => new ExpandedForm()
static fn (): ExpandedForm => new ExpandedForm()
);
$this->app->bind(
'accountform',
static fn () => new AccountForm()
static fn (): AccountForm => new AccountForm()
);
$this->app->bind(
'currencyform',
static fn () => new CurrencyForm()
static fn (): CurrencyForm => new CurrencyForm()
);
$this->app->bind(
'piggybankform',
static fn () => new PiggyBankForm()
static fn (): PiggyBankForm => new PiggyBankForm()
);
$this->app->bind(
'ruleform',
static fn () => new RuleForm()
static fn (): RuleForm => new RuleForm()
);
// chart generator:

View File

@@ -53,7 +53,7 @@ class FireflySessionProvider extends ServiceProvider
{
$this->app->singleton(
'session',
static fn ($app) => new SessionManager($app)
static fn ($app): SessionManager => new SessionManager($app)
);
}