Use PSR-12 code style

This commit is contained in:
James Cole
2022-10-30 14:24:37 +01:00
parent f53923f16c
commit f52675068b
151 changed files with 251 additions and 403 deletions

View File

@@ -65,7 +65,6 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
$journal = $this->user->transactionJournals()->find($journalId);
return $journal->attachments()->count();
}
/**
@@ -73,7 +72,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
*/
public function destroy(TransactionGroup $group): void
{
$service = new TransactionGroupDestroyService;
$service = new TransactionGroupDestroyService();
$service->destroy($group);
}
@@ -181,7 +180,6 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
$current['notes'] = $repository->getNoteText($attachment);
$current['journal_title'] = $attachment->attachable->description; // @phpstan-ignore-line
$result[$journalId][] = $current;
}
return $result;
@@ -198,8 +196,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
{
$return = [];
$journals = $group->transactionJournals->pluck('id')->toArray();
$set = TransactionJournalLink
::where(
$set = TransactionJournalLink::where(
static function (Builder $q) use ($journals) {
$q->whereIn('source_id', $journals);
$q->orWhereIn('destination_id', $journals);
@@ -262,7 +259,6 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
}
if (TransactionType::WITHDRAWAL !== $type) {
$return = app('amount')->formatAnything($currency, $amount);
}
return $return;
@@ -319,8 +315,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
*/
public function getMetaDateFields(int $journalId, array $fields): NullArrayObject
{
$query = DB
::table('journal_meta')
$query = DB::table('journal_meta')
->where('transaction_journal_id', $journalId)
->whereIn('name', $fields)
->whereNull('deleted_at')
@@ -344,8 +339,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
*/
public function getMetaFields(int $journalId, array $fields): NullArrayObject
{
$query = DB
::table('journal_meta')
$query = DB::table('journal_meta')
->where('transaction_journal_id', $journalId)
->whereIn('name', $fields)
->whereNull('deleted_at')
@@ -369,8 +363,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
public function getNoteText(int $journalId): ?string
{
/** @var Note|null $note */
$note = Note
::where('noteable_id', $journalId)
$note = Note::where('noteable_id', $journalId)
->where('noteable_type', TransactionJournal::class)
->first();
if (null === $note) {
@@ -394,8 +387,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
$return = [];
$journals = $group->transactionJournals->pluck('id')->toArray();
$currency = app('amount')->getDefaultCurrencyByUser($this->user);
$data = PiggyBankEvent
::whereIn('transaction_journal_id', $journals)
$data = PiggyBankEvent::whereIn('transaction_journal_id', $journals)
->with('piggyBank', 'piggyBank.account')
->get(['piggy_bank_events.*']);
/** @var PiggyBankEvent $row */
@@ -404,8 +396,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
continue;
}
// get currency preference.
$currencyPreference = AccountMeta
::where('account_id', $row->piggyBank->account_id)
$currencyPreference = AccountMeta::where('account_id', $row->piggyBank->account_id)
->where('name', 'currency_id')
->first();
if (null !== $currencyPreference) {
@@ -448,8 +439,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
*/
public function getTags(int $journalId): array
{
$result = DB
::table('tag_transaction_journal')
$result = DB::table('tag_transaction_journal')
->leftJoin('tags', 'tag_transaction_journal.tag_id', '=', 'tags.id')
->where('tag_transaction_journal.transaction_journal_id', $journalId)
->orderBy('tags.tag', 'ASC')

View File

@@ -176,5 +176,4 @@ interface TransactionGroupRepositoryInterface
* @return TransactionGroup
*/
public function update(TransactionGroup $transactionGroup, array $data): TransactionGroup;
}

View File

@@ -32,7 +32,6 @@ use Log;
*/
class TransactionTypeRepository implements TransactionTypeRepositoryInterface
{
/**
* @param TransactionType|null $type
* @param string|null $typeString

View File

@@ -274,7 +274,7 @@ class UserRepository implements UserRepositoryInterface
{
$now = Carbon::now();
$now->addDays(2);
$invitee = new InvitedUser;
$invitee = new InvitedUser();
$invitee->user()->associate($user);
$invitee->invite_code = Str::random(64);
$invitee->email = $email;
@@ -353,7 +353,6 @@ class UserRepository implements UserRepositoryInterface
$user->blocked = false;
$user->blocked_code = '';
$user->save();
}
/**

View File

@@ -32,7 +32,6 @@ use Illuminate\Support\Collection;
*/
interface UserRepositoryInterface
{
/**
* Returns a collection of all users.
*

View File

@@ -98,5 +98,4 @@ interface WebhookRepositoryInterface
* @return Webhook
*/
public function update(Webhook $webhook, array $data): Webhook;
}

View File

@@ -154,7 +154,6 @@ class BelongsUser implements Rule
if (PiggyBank::class === $class) {
$objects = PiggyBank::leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')
->where('accounts.user_id', '=', auth()->user()->id)->get(['piggy_banks.*']);
}
if (PiggyBank::class !== $class) {
$objects = $class::where('user_id', '=', auth()->user()->id)->get();

View File

@@ -61,7 +61,7 @@ class IsBoolean implements Rule
if (is_int($value) && 1 === $value) {
return true;
}
if (is_string($value) && in_array($value, ['0', '1', 'true', 'false', 'on', 'off', 'yes', 'no', 'y', 'n'])) {
if (is_string($value) && in_array($value, ['0', '1', 'true', 'false', 'on', 'off', 'yes', 'no', 'y', 'n'], true)) {
return true;
}

View File

@@ -35,7 +35,6 @@ use Log;
*/
class IsDateOrTime implements Rule
{
/**
* Get the validation error message.
*

View File

@@ -101,7 +101,10 @@ class UniqueAccountNumber implements Rule
Log::debug(
sprintf(
'account number "%s" is in use with %d account(s) of type "%s", which is too much for expected type "%s"',
$value, $count, $type, $this->expectedType
$value,
$count,
$type,
$this->expectedType
)
);
@@ -147,8 +150,7 @@ class UniqueAccountNumber implements Rule
*/
private function countHits(string $type, string $accountNumber): int
{
$query = AccountMeta
::leftJoin('accounts', 'accounts.id', '=', 'account_meta.account_id')
$query = AccountMeta::leftJoin('accounts', 'accounts.id', '=', 'account_meta.account_id')
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
->where('accounts.user_id', auth()->user()->id)
->where('account_types.type', $type)

View File

@@ -98,7 +98,10 @@ class UniqueIban implements Rule
Log::debug(
sprintf(
'IBAN "%s" is in use with %d account(s) of type "%s", which is too much for expected type "%s"',
$value, $count, $type, $this->expectedType
$value,
$count,
$type,
$this->expectedType
)
);

View File

@@ -32,7 +32,6 @@ use Illuminate\Contracts\Validation\Rule;
*/
class ValidRecurrenceRepetitionType implements Rule
{
/**
* Get the validation error message.
*
@@ -60,7 +59,7 @@ class ValidRecurrenceRepetitionType implements Rule
}
//monthly,17
//ndom,3,7
if (in_array(substr($value, 0, 6), ['yearly', 'weekly'])) {
if (in_array(substr($value, 0, 6), ['yearly', 'weekly'], true)) {
return true;
}
if (str_starts_with($value, 'monthly')) {

View File

@@ -35,7 +35,6 @@ use Log;
*/
class ValidRecurrenceRepetitionValue implements Rule
{
/**
* Get the validation error message.
*

View File

@@ -36,7 +36,6 @@ use Log;
*/
class UpdateRequest implements UpdateRequestInterface
{
/**
* @param string $channel
*
@@ -83,7 +82,7 @@ class UpdateRequest implements UpdateRequestInterface
$url = config('firefly.update_endpoint');
Log::debug(sprintf('Going to call %s', $url));
try {
$client = new Client;
$client = new Client();
$options = [
'headers' => [
'User-Agent' => sprintf('FireflyIII/%s/%s', config('firefly.version'), $channel),
@@ -110,7 +109,6 @@ class UpdateRequest implements UpdateRequestInterface
$body = (string) $res->getBody();
try {
$json = json_decode($body, true, 512, JSON_THROW_ON_ERROR);
} catch (JsonException $e) {
Log::error('Body is not valid JSON');
Log::error($body);

View File

@@ -35,5 +35,4 @@ interface UpdateRequestInterface
* @return array
*/
public function getUpdateInformation(string $channel): array;
}

View File

@@ -91,8 +91,7 @@ class AccountDestroyService
Log::debug(sprintf('Found opening balance journal with ID #%d', $journalId));
// get transactions with this journal (should be just one):
$transactions = Transaction
::where('transaction_journal_id', $journalId)
$transactions = Transaction::where('transaction_journal_id', $journalId)
->where('account_id', '!=', $account->id)
->get();
/** @var Transaction $transaction */
@@ -159,7 +158,6 @@ class AccountDestroyService
*/
private function destroyJournals(Account $account): void
{
/** @var JournalDestroyService $service */
$service = app(JournalDestroyService::class);
@@ -181,8 +179,7 @@ class AccountDestroyService
*/
private function destroyRecurrences(Account $account): void
{
$recurrences = RecurrenceTransaction::
where(
$recurrences = RecurrenceTransaction::where(
static function (Builder $q) use ($account) {
$q->where('source_id', $account->id);
$q->orWhere('destination_id', $account->id);
@@ -195,5 +192,4 @@ class AccountDestroyService
$destroyService->destroyById((int) $recurrenceId);
}
}
}

View File

@@ -43,5 +43,4 @@ class BillDestroyService
// @ignoreException
}
}
}

View File

@@ -39,7 +39,6 @@ class BudgetDestroyService
*/
public function destroy(Budget $budget): void
{
try {
$budget->delete();
} catch (Exception $e) { // @phpstan-ignore-line

View File

@@ -38,12 +38,10 @@ class CurrencyDestroyService
*/
public function destroy(TransactionCurrency $currency): void
{
try {
$currency->delete();
} catch (Exception $e) { // @phpstan-ignore-line
// @ignoreException
}
}
}

View File

@@ -95,11 +95,8 @@ class JournalDestroyService
$group->delete();
}
}
} catch (Exception $e) { // @phpstan-ignore-line
// @ignoreException
}
}
}

View File

@@ -45,7 +45,6 @@ class RecurrenceDestroyService
return;
}
$this->destroy($recurrence);
}
/**
@@ -82,5 +81,4 @@ class RecurrenceDestroyService
// @ignoreException
}
}
}

View File

@@ -33,7 +33,6 @@ use FireflyIII\Models\TransactionGroup;
*/
class TransactionGroupDestroyService
{
/**
* @param TransactionGroup $transactionGroup
*/
@@ -50,5 +49,4 @@ class TransactionGroupDestroyService
// @ignoreException
}
}
}

View File

@@ -118,8 +118,8 @@ trait AccountServiceTrait
// remove currency_id if necessary.
$type = $account->accountType->type;
$list = config('firefly.valid_currency_account_types');
if(!in_array($type, $list, true)) {
$pos = array_search('currency_id', $fields);
if (!in_array($type, $list, true)) {
$pos = array_search('currency_id', $fields, true);
if ($pos !== false) {
unset($fields[$pos]);
}
@@ -147,7 +147,6 @@ trait AccountServiceTrait
// if the field is set but NULL, skip it.
// if the field is set but "", update it.
if (array_key_exists($field, $data) && null !== $data[$field]) {
// convert boolean value:
if (is_bool($data[$field]) && false === $data[$field]) {
$data[$field] = 0;
@@ -184,7 +183,7 @@ trait AccountServiceTrait
}
$dbNote = $account->notes()->first();
if (null === $dbNote) {
$dbNote = new Note;
$dbNote = new Note();
$dbNote->noteable()->associate($account);
}
$dbNote->text = trim($note);

View File

@@ -36,7 +36,6 @@ use Log;
*/
trait BillServiceTrait
{
/**
* @param Bill $bill
* @param string $oldName
@@ -90,5 +89,4 @@ trait BillServiceTrait
return true;
}
}

View File

@@ -22,10 +22,8 @@
declare(strict_types=1);
namespace FireflyIII\Services\Internal\Support;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Factory\AccountMetaFactory;
use FireflyIII\Models\Account;
@@ -110,11 +108,11 @@ class CreditRecalculateService
// destination or source must be liability.
$valid = config('firefly.valid_liabilities');
if (in_array($destination->accountType->type, $valid)) {
if (in_array($destination->accountType->type, $valid, true)) {
Log::debug(sprintf('Dest account type is "%s", include it.', $destination->accountType->type));
$this->work[] = $destination;
}
if (in_array($source->accountType->type, $valid)) {
if (in_array($source->accountType->type, $valid, true)) {
Log::debug(sprintf('Src account type is "%s", include it.', $source->accountType->type));
$this->work[] = $source;
}
@@ -170,7 +168,7 @@ class CreditRecalculateService
private function processAccount(): void
{
$valid = config('firefly.valid_liabilities');
if (in_array($this->account->accountType->type, $valid)) {
if (in_array($this->account->accountType->type, $valid, true)) {
Log::debug(sprintf('Account type is "%s", include it.', $this->account->accountType->type));
$this->work[] = $this->account;
}
@@ -290,6 +288,4 @@ class CreditRecalculateService
{
$this->group = $group;
}
}

View File

@@ -206,13 +206,13 @@ trait JournalServiceTrait
Log::debug(
sprintf(
'Was given %s account #%d ("%s") so will simply return that.',
$account->accountType->type, $account->id, $account->name
$account->accountType->type,
$account->id,
$account->name
)
);
}
if (null === $account) {
// final attempt, create it.
if (AccountType::ASSET === $preferredType) {
throw new FireflyException(sprintf('TransactionFactory: Cannot create asset account with these values: %s', json_encode($data)));
@@ -258,7 +258,6 @@ trait JournalServiceTrait
$metaFactory = app(AccountMetaFactory::class);
$metaFactory->create(['account_id' => $account->id, 'name' => 'account_number', 'data' => $data['number']]);
}
}
return $account;
@@ -385,7 +384,7 @@ trait JournalServiceTrait
$note = $journal->notes()->first();
if ('' !== $notes) {
if (null === $note) {
$note = new Note;
$note = new Note();
$note->noteable()->associate($journal);
}
$note->text = $notes;

View File

@@ -42,7 +42,7 @@ trait LocationServiceTrait
{
$data['store_location'] = $data['store_location'] ?? false;
if ($data['store_location']) {
$location = new Location;
$location = new Location();
$location->latitude = $data['latitude'] ?? config('firefly.default_location.latitude');
$location->longitude = $data['longitude'] ?? config('firefly.default_location.longitude');
$location->zoom_level = $data['zoom_level'] ?? config('firefly.default_location.zoom_level');
@@ -54,5 +54,4 @@ trait LocationServiceTrait
return null;
}
}

View File

@@ -97,7 +97,6 @@ trait RecurringTransactionTrait
'weekend' => $array['weekend'] ?? 1,
]
);
}
}
@@ -181,7 +180,6 @@ trait RecurringTransactionTrait
if (array_key_exists('tags', $array) && is_array($array['tags'])) {
$this->updateTags($transaction, $array['tags']);
}
}
}
@@ -226,11 +224,9 @@ trait RecurringTransactionTrait
if (!in_array($expectedType, $cannotCreate, true)) {
try {
$result = $factory->findOrCreate($accountName, $expectedType);
} catch (FireflyException $e) {
Log::error($e->getMessage());
}
}
}
@@ -252,7 +248,7 @@ trait RecurringTransactionTrait
$meta = $transaction->recurrenceTransactionMeta()->where('name', 'budget_id')->first();
if (null === $meta) {
$meta = new RecurrenceTransactionMeta;
$meta = new RecurrenceTransactionMeta();
$meta->rt_id = $transaction->id;
$meta->name = 'budget_id';
}
@@ -275,7 +271,7 @@ trait RecurringTransactionTrait
$meta = $transaction->recurrenceTransactionMeta()->where('name', 'bill_id')->first();
if (null === $meta) {
$meta = new RecurrenceTransactionMeta;
$meta = new RecurrenceTransactionMeta();
$meta->rt_id = $transaction->id;
$meta->name = 'bill_id';
}
@@ -304,7 +300,7 @@ trait RecurringTransactionTrait
$meta = $transaction->recurrenceTransactionMeta()->where('name', 'category_id')->first();
if (null === $meta) {
$meta = new RecurrenceTransactionMeta;
$meta = new RecurrenceTransactionMeta();
$meta->rt_id = $transaction->id;
$meta->name = 'category_id';
}

View File

@@ -270,7 +270,7 @@ class AccountUpdateService
if (!(null === $data['latitude'] && null === $data['longitude'] && null === $data['zoom_level'])) {
$location = $this->accountRepository->getLocation($account);
if (null === $location) {
$location = new Location;
$location = new Location();
$location->locatable()->associate($account);
}

View File

@@ -40,7 +40,8 @@ use Log;
*/
class BillUpdateService
{
use BillServiceTrait, CreatesObjectGroups;
use BillServiceTrait;
use CreatesObjectGroups;
protected User $user;
@@ -203,7 +204,6 @@ class BillUpdateService
$bill->order = $newOrder;
$bill->save();
}
}
/**
@@ -239,7 +239,6 @@ class BillUpdateService
}
$this->updateRules($rules, $ruleTriggerKey, $oldData[$field], $newData[$field]);
}
}
/**

View File

@@ -130,8 +130,7 @@ class CategoryUpdateService
*/
private function updateRecurrences(string $oldName, string $newName): void
{
RecurrenceTransactionMeta
::leftJoin('recurrences_transactions', 'rt_meta.rt_id', '=', 'recurrences_transactions.id')
RecurrenceTransactionMeta::leftJoin('recurrences_transactions', 'rt_meta.rt_id', '=', 'recurrences_transactions.id')
->leftJoin('recurrences', 'recurrences.id', '=', 'recurrences_transactions.recurrence_id')
->where('recurrences.user_id', $this->user->id)
->where('rt_meta.name', 'category_name')
@@ -165,11 +164,10 @@ class CategoryUpdateService
}
$dbNote = $category->notes()->first();
if (null === $dbNote) {
$dbNote = new Note;
$dbNote = new Note();
$dbNote->noteable()->associate($category);
}
$dbNote->text = trim($note);
$dbNote->save();
}
}

View File

@@ -64,5 +64,4 @@ class CurrencyUpdateService
return $currency;
}
}

View File

@@ -108,7 +108,7 @@ class GroupCloneService
// clone linked piggy banks
/** @var PiggyBankEvent $event */
$event = $journal->piggyBankEvents()->first();
if(null !== $event) {
if (null !== $event) {
$piggyBank = $event->piggyBank;
$factory = app(PiggyBankEventFactory::class);
$factory->create($newJournal, $piggyBank);
@@ -136,11 +136,11 @@ class GroupCloneService
{
$newNote = $note->replicate();
$newNote->text .= sprintf(
"\n\n%s", trans('firefly.clones_journal_x', ['description' => $newJournal->description, 'id' => $oldGroupId])
"\n\n%s",
trans('firefly.clones_journal_x', ['description' => $newJournal->description, 'id' => $oldGroupId])
);
$newNote->noteable_id = $newJournal->id;
$newNote->save();
}
/**

View File

@@ -227,5 +227,4 @@ class GroupUpdateService
return $collection->first();
}
}

View File

@@ -456,7 +456,9 @@ class JournalUpdateService
Log::debug(
sprintf(
'Trying to change journal #%d from a %s to a %s.',
$this->transactionJournal->id, $this->transactionJournal->transactionType->type, $type
$this->transactionJournal->id,
$this->transactionJournal->transactionType->type,
$type
)
);

View File

@@ -42,7 +42,8 @@ use Log;
*/
class RecurrenceUpdateService
{
use TransactionTypeTrait, RecurringTransactionTrait;
use TransactionTypeTrait;
use RecurringTransactionTrait;
private User $user;

View File

@@ -63,7 +63,7 @@ class StandardWebhookSender implements WebhookSenderInterface
Log::error('Did not send message because of a Firefly III Exception.');
Log::error($e->getMessage());
Log::error($e->getTraceAsString());
$attempt = new WebhookAttempt;
$attempt = new WebhookAttempt();
$attempt->webhookMessage()->associate($this->message);
$attempt->status_code = 0;
$attempt->logs = sprintf('Exception: %s', $e->getMessage());
@@ -83,7 +83,7 @@ class StandardWebhookSender implements WebhookSenderInterface
Log::error('Did not send message because of a JSON error.');
Log::error($e->getMessage());
Log::error($e->getTraceAsString());
$attempt = new WebhookAttempt;
$attempt = new WebhookAttempt();
$attempt->webhookMessage()->associate($this->message);
$attempt->status_code = 0;
$attempt->logs = sprintf('Json error: %s', $e->getMessage());
@@ -105,7 +105,7 @@ class StandardWebhookSender implements WebhookSenderInterface
'timeout' => 10,
],
];
$client = new Client;
$client = new Client();
try {
$res = $client->request('POST', $this->message->webhook->url, $options);
$this->message->sent = true;
@@ -119,7 +119,7 @@ class StandardWebhookSender implements WebhookSenderInterface
$this->message->sent = false;
$this->message->save();
$attempt = new WebhookAttempt;
$attempt = new WebhookAttempt();
$attempt->webhookMessage()->associate($this->message);
$attempt->status_code = $e->hasResponse() ? $e->getResponse()->getStatusCode() : 0;
$attempt->logs = $logs;

View File

@@ -117,7 +117,7 @@ class Amount
*/
public function getCurrencyCode(): string
{
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty('getCurrencyCode');
if ($cache->has()) {
return $cache->get();
@@ -155,7 +155,7 @@ class Amount
*/
public function getDefaultCurrencyByUser(User $user): TransactionCurrency
{
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty('getDefaultCurrency');
$cache->addProperty($user->id);
if ($cache->has()) {

View File

@@ -37,7 +37,6 @@ use Str;
*/
class RemoteUserProvider implements UserProvider
{
/**
* @inheritDoc
*/
@@ -65,7 +64,7 @@ class RemoteUserProvider implements UserProvider
]
);
// if this is the first user, give them admin as well.
if(1 === User::count()) {
if (1 === User::count()) {
$roleObject = Role::where('name', 'owner')->first();
$user->roles()->attach($roleObject);
}

View File

@@ -33,7 +33,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
*/
class AccountList implements BinderInterface
{
/**
* @param string $value
* @param Route $route
@@ -45,7 +44,7 @@ class AccountList implements BinderInterface
public static function routeBinder(string $value, Route $route): Collection
{
if (auth()->check()) {
$collection = new Collection;
$collection = new Collection();
if ('allAssetAccounts' === $value) {
/** @var Collection $collection */
$collection = auth()->user()->accounts()
@@ -70,6 +69,6 @@ class AccountList implements BinderInterface
}
}
Log::error(sprintf('Trying to show account list (%s), but user is not logged in or list is empty.', $route->uri));
throw new NotFoundHttpException;
throw new NotFoundHttpException();
}
}

View File

@@ -44,7 +44,6 @@ class BudgetList implements BinderInterface
public static function routeBinder(string $value, Route $route): Collection
{
if (auth()->check()) {
if ('allBudgets' === $value) {
return auth()->user()->budgets()->where('active', true)
->orderBy('order', 'ASC')
@@ -57,7 +56,7 @@ class BudgetList implements BinderInterface
if (empty($list)) {
Log::warning('Budget list count is zero, return 404.');
throw new NotFoundHttpException;
throw new NotFoundHttpException();
}
@@ -69,15 +68,14 @@ class BudgetList implements BinderInterface
// add empty budget if applicable.
if (in_array(0, $list, true)) {
$collection->push(new Budget);
$collection->push(new Budget());
}
if ($collection->count() > 0) {
return $collection;
}
}
Log::warning('BudgetList fallback to 404.');
throw new NotFoundHttpException;
throw new NotFoundHttpException();
}
}

View File

@@ -34,7 +34,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
*/
class CLIToken implements BinderInterface
{
/**
* @param string $value
* @param Route $route
@@ -62,6 +61,6 @@ class CLIToken implements BinderInterface
}
}
Log::error(sprintf('Recognized no users by access token "%s"', $value));
throw new NotFoundHttpException;
throw new NotFoundHttpException();
}
}

View File

@@ -51,7 +51,7 @@ class CategoryList implements BinderInterface
$list = array_unique(array_map('\intval', explode(',', $value)));
if (empty($list)) {
throw new NotFoundHttpException;
throw new NotFoundHttpException();
}
/** @var Collection $collection */
@@ -61,13 +61,13 @@ class CategoryList implements BinderInterface
// add empty category if applicable.
if (in_array(0, $list, true)) {
$collection->push(new Category);
$collection->push(new Category());
}
if ($collection->count() > 0) {
return $collection;
}
}
throw new NotFoundHttpException;
throw new NotFoundHttpException();
}
}

View File

@@ -46,6 +46,6 @@ class CurrencyCode implements BinderInterface
return $currency;
}
}
throw new NotFoundHttpException;
throw new NotFoundHttpException();
}
}

View File

@@ -73,7 +73,7 @@ class Date implements BinderInterface
$result = new Carbon($value);
} catch (Exception $e) { // @phpstan-ignore-line
Log::error(sprintf('Could not parse date "%s" for user #%d: %s', $value, auth()->user()->id, $e->getMessage()));
throw new NotFoundHttpException;
throw new NotFoundHttpException();
}
return $result;

