mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-18 18:44:16 +00:00
Fix a bunch of phpstan issues.
This commit is contained in:
@@ -51,8 +51,9 @@ class ListController extends Controller
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v2)#/budgets/listBudgetLimitByBudget
|
||||
* // DateRequest $request, Budget $budget
|
||||
*/
|
||||
public function index(DateRequest $request, Budget $budget): JsonResponse
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
return response()->json([]);
|
||||
// throw new FireflyException('Needs refactoring, move to IndexController.');
|
||||
|
@@ -60,13 +60,11 @@ class IndexController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
*
|
||||
* TODO see autocomplete/accountcontroller for list.
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function index(Request $request): JsonResponse
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
$piggies = $this->repository->getPiggyBanks();
|
||||
$pageSize = $this->parameters->get('limit');
|
||||
|
@@ -100,6 +100,7 @@ class BasicController extends Controller
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws Exception
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function basic(DateRequest $request): JsonResponse
|
||||
{
|
||||
|
@@ -57,12 +57,11 @@ class DestroyController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param UserGroup $userGroup
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function destroy(Request $request, UserGroup $userGroup): JsonResponse
|
||||
public function destroy(UserGroup $userGroup): JsonResponse
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
|
@@ -57,11 +57,9 @@ class ShowController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function index(Request $request): JsonResponse
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
$collection = new Collection();
|
||||
$pageSize = $this->parameters->get('limit');
|
||||
@@ -85,12 +83,11 @@ class ShowController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param UserGroup $userGroup
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function show(Request $request, UserGroup $userGroup): JsonResponse
|
||||
public function show(UserGroup $userGroup): JsonResponse
|
||||
{
|
||||
$transformer = new UserGroupTransformer();
|
||||
$transformer->setParameters($this->parameters);
|
||||
|
@@ -55,8 +55,6 @@ class AutocompleteRequest extends FormRequest
|
||||
|
||||
// remove 'initial balance' and another from allowed types. its internal
|
||||
$array = array_diff($array, [AccountType::INITIAL_BALANCE, AccountType::RECONCILIATION]);
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
|
||||
return [
|
||||
'types' => $array,
|
||||
|
@@ -55,7 +55,6 @@ class CreateDatabase extends Command
|
||||
}
|
||||
// try to set up a raw connection:
|
||||
$exists = false;
|
||||
$checked = false; // checked for existence of DB?
|
||||
$dsn = sprintf('mysql:host=%s;port=%d;charset=utf8mb4', env('DB_HOST', 'localhost'), env('DB_PORT', '3306'));
|
||||
|
||||
if ('' !== env('DB_SOCKET', '')) {
|
||||
|
@@ -110,19 +110,17 @@ class AccountCurrencies extends Command
|
||||
private function updateAccountCurrencies(): void
|
||||
{
|
||||
$users = $this->userRepos->all();
|
||||
$defaultCurrencyCode = (string)config('firefly.default_currency', 'EUR');
|
||||
foreach ($users as $user) {
|
||||
$this->updateCurrenciesForUser($user, $defaultCurrencyCode);
|
||||
$this->updateCurrenciesForUser($user);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
* @param string $systemCurrencyCode
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function updateCurrenciesForUser(User $user, string $systemCurrencyCode): void
|
||||
private function updateCurrenciesForUser(User $user): void
|
||||
{
|
||||
$this->accountRepos->setUser($user);
|
||||
$accounts = $this->accountRepos->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
||||
|
@@ -26,7 +26,6 @@ namespace FireflyIII\Console\Commands\Upgrade;
|
||||
|
||||
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
@@ -230,24 +229,26 @@ class UpgradeLiabilitiesEight extends Command
|
||||
->where('transactions.account_id', $account->id)->get(['transaction_journals.*']);
|
||||
/** @var TransactionJournal $journal */
|
||||
foreach ($journals as $journal) {
|
||||
$delete = false;
|
||||
/** @var Transaction $source */
|
||||
$source = $journal->transactions()->where('amount', '<', 0)->first();
|
||||
/** @var Transaction $dest */
|
||||
$dest = $journal->transactions()->where('amount', '>', 0)->first();
|
||||
// $delete = false;
|
||||
// /** @var Transaction $source */
|
||||
// $source = $journal->transactions()->where('amount', '<', 0)->first();
|
||||
// /** @var Transaction $dest */
|
||||
// $dest = $journal->transactions()->where('amount', '>', 0)->first();
|
||||
|
||||
// if source is this liability and destination is expense, remove transaction.
|
||||
// if source is revenue and destination is liability, remove transaction.
|
||||
if ($source->account_id === $account->id && $dest->account->accountType->type === AccountType::EXPENSE) {
|
||||
$delete = true;
|
||||
}
|
||||
if ($dest->account_id === $account->id && $source->account->accountType->type === AccountType::REVENUE) {
|
||||
$delete = true;
|
||||
}
|
||||
|
||||
// overruled. No transaction will be deleted, ever.
|
||||
// code is kept in place so I can revisit my reasoning.
|
||||
$delete = false;
|
||||
/**
|
||||
* // if source is this liability and destination is expense, remove transaction.
|
||||
* // if source is revenue and destination is liability, remove transaction.
|
||||
* if ($source->account_id === $account->id && $dest->account->accountType->type === AccountType::EXPENSE) {
|
||||
* $delete = true;
|
||||
* }
|
||||
* if ($dest->account_id === $account->id && $source->account->accountType->type === AccountType::REVENUE) {
|
||||
* $delete = true;
|
||||
* }
|
||||
*
|
||||
* // overruled. No transaction will be deleted, ever.
|
||||
* // code is kept in place, so I can revisit my reasoning.
|
||||
* $delete = false;
|
||||
*/
|
||||
|
||||
// if ($delete) {
|
||||
$service = app(TransactionGroupDestroyService::class);
|
||||
|
@@ -254,8 +254,7 @@ class TransactionFactory
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*
|
||||
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function setUser(User $user): void
|
||||
{
|
||||
|
@@ -45,7 +45,6 @@ use FireflyIII\Notifications\User\UserLogin;
|
||||
use FireflyIII\Notifications\User\UserNewPassword;
|
||||
use FireflyIII\Notifications\User\UserRegistration as UserRegistrationNotification;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Auth\Events\Login;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
@@ -109,6 +108,7 @@ class UserEventHandler
|
||||
|
||||
/**
|
||||
* @param RegisteredUser $event
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function createExchangeRates(RegisteredUser $event): void
|
||||
{
|
||||
@@ -131,7 +131,8 @@ class UserEventHandler
|
||||
$group = null;
|
||||
|
||||
// create a new group.
|
||||
while (true === $groupExists) { /** @phpstan-ignore-line */
|
||||
while (true === $groupExists) {
|
||||
/** @phpstan-ignore-line */
|
||||
$groupExists = UserGroup::where('title', $groupTitle)->count() > 0;
|
||||
if (false === $groupExists) {
|
||||
$group = UserGroup::create(['title' => $groupTitle]);
|
||||
@@ -189,7 +190,6 @@ class UserEventHandler
|
||||
public function notifyNewIPAddress(DetectedNewIPAddress $event): void
|
||||
{
|
||||
$user = $event->user;
|
||||
$email = $user->email;
|
||||
$ipAddress = $event->ipAddress;
|
||||
|
||||
if ($user->hasRole('demo')) {
|
||||
@@ -206,7 +206,8 @@ class UserEventHandler
|
||||
if (false === $entry['notified']) {
|
||||
try {
|
||||
Notification::send($user, new UserLogin($ipAddress));
|
||||
} catch (Exception $e) { /** @phpstan-ignore-line */
|
||||
} catch (Exception $e) {
|
||||
/** @phpstan-ignore-line */
|
||||
$message = $e->getMessage();
|
||||
if (str_contains($message, 'Bcc')) {
|
||||
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
|
||||
@@ -240,7 +241,8 @@ class UserEventHandler
|
||||
if ($repository->hasRole($user, 'owner')) {
|
||||
try {
|
||||
Notification::send($user, new AdminRegistrationNotification($event->user));
|
||||
} catch (Exception $e) { /** @phpstan-ignore-line */
|
||||
} catch (Exception $e) {
|
||||
/** @phpstan-ignore-line */
|
||||
$message = $e->getMessage();
|
||||
if (str_contains($message, 'Bcc')) {
|
||||
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
|
||||
@@ -317,7 +319,8 @@ class UserEventHandler
|
||||
{
|
||||
try {
|
||||
Notification::send($event->user, new UserNewPassword(route('password.reset', [$event->token])));
|
||||
} catch (Exception $e) { /** @phpstan-ignore-line */
|
||||
} catch (Exception $e) {
|
||||
/** @phpstan-ignore-line */
|
||||
$message = $e->getMessage();
|
||||
if (str_contains($message, 'Bcc')) {
|
||||
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
|
||||
@@ -365,7 +368,8 @@ class UserEventHandler
|
||||
if ($sendMail) {
|
||||
try {
|
||||
Notification::send($event->user, new UserRegistrationNotification());
|
||||
} catch (Exception $e) { /** @phpstan-ignore-line */
|
||||
} catch (Exception $e) {
|
||||
/** @phpstan-ignore-line */
|
||||
$message = $e->getMessage();
|
||||
if (str_contains($message, 'Bcc')) {
|
||||
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
|
||||
|
@@ -36,6 +36,7 @@ use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\MessageBag;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use const DIRECTORY_SEPARATOR;
|
||||
|
||||
/**
|
||||
* Class AttachmentHelper.
|
||||
@@ -95,7 +96,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
||||
*/
|
||||
public function getAttachmentLocation(Attachment $attachment): string
|
||||
{
|
||||
return sprintf('%sat-%d.data', \DIRECTORY_SEPARATOR, $attachment->id);
|
||||
return sprintf('%sat-%d.data', DIRECTORY_SEPARATOR, $attachment->id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -44,7 +44,13 @@ trait AttachmentCollection
|
||||
{
|
||||
$this->hasAttachments();
|
||||
$this->withAttachmentInformation();
|
||||
$filter = static function (int $index, array $object) use ($name): bool {
|
||||
/**
|
||||
* @param int $index
|
||||
* @param array $object
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
$filter = static function (array $object) use ($name): bool {
|
||||
/** @var array $transaction */
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
@@ -123,7 +129,14 @@ trait AttachmentCollection
|
||||
{
|
||||
$this->hasAttachments();
|
||||
$this->withAttachmentInformation();
|
||||
$filter = static function (int $index, array $object) use ($name): bool {
|
||||
/**
|
||||
* @param int $index
|
||||
* @param array $object
|
||||
*
|
||||
* @return bool
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
$filter = static function (array $object) use ($name): bool {
|
||||
/** @var array $transaction */
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
@@ -153,7 +166,14 @@ trait AttachmentCollection
|
||||
{
|
||||
$this->hasAttachments();
|
||||
$this->withAttachmentInformation();
|
||||
$filter = static function (int $index, array $object) use ($name): bool {
|
||||
/**
|
||||
* @param int $index
|
||||
* @param array $object
|
||||
*
|
||||
* @return bool
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
$filter = static function (array $object) use ($name): bool {
|
||||
/** @var array $transaction */
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
@@ -183,7 +203,14 @@ trait AttachmentCollection
|
||||
{
|
||||
$this->hasAttachments();
|
||||
$this->withAttachmentInformation();
|
||||
$filter = static function (int $index, array $object) use ($name): bool {
|
||||
/**
|
||||
* @param int $index
|
||||
* @param array $object
|
||||
*
|
||||
* @return bool
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
$filter = static function (array $object) use ($name): bool {
|
||||
/** @var array $transaction */
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
@@ -213,7 +240,7 @@ trait AttachmentCollection
|
||||
{
|
||||
$this->hasAttachments();
|
||||
$this->withAttachmentInformation();
|
||||
$filter = static function (int $index, array $object) use ($name): bool {
|
||||
$filter = static function (array $object) use ($name): bool {
|
||||
/** @var array $transaction */
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
@@ -243,7 +270,7 @@ trait AttachmentCollection
|
||||
{
|
||||
$this->hasAttachments();
|
||||
$this->withAttachmentInformation();
|
||||
$filter = static function (int $index, array $object) use ($name): bool {
|
||||
$filter = static function (array $object) use ($name): bool {
|
||||
/** @var array $transaction */
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
@@ -270,7 +297,7 @@ trait AttachmentCollection
|
||||
{
|
||||
$this->hasAttachments();
|
||||
$this->withAttachmentInformation();
|
||||
$filter = static function (int $index, array $object) use ($name): bool {
|
||||
$filter = static function (array $object) use ($name): bool {
|
||||
/** @var array $transaction */
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
@@ -297,7 +324,7 @@ trait AttachmentCollection
|
||||
{
|
||||
$this->hasAttachments();
|
||||
$this->withAttachmentInformation();
|
||||
$filter = static function (int $index, array $object) use ($name): bool {
|
||||
$filter = static function (array $object) use ($name): bool {
|
||||
/** @var array $transaction */
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
@@ -327,7 +354,7 @@ trait AttachmentCollection
|
||||
{
|
||||
$this->hasAttachments();
|
||||
$this->withAttachmentInformation();
|
||||
$filter = static function (int $index, array $object) use ($value): bool {
|
||||
$filter = static function (array $object) use ($value): bool {
|
||||
/** @var array $transaction */
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
@@ -354,7 +381,7 @@ trait AttachmentCollection
|
||||
{
|
||||
$this->hasAttachments();
|
||||
$this->withAttachmentInformation();
|
||||
$filter = static function (int $index, array $object) use ($value): bool {
|
||||
$filter = static function (array $object) use ($value): bool {
|
||||
/** @var array $transaction */
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
@@ -381,7 +408,7 @@ trait AttachmentCollection
|
||||
{
|
||||
$this->hasAttachments();
|
||||
$this->withAttachmentInformation();
|
||||
$filter = static function (int $index, array $object) use ($value): bool {
|
||||
$filter = static function (array $object) use ($value): bool {
|
||||
/** @var array $transaction */
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
@@ -408,7 +435,7 @@ trait AttachmentCollection
|
||||
{
|
||||
$this->hasAttachments();
|
||||
$this->withAttachmentInformation();
|
||||
$filter = static function (int $index, array $object) use ($value): bool {
|
||||
$filter = static function (array $object) use ($value): bool {
|
||||
/** @var array $transaction */
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
@@ -435,7 +462,7 @@ trait AttachmentCollection
|
||||
{
|
||||
$this->hasAttachments();
|
||||
$this->withAttachmentInformation();
|
||||
$filter = static function (int $index, array $object) use ($value): bool {
|
||||
$filter = static function (array $object) use ($value): bool {
|
||||
/** @var array $transaction */
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
@@ -462,7 +489,7 @@ trait AttachmentCollection
|
||||
{
|
||||
$this->hasAttachments();
|
||||
$this->withAttachmentInformation();
|
||||
$filter = static function (int $index, array $object) use ($value): bool {
|
||||
$filter = static function (array $object) use ($value): bool {
|
||||
/** @var array $transaction */
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
@@ -489,7 +516,7 @@ trait AttachmentCollection
|
||||
{
|
||||
$this->hasAttachments();
|
||||
$this->withAttachmentInformation();
|
||||
$filter = static function (int $index, array $object) use ($value): bool {
|
||||
$filter = static function (array $object) use ($value): bool {
|
||||
/** @var array $transaction */
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
@@ -516,7 +543,7 @@ trait AttachmentCollection
|
||||
{
|
||||
$this->hasAttachments();
|
||||
$this->withAttachmentInformation();
|
||||
$filter = static function (int $index, array $object) use ($value): bool {
|
||||
$filter = static function (array $object) use ($value): bool {
|
||||
/** @var array $transaction */
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
|
@@ -915,7 +915,7 @@ trait MetaCollection
|
||||
|
||||
// this method adds a "postFilter" to the collector.
|
||||
$list = $tags->pluck('tag')->toArray();
|
||||
$filter = static function (int $index, array $object) use ($list): bool {
|
||||
$filter = static function (array $object) use ($list): bool {
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
foreach ($transaction['tags'] as $tag) {
|
||||
if (in_array($tag['name'], $list, true)) {
|
||||
|
@@ -93,7 +93,7 @@ trait TimeCollection
|
||||
$start->startOfDay();
|
||||
$this->withMetaDate($field);
|
||||
|
||||
$filter = static function (int $index, array $object) use ($field, $start, $end): bool {
|
||||
$filter = static function (array $object) use ($field, $start, $end): bool {
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon) {
|
||||
return $transaction[$field]->lt($start) || $transaction[$field]->gt($end);
|
||||
@@ -166,7 +166,7 @@ trait TimeCollection
|
||||
public function metaDayAfter(string $day, string $field): GroupCollectorInterface
|
||||
{
|
||||
$this->withMetaDate($field);
|
||||
$filter = static function (int $index, array $object) use ($field, $day): bool {
|
||||
$filter = static function (array $object) use ($field, $day): bool {
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
|
||||
) {
|
||||
@@ -190,7 +190,7 @@ trait TimeCollection
|
||||
public function metaDayBefore(string $day, string $field): GroupCollectorInterface
|
||||
{
|
||||
$this->withMetaDate($field);
|
||||
$filter = static function (int $index, array $object) use ($field, $day): bool {
|
||||
$filter = static function (array $object) use ($field, $day): bool {
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
|
||||
) {
|
||||
@@ -214,7 +214,7 @@ trait TimeCollection
|
||||
public function metaDayIs(string $day, string $field): GroupCollectorInterface
|
||||
{
|
||||
$this->withMetaDate($field);
|
||||
$filter = static function (int $index, array $object) use ($field, $day): bool {
|
||||
$filter = static function (array $object) use ($field, $day): bool {
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
|
||||
) {
|
||||
@@ -237,7 +237,7 @@ trait TimeCollection
|
||||
public function metaDayIsNot(string $day, string $field): GroupCollectorInterface
|
||||
{
|
||||
$this->withMetaDate($field);
|
||||
$filter = static function (int $index, array $object) use ($field, $day): bool {
|
||||
$filter = static function (array $object) use ($field, $day): bool {
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
|
||||
) {
|
||||
@@ -260,7 +260,7 @@ trait TimeCollection
|
||||
public function metaMonthAfter(string $month, string $field): GroupCollectorInterface
|
||||
{
|
||||
$this->withMetaDate($field);
|
||||
$filter = static function (int $index, array $object) use ($field, $month): bool {
|
||||
$filter = static function (array $object) use ($field, $month): bool {
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
|
||||
) {
|
||||
@@ -284,7 +284,7 @@ trait TimeCollection
|
||||
public function metaMonthBefore(string $month, string $field): GroupCollectorInterface
|
||||
{
|
||||
$this->withMetaDate($field);
|
||||
$filter = static function (int $index, array $object) use ($field, $month): bool {
|
||||
$filter = static function (array $object) use ($field, $month): bool {
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
|
||||
) {
|
||||
@@ -308,7 +308,7 @@ trait TimeCollection
|
||||
public function metaMonthIs(string $month, string $field): GroupCollectorInterface
|
||||
{
|
||||
$this->withMetaDate($field);
|
||||
$filter = static function (int $index, array $object) use ($field, $month): bool {
|
||||
$filter = static function (array $object) use ($field, $month): bool {
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
|
||||
) {
|
||||
@@ -331,7 +331,7 @@ trait TimeCollection
|
||||
public function metaMonthIsNot(string $month, string $field): GroupCollectorInterface
|
||||
{
|
||||
$this->withMetaDate($field);
|
||||
$filter = static function (int $index, array $object) use ($field, $month): bool {
|
||||
$filter = static function (array $object) use ($field, $month): bool {
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
|
||||
) {
|
||||
@@ -354,7 +354,7 @@ trait TimeCollection
|
||||
public function metaYearAfter(string $year, string $field): GroupCollectorInterface
|
||||
{
|
||||
$this->withMetaDate($field);
|
||||
$filter = static function (int $index, array $object) use ($field, $year): bool {
|
||||
$filter = static function (array $object) use ($field, $year): bool {
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
|
||||
) {
|
||||
@@ -378,7 +378,7 @@ trait TimeCollection
|
||||
public function metaYearBefore(string $year, string $field): GroupCollectorInterface
|
||||
{
|
||||
$this->withMetaDate($field);
|
||||
$filter = static function (int $index, array $object) use ($field, $year): bool {
|
||||
$filter = static function (array $object) use ($field, $year): bool {
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
|
||||
) {
|
||||
@@ -402,7 +402,7 @@ trait TimeCollection
|
||||
public function metaYearIs(string $year, string $field): GroupCollectorInterface
|
||||
{
|
||||
$this->withMetaDate($field);
|
||||
$filter = static function (int $index, array $object) use ($field, $year): bool {
|
||||
$filter = static function (array $object) use ($field, $year): bool {
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
|
||||
) {
|
||||
@@ -426,7 +426,7 @@ trait TimeCollection
|
||||
public function metaYearIsNot(string $year, string $field): GroupCollectorInterface
|
||||
{
|
||||
$this->withMetaDate($field);
|
||||
$filter = static function (int $index, array $object) use ($field, $year): bool {
|
||||
$filter = static function (array $object) use ($field, $year): bool {
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
|
||||
) {
|
||||
@@ -702,7 +702,7 @@ trait TimeCollection
|
||||
{
|
||||
$this->withMetaDate($field);
|
||||
$date->startOfDay();
|
||||
$filter = static function (int $index, array $object) use ($field, $date): bool {
|
||||
$filter = static function (array $object) use ($field, $date): bool {
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
|
||||
) {
|
||||
@@ -726,7 +726,7 @@ trait TimeCollection
|
||||
public function setMetaBefore(Carbon $date, string $field): GroupCollectorInterface
|
||||
{
|
||||
$this->withMetaDate($field);
|
||||
$filter = static function (int $index, array $object) use ($field, $date): bool {
|
||||
$filter = static function (array $object) use ($field, $date): bool {
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
|
||||
) {
|
||||
@@ -758,7 +758,7 @@ trait TimeCollection
|
||||
$start->startOfDay();
|
||||
$this->withMetaDate($field);
|
||||
|
||||
$filter = static function (int $index, array $object) use ($field, $start, $end): bool {
|
||||
$filter = static function (array $object) use ($field, $start, $end): bool {
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon
|
||||
) {
|
||||
|
@@ -835,8 +835,8 @@ class GroupCollector implements GroupCollectorInterface
|
||||
* @var int $ii
|
||||
* @var array $item
|
||||
*/
|
||||
foreach ($currentCollection as $ii => $item) {
|
||||
$result = $function($ii, $item);
|
||||
foreach ($currentCollection as $item) {
|
||||
$result = $function($item);
|
||||
if (false === $result) {
|
||||
// skip other filters, continue to next item.
|
||||
continue;
|
||||
|
@@ -111,11 +111,9 @@ class HomeController extends Controller
|
||||
/**
|
||||
* Send a test message to the admin.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return RedirectResponse|Redirector
|
||||
*/
|
||||
public function testMessage(Request $request)
|
||||
public function testMessage()
|
||||
{
|
||||
Log::channel('audit')->info('User sends test message.');
|
||||
/** @var User $user */
|
||||
|
@@ -209,14 +209,13 @@ class AttachmentController extends Controller
|
||||
/**
|
||||
* View attachment in browser.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Attachment $attachment
|
||||
*
|
||||
* @return LaravelResponse
|
||||
* @throws FireflyException
|
||||
* @throws BindingResolutionException
|
||||
*/
|
||||
public function view(Request $request, Attachment $attachment): LaravelResponse
|
||||
public function view(Attachment $attachment): LaravelResponse
|
||||
{
|
||||
if ($this->repository->exists($attachment)) {
|
||||
$content = $this->repository->getContent($attachment);
|
||||
|
@@ -148,7 +148,7 @@ class LoginController extends Controller
|
||||
* @param Request $request
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
* @throws ValidationException
|
||||
*/
|
||||
protected function sendFailedLoginResponse(Request $request)
|
||||
|
@@ -53,6 +53,7 @@ class TestNotification extends Notification
|
||||
* Get the array representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -67,6 +68,7 @@ class TestNotification extends Notification
|
||||
* Get the mail representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*
|
||||
* @return MailMessage
|
||||
*/
|
||||
@@ -81,6 +83,7 @@ class TestNotification extends Notification
|
||||
* Get the Slack representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*
|
||||
* @return SlackMessage
|
||||
*/
|
||||
@@ -91,6 +94,7 @@ class TestNotification extends Notification
|
||||
|
||||
/**
|
||||
* Get the notification's delivery channels.
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
|
@@ -56,6 +56,7 @@ class UserInvitation extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return array
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
@@ -70,6 +71,7 @@ class UserInvitation extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return MailMessage
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
@@ -84,6 +86,7 @@ class UserInvitation extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return SlackMessage
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toSlack($notifiable)
|
||||
{
|
||||
@@ -98,6 +101,7 @@ class UserInvitation extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return array
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
|
@@ -56,6 +56,7 @@ class UserRegistration extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return array
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
@@ -70,6 +71,7 @@ class UserRegistration extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return MailMessage
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
@@ -84,6 +86,7 @@ class UserRegistration extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return SlackMessage
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toSlack($notifiable)
|
||||
{
|
||||
@@ -96,6 +99,7 @@ class UserRegistration extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return array
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
|
@@ -56,6 +56,7 @@ class VersionCheckResult extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return array
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
@@ -70,6 +71,7 @@ class VersionCheckResult extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return MailMessage
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
@@ -84,6 +86,7 @@ class VersionCheckResult extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return SlackMessage
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toSlack($notifiable)
|
||||
{
|
||||
@@ -99,6 +102,7 @@ class VersionCheckResult extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return array
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
|
@@ -61,6 +61,7 @@ class BillReminder extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return array
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
@@ -75,6 +76,7 @@ class BillReminder extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return MailMessage
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
@@ -94,6 +96,7 @@ class BillReminder extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return SlackMessage
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toSlack($notifiable)
|
||||
{
|
||||
@@ -117,6 +120,7 @@ class BillReminder extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return array
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
|
@@ -53,6 +53,7 @@ class NewAccessToken extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return array
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
@@ -67,6 +68,7 @@ class NewAccessToken extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return MailMessage
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
@@ -81,6 +83,7 @@ class NewAccessToken extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return SlackMessage
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toSlack($notifiable)
|
||||
{
|
||||
@@ -93,6 +96,7 @@ class NewAccessToken extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return array
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
|
@@ -66,6 +66,7 @@ class RuleActionFailed extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return array
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
@@ -80,6 +81,7 @@ class RuleActionFailed extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return SlackMessage
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toSlack($notifiable)
|
||||
{
|
||||
@@ -101,6 +103,7 @@ class RuleActionFailed extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return array
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
|
@@ -53,6 +53,7 @@ class TransactionCreation extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return array
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
@@ -67,6 +68,7 @@ class TransactionCreation extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return MailMessage
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
@@ -81,6 +83,7 @@ class TransactionCreation extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return array
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
|
@@ -57,6 +57,7 @@ class UserLogin extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return array
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
@@ -71,6 +72,7 @@ class UserLogin extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return MailMessage
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
@@ -97,6 +99,7 @@ class UserLogin extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return SlackMessage
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toSlack($notifiable)
|
||||
{
|
||||
@@ -120,6 +123,7 @@ class UserLogin extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return array
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
|
@@ -53,6 +53,7 @@ class UserNewPassword extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return array
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
@@ -67,6 +68,7 @@ class UserNewPassword extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return MailMessage
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
@@ -81,6 +83,7 @@ class UserNewPassword extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return array
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
|
@@ -50,6 +50,7 @@ class UserRegistration extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return array
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
@@ -64,6 +65,7 @@ class UserRegistration extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return MailMessage
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
@@ -78,6 +80,7 @@ class UserRegistration extends Notification
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return array
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
|
Reference in New Issue
Block a user