mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Various code fixes
This commit is contained in:
parent
5878b2c427
commit
7722ca2bf0
app
Exceptions
Generator/Report
Helpers
Http
Controllers
Middleware
Models
Providers
AdminServiceProvider.phpAttachmentServiceProvider.phpBillServiceProvider.phpBudgetServiceProvider.phpCategoryServiceProvider.phpCurrencyServiceProvider.phpFireflyServiceProvider.phpJournalServiceProvider.phpPiggyBankServiceProvider.phpRecurringServiceProvider.phpRuleGroupServiceProvider.phpRuleServiceProvider.phpSearchServiceProvider.phpTagServiceProvider.php
Repositories
AuditLogEntry
PiggyBank
TransactionGroup
Support
TransactionRules/Actions
@ -53,7 +53,7 @@ use Throwable;
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
* @var array<int, class-string<Throwable>>
|
||||
*/
|
||||
protected $dontReport
|
||||
= [
|
||||
|
@ -26,7 +26,6 @@ namespace FireflyIII\Generator\Report\Budget;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Generator\Report\ReportGeneratorInterface;
|
||||
use FireflyIII\Generator\Report\Support;
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use Illuminate\Support\Collection;
|
||||
|
@ -26,7 +26,6 @@ namespace FireflyIII\Generator\Report\Category;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Generator\Report\ReportGeneratorInterface;
|
||||
use FireflyIII\Generator\Report\Support;
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use Illuminate\Support\Collection;
|
||||
@ -41,26 +40,20 @@ use Throwable;
|
||||
*/
|
||||
class MonthReportGenerator implements ReportGeneratorInterface
|
||||
{
|
||||
/** @var Collection The included accounts */
|
||||
private $accounts;
|
||||
/** @var Collection The included categories */
|
||||
private $categories;
|
||||
/** @var Carbon The end date */
|
||||
private $end;
|
||||
/** @var array The expenses */
|
||||
private $expenses;
|
||||
/** @var array The income in the report. */
|
||||
private $income;
|
||||
/** @var Carbon The start date. */
|
||||
private $start;
|
||||
private Collection $accounts;
|
||||
private Collection $categories;
|
||||
private Carbon $end;
|
||||
private array $expenses;
|
||||
private array $income;
|
||||
private Carbon $start;
|
||||
|
||||
/**
|
||||
* MonthReportGenerator constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->income = new Collection();
|
||||
$this->expenses = new Collection();
|
||||
$this->income = [];
|
||||
$this->expenses = [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -26,7 +26,6 @@ namespace FireflyIII\Generator\Report\Tag;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Generator\Report\ReportGeneratorInterface;
|
||||
use FireflyIII\Generator\Report\Support;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Throwable;
|
||||
@ -38,27 +37,22 @@ use Throwable;
|
||||
*/
|
||||
class MonthReportGenerator implements ReportGeneratorInterface
|
||||
{
|
||||
/** @var Collection The accounts involved */
|
||||
private $accounts;
|
||||
/** @var Carbon The end date */
|
||||
private $end;
|
||||
/** @var array The expenses involved */
|
||||
private $expenses;
|
||||
/** @var array The income involved */
|
||||
private $income;
|
||||
/** @var Carbon The start date */
|
||||
private $start;
|
||||
/** @var Collection The tags involved. */
|
||||
private $tags;
|
||||
private Collection $accounts;
|
||||
private Carbon $end;
|
||||
private array $expenses;
|
||||
private array $income;
|
||||
private Carbon $start;
|
||||
private Collection $tags;
|
||||
|
||||
/**
|
||||
* MonthReportGenerator constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->expenses = new Collection();
|
||||
$this->income = new Collection();
|
||||
$this->expenses = [];
|
||||
$this->income = [];
|
||||
$this->tags = new Collection();
|
||||
$this->accounts = new Collection();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1157,6 +1157,12 @@ interface GroupCollectorInterface
|
||||
*/
|
||||
public function setSearchWords(array $array): GroupCollectorInterface;
|
||||
|
||||
/**
|
||||
* @param string $sepaCT
|
||||
* @return GroupCollectorInterface
|
||||
*/
|
||||
public function setSepaCT(string $sepaCT): GroupCollectorInterface;
|
||||
|
||||
/**
|
||||
* Set source accounts.
|
||||
*
|
||||
|
@ -42,7 +42,7 @@ class FiscalHelper implements FiscalHelperInterface
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->useCustomFiscalYear = app('preferences')->get('customFiscalYear', false)->data;
|
||||
$this->useCustomFiscalYear = (bool) app('preferences')->get('customFiscalYear', false)->data;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -165,7 +165,7 @@ class LoginController extends Controller
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Response
|
||||
* @return RedirectResponse|Redirector|Response
|
||||
*/
|
||||
public function logout(Request $request)
|
||||
{
|
||||
|
@ -121,12 +121,13 @@ class BudgetLimitController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO why redirect AND json response?
|
||||
* @param Request $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @return RedirectResponse|JsonResponse
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function store(Request $request)
|
||||
public function store(Request $request): RedirectResponse|JsonResponse
|
||||
{
|
||||
Log::debug('Going to store new budget-limit.', $request->all());
|
||||
// first search for existing one and update it if necessary.
|
||||
|
@ -236,84 +236,6 @@ class DebugController extends Controller
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all possible routes.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function routes(): string
|
||||
{
|
||||
$set = RouteFacade::getRoutes();
|
||||
$ignore = [
|
||||
'chart.',
|
||||
'javascript.',
|
||||
'json.',
|
||||
'report-data.',
|
||||
'popup.',
|
||||
'debugbar.',
|
||||
'attachments.download',
|
||||
'attachments.preview',
|
||||
'bills.rescan',
|
||||
'budgets.income',
|
||||
'currencies.def',
|
||||
'error',
|
||||
'flush',
|
||||
'help.show',
|
||||
'login',
|
||||
'logout',
|
||||
'password.reset',
|
||||
'profile.confirm-email-change',
|
||||
'profile.undo-email-change',
|
||||
'register',
|
||||
'report.options',
|
||||
'routes',
|
||||
'rule-groups.down',
|
||||
'rule-groups.up',
|
||||
'rules.up',
|
||||
'rules.down',
|
||||
'rules.select',
|
||||
'search.search',
|
||||
'test-flash',
|
||||
'transactions.link.delete',
|
||||
'transactions.link.switch',
|
||||
'two-factor.lost',
|
||||
'reports.options',
|
||||
'debug',
|
||||
'preferences.delete-code',
|
||||
'rules.test-triggers',
|
||||
'piggy-banks.remove-money',
|
||||
'piggy-banks.add-money',
|
||||
'accounts.reconcile.transactions',
|
||||
'accounts.reconcile.overview',
|
||||
'transactions.clone',
|
||||
'two-factor.index',
|
||||
'api.v1',
|
||||
'installer.',
|
||||
'attachments.view',
|
||||
'recurring.events',
|
||||
'recurring.suggest',
|
||||
];
|
||||
$return = ' ';
|
||||
/** @var Route $route */
|
||||
foreach ($set as $route) {
|
||||
$name = (string)$route->getName();
|
||||
if (in_array('GET', $route->methods(), true)) {
|
||||
$found = false;
|
||||
foreach ($ignore as $string) {
|
||||
if (false !== stripos($name, $string)) {
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (false === $found) {
|
||||
$return .= 'touch '.$route->getName().'.md;';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flash all types of messages.
|
||||
*
|
||||
|
@ -102,14 +102,14 @@ class ProfileController extends Controller
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Factory|View
|
||||
* @return Factory|View|RedirectResponse
|
||||
* @throws IncompatibleWithGoogleAuthenticatorException
|
||||
* @throws InvalidCharactersException
|
||||
* @throws SecretKeyTooShortException
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function code(Request $request)
|
||||
public function code(Request $request): Factory|View|RedirectResponse
|
||||
{
|
||||
if (!$this->internalAuth || !$this->internalIdentity) {
|
||||
$request->session()->flash('error', trans('firefly.external_user_mgt_disabled'));
|
||||
@ -165,7 +165,7 @@ class ProfileController extends Controller
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function confirmEmailChange(UserRepositoryInterface $repository, string $token)
|
||||
public function confirmEmailChange(UserRepositoryInterface $repository, string $token): RedirectResponse|Redirector
|
||||
{
|
||||
if (!$this->internalAuth || !$this->internalIdentity) {
|
||||
throw new FireflyException(trans('firefly.external_user_mgt_disabled'));
|
||||
@ -186,7 +186,7 @@ class ProfileController extends Controller
|
||||
}
|
||||
$repository->unblockUser($user);
|
||||
|
||||
// return to login.
|
||||
// return to log in.
|
||||
session()->flash('success', (string)trans('firefly.login_with_new_email'));
|
||||
|
||||
return redirect(route('login'));
|
||||
@ -199,7 +199,7 @@ class ProfileController extends Controller
|
||||
*
|
||||
* @return Application|RedirectResponse|Redirector
|
||||
*/
|
||||
public function deleteAccount(Request $request)
|
||||
public function deleteAccount(Request $request): Application|RedirectResponse|Redirector
|
||||
{
|
||||
if (!$this->internalAuth || !$this->internalIdentity) {
|
||||
$request->session()->flash('error', trans('firefly.external_user_mgt_disabled'));
|
||||
@ -218,7 +218,7 @@ class ProfileController extends Controller
|
||||
*
|
||||
* @return RedirectResponse|Redirector
|
||||
*/
|
||||
public function deleteCode(Request $request)
|
||||
public function deleteCode(Request $request): RedirectResponse|Redirector
|
||||
{
|
||||
if (!$this->internalAuth || !$this->internalIdentity) {
|
||||
$request->session()->flash('error', trans('firefly.external_user_mgt_disabled'));
|
||||
@ -247,7 +247,7 @@ class ProfileController extends Controller
|
||||
*
|
||||
* @return RedirectResponse|Redirector
|
||||
*/
|
||||
public function enable2FA(Request $request)
|
||||
public function enable2FA(Request $request): RedirectResponse|Redirector
|
||||
{
|
||||
if (!$this->internalAuth || !$this->internalIdentity) {
|
||||
$request->session()->flash('error', trans('firefly.external_user_mgt_disabled'));
|
||||
@ -279,7 +279,7 @@ class ProfileController extends Controller
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function index()
|
||||
public function index(): Factory|View
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
@ -311,9 +311,9 @@ class ProfileController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Factory|View|RedirectResponse
|
||||
*/
|
||||
public function logoutOtherSessions()
|
||||
public function logoutOtherSessions(): Factory|View|RedirectResponse
|
||||
{
|
||||
if (!$this->internalAuth) {
|
||||
session()->flash('info', (string)trans('firefly.external_auth_disabled'));
|
||||
@ -327,10 +327,10 @@ class ProfileController extends Controller
|
||||
/**
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Factory|View
|
||||
* @return Factory|View|RedirectResponse
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function newBackupCodes(Request $request)
|
||||
public function newBackupCodes(Request $request): Factory|View|RedirectResponse
|
||||
{
|
||||
if (!$this->internalAuth || !$this->internalIdentity) {
|
||||
$request->session()->flash('error', trans('firefly.external_user_mgt_disabled'));
|
||||
@ -359,9 +359,9 @@ class ProfileController extends Controller
|
||||
* @param EmailFormRequest $request
|
||||
* @param UserRepositoryInterface $repository
|
||||
*
|
||||
* @return $this|RedirectResponse|Redirector
|
||||
* @return Factory|RedirectResponse|Redirector
|
||||
*/
|
||||
public function postChangeEmail(EmailFormRequest $request, UserRepositoryInterface $repository)
|
||||
public function postChangeEmail(EmailFormRequest $request, UserRepositoryInterface $repository): Factory|RedirectResponse|Redirector
|
||||
{
|
||||
if (!$this->internalAuth || !$this->internalIdentity) {
|
||||
$request->session()->flash('error', trans('firefly.external_user_mgt_disabled'));
|
||||
@ -381,7 +381,7 @@ class ProfileController extends Controller
|
||||
$existing = $repository->findByEmail($newEmail);
|
||||
if (null !== $existing) {
|
||||
// force user logout.
|
||||
Auth::guard()->logout();
|
||||
Auth::guard()->logout(); // @phpstan-ignore-line (does not recognize function)
|
||||
$request->session()->invalidate();
|
||||
|
||||
session()->flash('success', (string)trans('firefly.email_changed'));
|
||||
@ -395,7 +395,7 @@ class ProfileController extends Controller
|
||||
event(new UserChangedEmail($user, $newEmail, $oldEmail));
|
||||
|
||||
// force user logout.
|
||||
Auth::guard()->logout();
|
||||
Auth::guard()->logout(); // @phpstan-ignore-line (does not recognize function)
|
||||
$request->session()->invalidate();
|
||||
session()->flash('success', (string)trans('firefly.email_changed'));
|
||||
|
||||
@ -407,9 +407,9 @@ class ProfileController extends Controller
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Factory|RedirectResponse|Redirector|View
|
||||
* @return Factory|RedirectResponse|View
|
||||
*/
|
||||
public function changeEmail(Request $request)
|
||||
public function changeEmail(Request $request): Factory|RedirectResponse|View
|
||||
{
|
||||
if (!$this->internalAuth || !$this->internalIdentity) {
|
||||
$request->session()->flash('error', trans('firefly.external_user_mgt_disabled'));
|
||||
|
@ -93,14 +93,14 @@ class Authenticate
|
||||
if ($this->auth->check()) {
|
||||
// do an extra check on user object.
|
||||
/** @var User $user */
|
||||
$user = $this->auth->authenticate();
|
||||
$user = $this->auth->authenticate(); // @phpstan-ignore-line (thinks function returns void)
|
||||
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('session')->flash('logoutMessage', $message);
|
||||
$this->auth->logout();
|
||||
$this->auth->logout(); // @phpstan-ignore-line (thinks function is undefined)
|
||||
|
||||
throw new AuthenticationException('Blocked account.', $guards);
|
||||
}
|
||||
@ -116,7 +116,7 @@ class Authenticate
|
||||
);
|
||||
}
|
||||
|
||||
return $this->auth->authenticate();
|
||||
return $this->auth->authenticate(); // @phpstan-ignore-line (thinks function returns void)
|
||||
}
|
||||
|
||||
|
||||
|
@ -97,7 +97,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @property string $interest
|
||||
* @property string $interestPeriod
|
||||
* @property string $accountTypeString
|
||||
* @property string $location
|
||||
* @property Location $location
|
||||
* @property string $liability_direction
|
||||
* @property string $current_debt
|
||||
* @property int|null $user_group_id
|
||||
|
@ -50,8 +50,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @property string $amount_min
|
||||
* @property string $amount_max
|
||||
* @property Carbon $date
|
||||
* @property string|null $end_date
|
||||
* @property string|null $extension_date
|
||||
* @property Carbon|null $end_date
|
||||
* @property Carbon|null $extension_date
|
||||
* @property string $repeat_freq
|
||||
* @property int $skip
|
||||
* @property bool $automatch
|
||||
|
@ -59,7 +59,8 @@ class AdminServiceProvider extends ServiceProvider
|
||||
function (Application $app) {
|
||||
/** @var LinkTypeRepository $repository */
|
||||
$repository = app(LinkTypeRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
// reference to auth is not understood by phpstan.
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,8 @@ class AttachmentServiceProvider extends ServiceProvider
|
||||
function (Application $app) {
|
||||
/** @var AttachmentRepositoryInterface $repository */
|
||||
$repository = app(AttachmentRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
// reference to auth is not understood by phpstan.
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,8 @@ class BillServiceProvider extends ServiceProvider
|
||||
/** @var BillRepositoryInterface $repository */
|
||||
$repository = app(BillRepository::class);
|
||||
|
||||
if ($app->auth->check()) {
|
||||
// reference to auth is not understood by phpstan.
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
@ -54,12 +54,14 @@ class BudgetServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
// reference to auth is not understood by phpstan.
|
||||
|
||||
$this->app->bind(
|
||||
BudgetRepositoryInterface::class,
|
||||
static function (Application $app) {
|
||||
/** @var BudgetRepositoryInterface $repository */
|
||||
$repository = app(BudgetRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@ -73,7 +75,7 @@ class BudgetServiceProvider extends ServiceProvider
|
||||
static function (Application $app) {
|
||||
/** @var AvailableBudgetRepositoryInterface $repository */
|
||||
$repository = app(AvailableBudgetRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@ -87,7 +89,7 @@ class BudgetServiceProvider extends ServiceProvider
|
||||
static function (Application $app) {
|
||||
/** @var BudgetLimitRepositoryInterface $repository */
|
||||
$repository = app(BudgetLimitRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@ -101,7 +103,7 @@ class BudgetServiceProvider extends ServiceProvider
|
||||
static function (Application $app) {
|
||||
/** @var NoBudgetRepositoryInterface $repository */
|
||||
$repository = app(NoBudgetRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@ -115,7 +117,7 @@ class BudgetServiceProvider extends ServiceProvider
|
||||
static function (Application $app) {
|
||||
/** @var OperationsRepositoryInterface $repository */
|
||||
$repository = app(OperationsRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
@ -50,12 +50,13 @@ class CategoryServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
// phpstan does not understand reference to 'auth'.
|
||||
$this->app->bind(
|
||||
CategoryRepositoryInterface::class,
|
||||
static function (Application $app) {
|
||||
/** @var CategoryRepository $repository */
|
||||
$repository = app(CategoryRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@ -68,7 +69,7 @@ class CategoryServiceProvider extends ServiceProvider
|
||||
static function (Application $app) {
|
||||
/** @var OperationsRepository $repository */
|
||||
$repository = app(OperationsRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@ -81,7 +82,7 @@ class CategoryServiceProvider extends ServiceProvider
|
||||
static function (Application $app) {
|
||||
/** @var NoCategoryRepository $repository */
|
||||
$repository = app(NoCategoryRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,8 @@ class CurrencyServiceProvider extends ServiceProvider
|
||||
function (Application $app) {
|
||||
/** @var CurrencyRepository $repository */
|
||||
$repository = app(CurrencyRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
// phpstan does not get the reference to auth
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ class FireflyServiceProvider extends ServiceProvider
|
||||
static function (Application $app) {
|
||||
/** @var ObjectGroupRepository $repository */
|
||||
$repository = app(ObjectGroupRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@ -192,7 +192,7 @@ class FireflyServiceProvider extends ServiceProvider
|
||||
static function (Application $app) {
|
||||
/** @var WebhookRepository $repository */
|
||||
$repository = app(WebhookRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@ -205,7 +205,7 @@ class FireflyServiceProvider extends ServiceProvider
|
||||
static function (Application $app) {
|
||||
/** @var SearchRuleEngine $engine */
|
||||
$engine = app(SearchRuleEngine::class);
|
||||
if ($app->auth->check()) {
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
$engine->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ class JournalServiceProvider extends ServiceProvider
|
||||
static function (Application $app) {
|
||||
/** @var JournalRepositoryInterface $repository */
|
||||
$repository = app(JournalRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ class JournalServiceProvider extends ServiceProvider
|
||||
static function (Application $app) {
|
||||
/** @var JournalAPIRepositoryInterface $repository */
|
||||
$repository = app(JournalAPIRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ class JournalServiceProvider extends ServiceProvider
|
||||
static function (Application $app) {
|
||||
/** @var JournalCLIRepositoryInterface $repository */
|
||||
$repository = app(JournalCLIRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ class JournalServiceProvider extends ServiceProvider
|
||||
static function (Application $app) {
|
||||
/** @var TransactionGroupRepositoryInterface $repository */
|
||||
$repository = app(TransactionGroupRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@ -135,7 +135,7 @@ class JournalServiceProvider extends ServiceProvider
|
||||
static function (Application $app) {
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollector::class);
|
||||
if ($app->auth->check()) {
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
$collector->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ class PiggyBankServiceProvider extends ServiceProvider
|
||||
function (Application $app) {
|
||||
/** @var PiggyBankRepository $repository */
|
||||
$repository = app(PiggyBankRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ class RecurringServiceProvider extends ServiceProvider
|
||||
/** @var RecurringRepositoryInterface $repository */
|
||||
$repository = app(RecurringRepository::class);
|
||||
|
||||
if ($app->auth->check()) {
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ class RuleGroupServiceProvider extends ServiceProvider
|
||||
function (Application $app) {
|
||||
/** @var RuleGroupRepository $repository */
|
||||
$repository = app(RuleGroupRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ class RuleServiceProvider extends ServiceProvider
|
||||
function (Application $app) {
|
||||
/** @var RuleRepository $repository */
|
||||
$repository = app(RuleRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ class SearchServiceProvider extends ServiceProvider
|
||||
function (Application $app) {
|
||||
/** @var OperatorQuerySearch $search */
|
||||
$search = app(OperatorQuerySearch::class);
|
||||
if ($app->auth->check()) {
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
$search->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ class TagServiceProvider extends ServiceProvider
|
||||
/** @var TagRepository $repository */
|
||||
$repository = app(TagRepository::class);
|
||||
|
||||
if ($app->auth->check()) {
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ class TagServiceProvider extends ServiceProvider
|
||||
/** @var OperationsRepository $repository */
|
||||
$repository = app(OperationsRepository::class);
|
||||
|
||||
if ($app->auth->check()) {
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,8 @@ class ALERepository implements ALERepositoryInterface
|
||||
*/
|
||||
public function getForObject(Model $model): Collection
|
||||
{
|
||||
return AuditLogEntry::where('auditable_id', $model->id)->where('auditable_type', get_class($model))->get();
|
||||
// all Models have an ID.
|
||||
return AuditLogEntry::where('auditable_id', $model->id)->where('auditable_type', get_class($model))->get(); // @phpstan-ignore-line
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -331,7 +331,12 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
||||
*/
|
||||
public function getPiggyBanks(): Collection
|
||||
{
|
||||
return $this->user->piggyBanks()->with(['account', 'objectGroups'])->orderBy('order', 'ASC')->get();
|
||||
return $this->user
|
||||
->piggyBanks()
|
||||
->with(
|
||||
['account',
|
||||
'objectGroups']) // @phpstan-ignore-line (phpstan does not recognize objectGroups)
|
||||
->orderBy('order', 'ASC')->get();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -179,7 +179,8 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
|
||||
$current = $attachment->toArray();
|
||||
$current['file_exists'] = true;
|
||||
$current['notes'] = $repository->getNoteText($attachment);
|
||||
$current['journal_title'] = $attachment->attachable->description;
|
||||
// already determined that this attachable is a TransactionJournal.
|
||||
$current['journal_title'] = $attachment->attachable->description; // @phpstan-ignore-line
|
||||
$result[$journalId][] = $current;
|
||||
}
|
||||
|
||||
@ -239,6 +240,8 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
|
||||
$journalId = in_array($entry->source_id, $journals, true) ? $entry->source_id : $entry->destination_id;
|
||||
$return[$journalId] = $return[$journalId] ?? [];
|
||||
|
||||
// phpstan: the editable field is provided by the query.
|
||||
|
||||
if ($journalId === $entry->source_id) {
|
||||
$amount = $this->getFormattedAmount($entry->destination);
|
||||
$foreignAmount = $this->getFormattedForeignAmount($entry->destination);
|
||||
@ -247,7 +250,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
|
||||
'link' => $entry->outward,
|
||||
'group' => $entry->destination->transaction_group_id,
|
||||
'description' => $entry->destination->description,
|
||||
'editable' => 1 === $entry->editable,
|
||||
'editable' => 1 === (int)$entry->editable, // @phpstan-ignore-line
|
||||
'amount' => $amount,
|
||||
'foreign_amount' => $foreignAmount,
|
||||
];
|
||||
@ -260,7 +263,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
|
||||
'link' => $entry->inward,
|
||||
'group' => $entry->source->transaction_group_id,
|
||||
'description' => $entry->source->description,
|
||||
'editable' => 1 === $entry->editable,
|
||||
'editable' => 1 === (int)$entry->editable, // @phpstan-ignore-line
|
||||
'amount' => $amount,
|
||||
'foreign_amount' => $foreignAmount,
|
||||
];
|
||||
|
@ -222,7 +222,8 @@ class ExpandedForm
|
||||
$fields = ['title', 'name', 'description'];
|
||||
/** @var Eloquent $entry */
|
||||
foreach ($set as $entry) {
|
||||
$entryId = (int)$entry->id;
|
||||
// All Eloquent models have an ID
|
||||
$entryId = (int)$entry->id; // @phpstan-ignore-line
|
||||
$current = $entry->toArray();
|
||||
$title = null;
|
||||
foreach ($fields as $field) {
|
||||
|
@ -577,7 +577,7 @@ class ExportDataGenerator
|
||||
}
|
||||
/** @var RecurrenceTransaction $transaction */
|
||||
foreach ($recurrence->recurrenceTransactions as $transaction) {
|
||||
$categoryName = $recurringRepos->getCategory($transaction);
|
||||
$categoryName = $recurringRepos->getCategoryName($transaction);
|
||||
$budgetId = $recurringRepos->getBudget($transaction);
|
||||
$piggyBankId = $recurringRepos->getPiggyBank($transaction);
|
||||
$tags = $recurringRepos->getTags($transaction);
|
||||
|
@ -189,7 +189,7 @@ class OperatorQuerySearch implements SearchInterface
|
||||
throw new FireflyException(sprintf('Firefly III search cant handle "%s"-nodes', $class));
|
||||
case Subquery::class:
|
||||
// loop all notes in subquery:
|
||||
foreach ($searchNode->getNodes() as $subNode) {
|
||||
foreach ($searchNode->getNodes() as $subNode) { // @phpstan-ignore-line PHPStan thinks getNodes() does not exist but it does.
|
||||
$this->handleSearchNode($subNode); // let's hope it's not too recursive
|
||||
}
|
||||
break;
|
||||
|
@ -83,8 +83,8 @@ class UpdatePiggybank implements ActionInterface
|
||||
Log::debug(sprintf('Found piggy bank #%d ("%s")', $piggyBank->id, $piggyBank->name));
|
||||
|
||||
/** @var Transaction $source */
|
||||
/** @var Transaction $destination */
|
||||
$source = $journalObj->transactions()->where('amount', '<', 0)->first();
|
||||
/** @var Transaction $destination */
|
||||
$destination = $journalObj->transactions()->where('amount', '>', 0)->first();
|
||||
|
||||
if ((int)$source->account_id === (int)$piggyBank->account_id) {
|
||||
|
Loading…
Reference in New Issue
Block a user