View File

@@ -31,7 +31,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
*/
class DynamicConfigKey
{
public static array $accepted
= [
'configuration.is_demo_site',
@@ -52,7 +51,6 @@ class DynamicConfigKey
if (in_array($value, self::$accepted, true)) {
return $value;
}
throw new NotFoundHttpException;
throw new NotFoundHttpException();
}
}

View File

@@ -68,6 +68,6 @@ class EitherConfigKey
if (in_array($value, self::$static, true) || in_array($value, DynamicConfigKey::$accepted, true)) {
return $value;
}
throw new NotFoundHttpException;
throw new NotFoundHttpException();
}
}

View File

@@ -53,12 +53,12 @@ class JournalList implements BinderInterface
$collector->setJournalIds($list);
$result = $collector->getExtractedJournals();
if (empty($result)) {
throw new NotFoundHttpException;
throw new NotFoundHttpException();
}
return $result;
}
throw new NotFoundHttpException;
throw new NotFoundHttpException();
}
/**
@@ -70,7 +70,7 @@ class JournalList implements BinderInterface
{
$list = array_unique(array_map('\intval', explode(',', $value)));
if (empty($list)) {
throw new NotFoundHttpException;
throw new NotFoundHttpException();
}
return $list;

View File

@@ -44,7 +44,6 @@ class TagList implements BinderInterface
public static function routeBinder(string $value, Route $route): Collection
{
if (auth()->check()) {
if ('allTags' === $value) {
return auth()->user()->tags()
->orderBy('tag', 'ASC')
@@ -55,7 +54,7 @@ class TagList implements BinderInterface
if (empty($list)) {
Log::error('Tag list is empty.');
throw new NotFoundHttpException;
throw new NotFoundHttpException();
}
@@ -82,6 +81,6 @@ class TagList implements BinderInterface
}
}
Log::error('TagList: user is not logged in.');
throw new NotFoundHttpException;
throw new NotFoundHttpException();
}
}

View File

@@ -54,9 +54,9 @@ class TagOrId implements BinderInterface
return $result;
}
Log::error('TagOrId: tag not found.');
throw new NotFoundHttpException;
throw new NotFoundHttpException();
}
Log::error('TagOrId: user is not logged in.');
throw new NotFoundHttpException;
throw new NotFoundHttpException();
}
}

View File

@@ -41,7 +41,7 @@ class CacheProperties
*/
public function __construct()
{
$this->properties = new Collection;
$this->properties = new Collection();
if (auth()->check()) {
$this->addProperty(auth()->user()->id);
$this->addProperty(app('preferences')->lastActivity());

View File

@@ -64,7 +64,6 @@ class FrontpageChartGenerator
$this->accountRepos = app(AccountRepositoryInterface::class);
$this->opsRepos = app(OperationsRepositoryInterface::class);
$this->noCatRepos = app(NoCategoryRepositoryInterface::class);
}
/**
@@ -200,10 +199,8 @@ class FrontpageChartGenerator
$category = $array['name'];
$amount = $array['sum_float'] < 0 ? $array['sum_float'] * -1 : $array['sum_float'];
$currencyData[$key]['entries'][$category] = $amount;
}
return $currencyData;
}
}

View File

@@ -124,7 +124,6 @@ class WholePeriodChartGenerator
*/
protected function calculateStep(Carbon $start, Carbon $end): string
{
$step = '1D';
$months = $start->diffInMonths($end);
if ($months > 3) {
@@ -165,5 +164,4 @@ class WholePeriodChartGenerator
return $return;
}
}

View File

@@ -74,5 +74,4 @@ abstract class AbstractCronjob
{
$this->force = $force;
}
}

