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

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Middleware;
use Illuminate\Support\Facades\Log;
use Closure;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Exceptions\Handler;
@@ -126,22 +127,20 @@ class Authenticate
private function validateBlockedUser(?User $user, array $guards): void
{
if (!$user instanceof User) {
app('log')->warning('User is null, throw exception?');
Log::warning('User is null, throw exception?');
}
if ($user instanceof User) {
// app('log')->debug(get_class($user));
if (1 === (int) $user->blocked) {
$message = (string) trans('firefly.block_account_logout');
if ('email_changed' === $user->blocked_code) {
$message = (string) trans('firefly.email_changed_logout');
}
app('log')->warning('User is blocked, cannot use authentication method.');
app('session')->flash('logoutMessage', $message);
// @noinspection PhpUndefinedMethodInspection
$this->auth->logout(); // @phpstan-ignore-line (thinks function is undefined)
throw new AuthenticationException('Blocked account.', $guards);
// \Illuminate\Support\Facades\Log::debug(get_class($user));
if ($user instanceof User && 1 === (int) $user->blocked) {
$message = (string) trans('firefly.block_account_logout');
if ('email_changed' === $user->blocked_code) {
$message = (string) trans('firefly.email_changed_logout');
}
Log::warning('User is blocked, cannot use authentication method.');
app('session')->flash('logoutMessage', $message);
// @noinspection PhpUndefinedMethodInspection
$this->auth->logout();
// @phpstan-ignore-line (thinks function is undefined)
throw new AuthenticationException('Blocked account.', $guards);
}
}
}

View File

@@ -34,27 +34,20 @@ use Illuminate\Routing\Route;
*/
class Binder
{
/**
* The authentication factory instance.
*
* @var Auth
*/
protected $auth;
/**
* The binders.
*
* @var array
*/
protected $binders = [];
protected array $binders;
/**
* Binder constructor.
*/
public function __construct(Auth $auth)
public function __construct(/**
* The authentication factory instance.
*/
protected Auth $auth)
{
$this->binders = Domain::getBindables();
$this->auth = $auth;
}
/**

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Middleware;
use Illuminate\Support\Facades\Log;
use Closure;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\User;
@@ -49,7 +50,7 @@ class IsDemoUser
/** @var UserRepositoryInterface $repository */
$repository = app(UserRepositoryInterface::class);
if ($repository->hasRole($user, 'demo')) {
app('log')->info('User is a demo user.');
Log::info('User is a demo user.');
$request->session()->flash('info', (string) trans('firefly.not_available_demo_user'));
$current = $request->url();
$previous = $request->session()->previousUrl();

View File

@@ -114,7 +114,7 @@ class Range
// send error to view, if it could not set money format
if (false === $moneyResult) {
app('log')->error('Could not set locale. The following array doesnt work: ', $localeArray);
Log::error('Could not set locale. The following array doesnt work: ', $localeArray);
app('view')->share('invalidMonetaryLocale', true);
}