View File

@@ -34,7 +34,6 @@ use Log;
*/
class AutoBudgetCronjob extends AbstractCronjob
{
/**
* @inheritDoc
*/

View File

@@ -34,7 +34,6 @@ use Log;
*/
class ExchangeRatesCronjob extends AbstractCronjob
{
/**
* @inheritDoc
*/

View File

@@ -340,7 +340,6 @@ class ExpandedForm
*/
public function password(string $name, array $options = null): string
{
$label = $this->label($name, $options);
$options = $this->expandOptionArray($name, $label, $options);
$classes = $this->getHolderClasses($name);

View File

@@ -82,7 +82,7 @@ class ExportDataGenerator
public function __construct()
{
$this->accounts = new Collection;
$this->accounts = new Collection();
$this->start = today(config('app.timezone'));
$this->start->subYear();
$this->end = today(config('app.timezone'));
@@ -310,7 +310,6 @@ class ExportDataGenerator
}
return $string;
}
/**
@@ -737,7 +736,6 @@ class ExportDataGenerator
$metaData['recurrence_total'],
$metaData['recurrence_count'],
];
}
//load the CSV document from a string
@@ -883,5 +881,4 @@ class ExportDataGenerator
{
$this->user = $user;
}
}

View File

@@ -35,7 +35,6 @@ use Illuminate\Database\QueryException;
*/
class FireflyConfig
{
/**
* @param string $name
*/
@@ -97,7 +96,7 @@ class FireflyConfig
try {
$config = Configuration::whereName($name)->whereNull('deleted_at')->first();
} catch (QueryException|Exception $e) { // @phpstan-ignore-line
$item = new Configuration;
$item = new Configuration();
$item->name = $name;
$item->data = $value;
@@ -105,7 +104,7 @@ class FireflyConfig
}
if (null === $config) {
$item = new Configuration;
$item = new Configuration();
$item->name = $name;
$item->data = $value;
$item->save();
@@ -128,10 +127,8 @@ class FireflyConfig
*/
public function getFresh(string $name, $default = null): ?Configuration
{
$config = Configuration::where('name', $name)->first(['id', 'name', 'data']);
if ($config) {
return $config;
}
// no preference found and default is null:

View File

@@ -224,5 +224,4 @@ class CurrencyForm
return $this->select($name, $array, $value, $options);
}
}

View File

@@ -87,7 +87,6 @@ trait ConvertsExchangeRates
$entry['native_decimal_places'] = $native->decimal_places;
}
$return[] = $entry;
}
return $return;
}
@@ -267,5 +266,4 @@ trait ConvertsExchangeRates
{
$this->enabled = true;
}
}

View File

@@ -59,7 +59,7 @@ trait AugumentData
$combined = [];
/** @var Account $expenseAccount */
foreach ($accounts as $expenseAccount) {
$collection = new Collection;
$collection = new Collection();
$collection->push($expenseAccount);
$revenue = $repository->findByName($expenseAccount->name, [AccountType::REVENUE]);
@@ -200,7 +200,7 @@ trait AugumentData
/** @var BudgetLimitRepositoryInterface $blRepository */
$blRepository = app(BudgetLimitRepositoryInterface::class);
// properties for cache
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty($budget->id);
@@ -240,7 +240,6 @@ trait AugumentData
*/
protected function groupByName(array $array): array // filter + group data
{
// group by opposing account name.
$grouped = [];
/** @var array $journal */

View File

@@ -52,7 +52,6 @@ trait ChartGeneration
*/
protected function accountBalanceChart(Collection $accounts, Carbon $start, Carbon $end): array // chart helper method.
{
// chart properties for cache:
$cache = new CacheProperties();
$cache->addProperty($start);

View File

@@ -39,7 +39,6 @@ use phpseclib3\Crypt\RSA;
*/
trait CreateStuff
{
/**
* Creates an asset account.
*
@@ -61,7 +60,7 @@ trait CreateStuff
'active' => true,
'account_role' => 'defaultAsset',
'opening_balance' => $request->input('bank_balance'),
'opening_balance_date' => new Carbon,
'opening_balance_date' => new Carbon(),
'currency_id' => $currency->id,
];
@@ -120,7 +119,7 @@ trait CreateStuff
if (class_exists(LegacyRSA::class)) {
// PHP 7
Log::info('Will run PHP7 code.');
$keys = (new LegacyRSA)->createKey(4096);
$keys = (new LegacyRSA())->createKey(4096);
}
if (!class_exists(LegacyRSA::class)) {
@@ -158,7 +157,7 @@ trait CreateStuff
'active' => true,
'account_role' => 'savingAsset',
'opening_balance' => $request->input('savings_balance'),
'opening_balance_date' => new Carbon,
'opening_balance_date' => new Carbon(),
'currency_id' => $currency->id,
];
$repository->store($savingsAccount);
@@ -182,5 +181,4 @@ trait CreateStuff
]
);
}
}

View File

@@ -93,8 +93,5 @@ trait CronRunner
'job_errored' => $recurring->jobErrored,
'message' => $recurring->message,
];
}
}

View File

@@ -84,7 +84,6 @@ trait DateCalculation
*/
protected function calculateStep(Carbon $start, Carbon $end): string
{
$step = '1D';
$months = $start->diffInMonths($end);
if ($months > 3) {
@@ -167,5 +166,4 @@ trait DateCalculation
return $loop;
}
}

View File

@@ -140,26 +140,26 @@ trait GetConfigurationData
// last seven days:
$seven = Carbon::now()->subDays(7);
$index = (string) trans('firefly.last_seven_days');
$ranges[$index] = [$seven, new Carbon];
$ranges[$index] = [$seven, new Carbon()];
// last 30 days:
$thirty = Carbon::now()->subDays(30);
$index = (string) trans('firefly.last_thirty_days');
$ranges[$index] = [$thirty, new Carbon];
$ranges[$index] = [$thirty, new Carbon()];
// month to date:
$monthBegin = Carbon::now()->startOfMonth();
$index = (string) trans('firefly.month_to_date');
$ranges[$index] = [$monthBegin, new Carbon];
$ranges[$index] = [$monthBegin, new Carbon()];
// year to date:
$yearBegin = Carbon::now()->startOfYear();
$index = (string) trans('firefly.year_to_date');
$ranges[$index] = [$yearBegin, new Carbon];
$ranges[$index] = [$yearBegin, new Carbon()];
// everything
$index = (string) trans('firefly.everything');
$ranges[$index] = [$first, new Carbon];
$ranges[$index] = [$first, new Carbon()];
return [
'title' => $title,

View File

@@ -119,7 +119,6 @@ trait ModelInformation
$triggers = [];
foreach ($operators as $key => $operator) {
if ('user_action' !== $key && false === $operator['alias']) {
$triggers[$key] = (string) trans(sprintf('firefly.rule_trigger_%s_choice', $key));
}
}
@@ -146,7 +145,6 @@ trait ModelInformation
]
)->render();
} catch (Throwable $e) { // @phpstan-ignore-line
Log::debug(sprintf('Throwable was thrown in getTriggersForBill(): %s', $e->getMessage()));
Log::debug($e->getTraceAsString());
$string = '';
@@ -171,7 +169,6 @@ trait ModelInformation
$triggers = [];
foreach ($operators as $key => $operator) {
if ('user_action' !== $key && false === $operator['alias']) {
$triggers[$key] = (string) trans(sprintf('firefly.rule_trigger_%s_choice', $key));
}
}
@@ -262,7 +259,6 @@ trait ModelInformation
]
)->render();
} catch (Throwable $e) { // @phpstan-ignore-line
Log::debug(sprintf('Throwable was thrown in getTriggersForJournal(): %s', $e->getMessage()));
Log::debug($e->getTraceAsString());
$string = '';

View File

@@ -88,7 +88,7 @@ trait PeriodOverview
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
// properties for cache
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('account-show-period-entries');
@@ -252,12 +252,10 @@ trait PeriodOverview
'currency_symbol' => $journal['foreign_currency_symbol'],
'currency_decimal_places' => $journal['foreign_currency_decimal_places'],
];
}
$return[$foreignCurrencyId]['count']++;
$return[$foreignCurrencyId]['amount'] = bcadd($return[$foreignCurrencyId]['amount'], $journal['foreign_amount']);
}
}
return $return;
@@ -361,7 +359,7 @@ trait PeriodOverview
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('no-budget-period-entries');
@@ -415,7 +413,7 @@ trait PeriodOverview
Log::debug(sprintf('Now in getNoCategoryPeriodOverview(%s)', $theDate->format('Y-m-d')));
$range = app('preferences')->get('viewRange', '1M')->data;
$first = $this->journalRepos->firstNull();
$start = null === $first ? new Carbon : $first->date;
$start = null === $first ? new Carbon() : $first->date;
$end = $theDate ?? today(config('app.timezone'));
Log::debug(sprintf('Start for getNoCategoryPeriodOverview() is %s', $start->format('Y-m-d')));
@@ -484,12 +482,11 @@ trait PeriodOverview
*/
protected function getTagPeriodOverview(Tag $tag, Carbon $start, Carbon $end): array // period overview for tags.
{
$range = app('preferences')->get('viewRange', '1M')->data;
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
// properties for cache
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('tag-period-entries');
@@ -565,7 +562,7 @@ trait PeriodOverview
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
// properties for cache
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('transactions-period-entries');

View File

@@ -44,7 +44,6 @@ use Throwable;
*/
trait RenderPartialViews
{
/**
* View for transactions in a budget for an account.
*
@@ -114,7 +113,7 @@ trait RenderPartialViews
$budget = $budgetRepository->find((int) $attributes['budgetId']);
if (null === $budget) {
$budget = new Budget;
$budget = new Budget();
}
$journals = $popupHelper->byBudget($budget, $attributes);
@@ -276,7 +275,6 @@ trait RenderPartialViews
'count' => $count,
]
)->render();
} catch (Throwable $e) { // @phpstan-ignore-line
Log::debug(sprintf('Throwable was thrown in getCurrentActions(): %s', $e->getMessage()));
Log::error($e->getTraceAsString());
@@ -303,7 +301,6 @@ trait RenderPartialViews
$triggers = [];
foreach ($operators as $key => $operator) {
if ('user_action' !== $key && false === $operator['alias']) {
$triggers[$key] = (string) trans(sprintf('firefly.rule_trigger_%s_choice', $key));
}
}
@@ -318,7 +315,7 @@ trait RenderPartialViews
$count = ($index + 1);
try {
$rootOperator = OperatorQuerySearch::getRootOperator($entry->trigger_type);
if(str_starts_with($rootOperator, '-')) {
if (str_starts_with($rootOperator, '-')) {
$rootOperator = substr($rootOperator, 1);
}
$renderedEntries[] = view(
@@ -332,7 +329,6 @@ trait RenderPartialViews
'triggers' => $triggers,
]
)->render();
} catch (Throwable $e) { // @phpstan-ignore-line
Log::debug(sprintf('Throwable was thrown in getCurrentTriggers(): %s', $e->getMessage()));
Log::error($e->getTraceAsString());
@@ -384,7 +380,6 @@ trait RenderPartialViews
*/
protected function noReportOptions(): string // render a view
{
try {
$result = view('reports.options.no-options')->render();
} catch (Throwable $e) { // @phpstan-ignore-line

View File

@@ -228,5 +228,4 @@ trait RequestInformation
]
);
}
}

View File

@@ -35,7 +35,6 @@ use Throwable;
*/
trait RuleManagement
{
/**
* @param Request $request
*
@@ -83,7 +82,6 @@ trait RuleManagement
$triggers = [];
foreach ($operators as $key => $operator) {
if ('user_action' !== $key && false === $operator['alias']) {
$triggers[$key] = (string) trans(sprintf('firefly.rule_trigger_%s_choice', $key));
}
}
@@ -130,7 +128,6 @@ trait RuleManagement
$triggers = [];
foreach ($operators as $key => $operator) {
if ('user_action' !== $key && false === $operator['alias']) {
$triggers[$key] = (string) trans(sprintf('firefly.rule_trigger_%s_choice', $key));
}
}

View File

@@ -183,5 +183,4 @@ trait TransactionCalculation
return $collector->getExtractedJournals();
}
}

View File

@@ -39,7 +39,6 @@ use Log;
*/
trait UserNavigation
{
/**
* Functionality:.
*

View File

@@ -44,13 +44,12 @@ class AuditLogger
*/
public function __invoke(Logger $logger)
{
$processor = new AuditProcessor;
$processor = new AuditProcessor();
/** @var AbstractProcessingHandler $handler */
foreach ($logger->getHandlers() as $handler) {
$formatter = new LineFormatter("[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n");
$handler->setFormatter($formatter);
$handler->pushProcessor($processor);
}
}
}

View File

@@ -39,13 +39,13 @@ class AuditProcessor
public function __invoke(array $record): array
{
if (auth()->check()) {
$record['message'] = sprintf(
'AUDIT: %s (%s (%s) -> %s:%s)',
$record['message'],
app('request')->ip(),
auth()->user()->email,
request()->method(), request()->url()
request()->method(),
request()->url()
);
return $record;
@@ -55,7 +55,8 @@ class AuditProcessor
'AUDIT: %s (%s -> %s:%s)',
$record['message'],
app('request')->ip(),
request()->method(), request()->url()
request()->method(),
request()->url()
);
return $record;

View File

@@ -207,7 +207,6 @@ class Navigation
Log::error(sprintf('Cannot do startOfPeriod for $repeat_freq "%s"', $repeatFreq));
return $theDate;
}
/**
@@ -426,7 +425,6 @@ class Navigation
Log::error(sprintf('No date formats for frequency "%s"!', $repeatFrequency));
return $date->format('Y-m-d');
}
/**
@@ -585,10 +583,10 @@ class Navigation
switch ($repeatFreq) {
default:
break;
case 'last7';
case 'last7':
$date->subDays(7);
return $date;
case 'last30';
case 'last30':
$date->subDays(30);
return $date;
case 'last90':
@@ -658,8 +656,8 @@ class Navigation
switch ($range) {
default:
break;
case 'last7';
case 'last30';
case 'last7':
case 'last30':
case 'last90':
case 'last365':
case 'YTD':
@@ -715,10 +713,10 @@ class Navigation
switch ($range) {
default:
break;
case 'last7';
case 'last7':
$start->subDays(7);
return $start;
case 'last30';
case 'last30':
$start->subDays(30);
return $start;
case 'last90':

View File

@@ -95,7 +95,6 @@ class ParseDateString
// if + or -:
if (str_starts_with($date, '+') || str_starts_with($date, '-')) {
return $this->parseRelativeDate($date);
}
if ('xxxx-xx-xx' === strtolower($date)) {
@@ -204,7 +203,6 @@ class ParseDateString
Log::debug(sprintf('Will now do %s(%d) on %s', $func, $number, $today->format('Y-m-d')));
$today->$func($number);
Log::debug(sprintf('Resulting date is %s', $today->format('Y-m-d')));
}
return $today;
@@ -464,5 +462,4 @@ class ParseDateString
'month' => $parts[1],
];
}
}

View File

@@ -45,7 +45,7 @@ class Preferences
{
$user = auth()->user();
if (null === $user) {
return new Collection;
return new Collection();
}
return Preference::where('user_id', $user->id)->get();
@@ -139,7 +139,7 @@ class Preferences
/** @var User|null $user */
$user = auth()->user();
if (null === $user) {
$preference = new Preference;
$preference = new Preference();
$preference->data = $default;
return $preference;
@@ -183,7 +183,6 @@ class Preferences
}
if (null !== $preference) {
return $preference;
}
// no preference found and default is null:
@@ -217,13 +216,13 @@ class Preferences
throw new FireflyException(sprintf('Could not delete preference: %s', $e->getMessage()), 0, $e);
}
return new Preference;
return new Preference();
}
if (null === $value) {
return new Preference;
return new Preference();
}
if (null === $pref) {
$pref = new Preference;
$pref = new Preference();
$pref->user_id = $user->id;
$pref->name = $name;
}
@@ -269,7 +268,7 @@ class Preferences
/** @var User|null $user */
$user = auth()->user();
if (null === $user) {
$preference = new Preference;
$preference = new Preference();
$preference->data = $default;
return $preference;
@@ -299,7 +298,7 @@ class Preferences
$user = auth()->user();
if (null === $user) {
// make new preference, return it:
$pref = new Preference;
$pref = new Preference();
$pref->name = $name;
$pref->data = $value;

View File

@@ -69,7 +69,6 @@ class BudgetReportGenerator
*/
public function accountPerBudget(): void
{
$spent = $this->opsRepository->listExpenses($this->start, $this->end, $this->accounts, $this->budgets);
$this->report = [];
/** @var Account $account */
@@ -87,7 +86,6 @@ class BudgetReportGenerator
foreach ($spent as $currency) {
$this->processExpenses($currency);
}
}
/**
@@ -251,7 +249,6 @@ class BudgetReportGenerator
$noBudget = $this->nbRepository->sumExpenses($this->start, $this->end, $this->accounts);
foreach ($noBudget as $noBudgetEntry) {
// currency information:
$nbCurrencyId = (int) ($noBudgetEntry['currency_id'] ?? $this->currency->id);
$nbCurrencyCode = $noBudgetEntry['currency_code'] ?? $this->currency->code;

View File

@@ -210,5 +210,4 @@ class CategoryReportGenerator
$this->noCatRepository->setUser($user);
$this->opsRepository->setUser($user);
}
}

View File

@@ -32,7 +32,6 @@ use Illuminate\Support\Facades\Log;
*/
trait CalculateRangeOccurrences
{
/**
* Get the number of daily occurrences for a recurring transaction until date $end is reached. Will skip every $skipMod-1 occurrences.
*
@@ -185,7 +184,6 @@ trait CalculateRangeOccurrences
$return = [];
if ($start > $date) {
$date->addYear();
}
// is $date between $start and $end?
@@ -201,6 +199,5 @@ trait CalculateRangeOccurrences
}
return $return;
}
}

View File

@@ -31,7 +31,6 @@ use Carbon\Carbon;
*/
trait CalculateXOccurrences
{
/**
* Calculates the number of daily occurrences for a recurring transaction, starting at the date, until $count is reached. It will skip
* over $skipMod -1 recurrences.
@@ -210,6 +209,5 @@ trait CalculateXOccurrences
}
return $return;
}
}

View File

@@ -32,7 +32,6 @@ use Log;
*/
trait CalculateXOccurrencesSince
{
/**
* Calculates the number of daily occurrences for a recurring transaction, starting at the date, until $count is reached. It will skip
* over $skipMod -1 recurrences.
@@ -234,6 +233,5 @@ trait CalculateXOccurrencesSince
}
return $return;
}
}

View File

@@ -34,7 +34,6 @@ use Illuminate\Support\Facades\Log;
*/
trait FiltersWeekends
{
/**
* Filters out all weekend entries, if necessary.
*

View File

@@ -243,10 +243,9 @@ trait AppendsLocationData
null === $this->get($longitudeKey)
&& null === $this->get($latitudeKey)
&& null === $this->get($zoomLevelKey))
&& ('PUT' === $this->method()
&& (
'PUT' === $this->method()
|| ('POST' === $this->method() && $this->routeIs('*.update'))
);
}
}

View File

@@ -28,5 +28,4 @@ namespace FireflyIII\Support\Request;
*/
trait ConvertAPIDataTypes
{
}

View File

@@ -314,5 +314,4 @@ trait ConvertsDataTypes
return (int) $value;
}
}

View File

@@ -86,5 +86,4 @@ trait GetRecurrenceData
return $return;
}
}

View File

@@ -28,7 +28,6 @@ namespace FireflyIII\Support\Request;
*/
trait GetRuleConfiguration
{
/**
* @return array
*/

View File

@@ -59,7 +59,6 @@ class AccountSearch implements GenericSearchInterface
*/
public function search(): Collection
{
$searchQuery = $this->user->accounts()
->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id')
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
@@ -140,5 +139,4 @@ class AccountSearch implements GenericSearchInterface
{
$this->user = $user;
}
}

View File

@@ -35,5 +35,4 @@ interface GenericSearchInterface
* @return Collection
*/
public function search(): Collection;
}

View File

@@ -88,7 +88,7 @@ class OperatorQuerySearch implements SearchInterface
public function __construct()
{
Log::debug('Constructed OperatorQuerySearch');
$this->operators = new Collection;
$this->operators = new Collection();
$this->page = 1;
$this->words = [];
$this->prohibitedWords = [];
@@ -241,7 +241,6 @@ class OperatorQuerySearch implements SearchInterface
];
}
}
}
/**
@@ -475,7 +474,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'account_id':
$parts = explode(',', $value);
$collection = new Collection;
$collection = new Collection();
foreach ($parts as $accountId) {
$account = $this->accountRepository->find((int) $accountId);
if (null !== $account) {
@@ -491,7 +490,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-account_id':
$parts = explode(',', $value);
$collection = new Collection;
$collection = new Collection();
foreach ($parts as $accountId) {
$account = $this->accountRepository->find((int) $accountId);
if (null !== $account) {
@@ -1310,7 +1309,6 @@ class OperatorQuerySearch implements SearchInterface
case '-exists':
$this->collector->findNothing();
break;
}
return true;
}
@@ -1550,7 +1548,7 @@ class OperatorQuerySearch implements SearchInterface
*/
private function parseDateRange(string $value): array
{
$parser = new ParseDateString;
$parser = new ParseDateString();
if ($parser->isDateRange($value)) {
return $parser->parseRange($value);
}
@@ -2044,7 +2042,6 @@ class OperatorQuerySearch implements SearchInterface
$this->collector->withAccountInformation()->withCategoryInformation()->withBudgetInformation();
$this->setLimit((int) app('preferences')->getForUser($user, 'listPageSize', 50)->data);
}
/**

View File

@@ -43,7 +43,6 @@ use ValueError;
*/
class Steam
{
/**
* @param Account $account
* @param Carbon $date
@@ -53,7 +52,7 @@ class Steam
public function balanceIgnoreVirtual(Account $account, Carbon $date): string
{
// abuse chart properties:
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($account->id);
$cache->addProperty('balance-no-virtual');
$cache->addProperty($date);
@@ -124,7 +123,7 @@ class Steam
public function balanceInRange(Account $account, Carbon $start, Carbon $end, ?TransactionCurrency $currency = null): array
{
// abuse chart properties:
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($account->id);
$cache->addProperty('balance-in-range');
$cache->addProperty($currency ? $currency->id : 0);
@@ -210,7 +209,7 @@ class Steam
public function balance(Account $account, Carbon $date, ?TransactionCurrency $currency = null): string
{
// abuse chart properties:
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($account->id);
$cache->addProperty('balance');
$cache->addProperty($date);
@@ -259,7 +258,7 @@ class Steam
{
$ids = $accounts->pluck('id')->toArray();
// cache this property.
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($ids);
$cache->addProperty('balances');
$cache->addProperty($date);
@@ -292,7 +291,7 @@ class Steam
{
$ids = $accounts->pluck('id')->toArray();
// cache this property.
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($ids);
$cache->addProperty('balances-per-currency');
$cache->addProperty($date);
@@ -321,7 +320,7 @@ class Steam
public function balancePerCurrency(Account $account, Carbon $date): array
{
// abuse chart properties:
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($account->id);
$cache->addProperty('balance-per-currency');
$cache->addProperty($date);

View File

@@ -58,5 +58,4 @@ trait GeneratesInstallationId
app('fireflyconfig')->set('installation_id', $uniqueId);
}
}
}

View File

@@ -146,5 +146,4 @@ class OAuthKeys
file_put_contents($public, $publicContent);
return true;
}
}

View File

@@ -120,11 +120,10 @@ class AmountFormat extends AbstractExtension
{
return new TwigFunction(
'formatAmountBySymbol',
static function (string $amount, string $symbol, int $decimalPlaces = null, bool $coloured = null): string {
$decimalPlaces = $decimalPlaces ?? 2;
$coloured = $coloured ?? true;
$currency = new TransactionCurrency;
$currency = new TransactionCurrency();
$currency->symbol = $symbol;
$currency->decimal_places = $decimalPlaces;

View File

@@ -171,7 +171,6 @@ class General extends AbstractExtension
case 'application/vnd.oasis.opendocument.formula':
case 'application/vnd.oasis.opendocument.database':
return 'fa-calculator';
}
},
['is_safe' => ['html']]
@@ -186,7 +185,6 @@ class General extends AbstractExtension
return new TwigFilter(
'markdown',
static function (string $text): string {
$converter = new GithubFlavoredMarkdownConverter(
[
'allow_unsafe_links' => false,
@@ -196,7 +194,8 @@ class General extends AbstractExtension
);
return (string) $converter->convert($text);
}, ['is_safe' => ['html']]
},
['is_safe' => ['html']]
);
}

View File

@@ -112,7 +112,6 @@ class TransactionGroupTwig extends AbstractExtension
*/
private function signAmount(string $amount, string $transactionType, string $sourceType): string
{
// withdrawals stay negative
if ($transactionType !== TransactionType::WITHDRAWAL) {
$amount = bcmul($amount, '-1');

View File

@@ -57,7 +57,7 @@ class AppendDescriptionToNotes implements ActionInterface
}
$note = $object->notes()->first();
if (null === $note) {
$note = new Note;
$note = new Note();
$note->noteable()->associate($object);
$note->text = '';
}

Some files were not shown because too many files have changed in this diff Show More