Skip to content

Firefly III: a personal finances manager

Use PSR-12 code style

James Cole64ff5eed2727
diff --git a/app/Enums/AccountTypeEnum.php b/app/Enums/AccountTypeEnum.php
index 0660c87d41..e14aaf7d3c 100644
--- a/app/Enums/AccountTypeEnum.php
+++ b/app/Enums/AccountTypeEnum.php
@@ -43,5 +43,4 @@ enum AccountTypeEnum: string
case MORTGAGE = 'Mortgage';
case RECONCILIATION = 'Reconciliation account';
case REVENUE = 'Revenue account';
-
}
diff --git a/app/Enums/WebhookResponse.php b/app/Enums/WebhookResponse.php
index f420c52d61..ca7057f468 100644
--- a/app/Enums/WebhookResponse.php
+++ b/app/Enums/WebhookResponse.php
@@ -29,5 +29,4 @@ enum WebhookResponse: int
case TRANSACTIONS = 200;
case ACCOUNTS = 210;
case NONE = 220;
-
}
diff --git a/app/Events/RequestedReportOnJournals.php b/app/Events/RequestedReportOnJournals.php
index ac59c8f3a7..2c5f9d70c8 100644
--- a/app/Events/RequestedReportOnJournals.php
+++ b/app/Events/RequestedReportOnJournals.php
@@ -38,7 +38,9 @@ use Log;
*/
class RequestedReportOnJournals
{
- use Dispatchable, InteractsWithSockets, SerializesModels;
+ use Dispatchable;
+ use InteractsWithSockets;
+ use SerializesModels;
public Collection $groups;
public int $userId;
diff --git a/app/Events/StoredAccount.php b/app/Events/StoredAccount.php
index b8a77937b9..d126dd3468 100644
--- a/app/Events/StoredAccount.php
+++ b/app/Events/StoredAccount.php
@@ -45,5 +45,4 @@ class StoredAccount extends Event
{
$this->account = $account;
}
-
}
diff --git a/app/Events/TriggeredAuditLog.php b/app/Events/TriggeredAuditLog.php
index 3481d7e9fd..2b48559c24 100644
--- a/app/Events/TriggeredAuditLog.php
+++ b/app/Events/TriggeredAuditLog.php
@@ -31,7 +31,6 @@ use Illuminate\Queue\SerializesModels;
* Class TriggeredAuditLog
*/
class TriggeredAuditLog extends Event
-
{
use SerializesModels;
@@ -52,5 +51,4 @@ class TriggeredAuditLog extends Event
$this->before = $before;
$this->after = $after;
}
-
}
diff --git a/app/Events/UpdatedAccount.php b/app/Events/UpdatedAccount.php
index a71e50b357..66640720b2 100644
--- a/app/Events/UpdatedAccount.php
+++ b/app/Events/UpdatedAccount.php
@@ -22,7 +22,6 @@
declare(strict_types=1);
-
namespace FireflyIII\Events;
use FireflyIII\Models\Account;
@@ -46,5 +45,4 @@ class UpdatedAccount extends Event
{
$this->account = $account;
}
-
}
diff --git a/app/Exceptions/GracefulNotFoundHandler.php b/app/Exceptions/GracefulNotFoundHandler.php
index 92edf65763..126d565d69 100644
--- a/app/Exceptions/GracefulNotFoundHandler.php
+++ b/app/Exceptions/GracefulNotFoundHandler.php
@@ -132,7 +132,6 @@ class GracefulNotFoundHandler extends ExceptionHandler
return parent::render($request, $e);
}
-
}
/**
@@ -200,7 +199,6 @@ class GracefulNotFoundHandler extends ExceptionHandler
}
return redirect(route('transactions.index', [strtolower($type)]));
-
}
/**
@@ -232,7 +230,6 @@ class GracefulNotFoundHandler extends ExceptionHandler
if (null !== $journal) {
return redirect(route('transactions.show', [$journal->transaction_group_id]));
}
-
}
if (Bill::class === $attachment->attachable_type) {
// is linked to bill.
@@ -247,5 +244,4 @@ class GracefulNotFoundHandler extends ExceptionHandler
return parent::render($request, $exception);
}
-
}
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php
index e7e8a09bde..931aac41ef 100644
--- a/app/Exceptions/Handler.php
+++ b/app/Exceptions/Handler.php
@@ -96,7 +96,7 @@ class Handler extends ExceptionHandler
// somehow Laravel handler does not catch this:
return response()->json(['message' => $e->getMessage(), 'exception' => 'OAuthServerException'], 401);
}
- if($e instanceof BadRequestHttpException) {
+ if ($e instanceof BadRequestHttpException) {
return response()->json(['message' => $e->getMessage(), 'exception' => 'BadRequestHttpException'], 400);
}
@@ -107,7 +107,7 @@ class Handler extends ExceptionHandler
if ($request->expectsJson()) {
$errorCode = 500;
- $errorCode = $e instanceof MethodNotAllowedHttpException ? 405: $errorCode;
+ $errorCode = $e instanceof MethodNotAllowedHttpException ? 405 : $errorCode;
$isDebug = config('app.debug', false);
if ($isDebug) {
@@ -140,7 +140,7 @@ class Handler extends ExceptionHandler
return response()->view('errors.FireflyException', ['exception' => $e, 'debug' => $isDebug], 500);
}
// special view for database errors with extra instructions
- if($e instanceof QueryException) {
+ if ($e instanceof QueryException) {
$isDebug = config('app.debug');
return response()->view('errors.DatabaseException', ['exception' => $e, 'debug' => $isDebug], 500);
@@ -215,9 +215,10 @@ class Handler extends ExceptionHandler
{
return !is_null(
Arr::first(
- $this->dontReport, function ($type) use ($e) {
- return $e instanceof $type;
- }
+ $this->dontReport,
+ function ($type) use ($e) {
+ return $e instanceof $type;
+ }
)
);
}
diff --git a/app/Factory/AccountFactory.php b/app/Factory/AccountFactory.php
index 4a67a1d87c..f547ab4afd 100644
--- a/app/Factory/AccountFactory.php
+++ b/app/Factory/AccountFactory.php
@@ -43,7 +43,8 @@ use Log;
*/
class AccountFactory
{
- use AccountServiceTrait, LocationServiceTrait;
+ use AccountServiceTrait;
+ use LocationServiceTrait;
protected AccountRepositoryInterface $accountRepository;
protected array $validAssetFields;
@@ -279,7 +280,6 @@ class AccountFactory
*/
private function storeMetaData(Account $account, array $data): void
{
-
$fields = $this->validFields;
if ($account->accountType->type === AccountType::ASSET) {
$fields = $this->validAssetFields;
@@ -292,7 +292,7 @@ class AccountFactory
$type = $account->accountType->type;
$list = config('firefly.valid_currency_account_types');
if (!in_array($type, $list, true)) {
- $pos = array_search('currency_id', $fields);
+ $pos = array_search('currency_id', $fields, true);
if ($pos !== false) {
unset($fields[$pos]);
}
@@ -399,6 +399,4 @@ class AccountFactory
$this->user = $user;
$this->accountRepository->setUser($user);
}
-
-
}
diff --git a/app/Factory/AccountMetaFactory.php b/app/Factory/AccountMetaFactory.php
index 9c48b74b82..5e92d1ae10 100644
--- a/app/Factory/AccountMetaFactory.php
+++ b/app/Factory/AccountMetaFactory.php
@@ -49,7 +49,6 @@ class AccountMetaFactory
$entry = $account->accountMeta()->where('name', $field)->first();
// must not be an empty string:
if ('' !== $value) {
-
// if $data has field and $entry is null, create new one:
if (null === $entry) {
Log::debug(sprintf('Created meta-field "%s":"%s" for account #%d ("%s") ', $field, $value, $account->id, $account->name));
@@ -84,5 +83,4 @@ class AccountMetaFactory
{
return AccountMeta::create($data);
}
-
}
diff --git a/app/Factory/AttachmentFactory.php b/app/Factory/AttachmentFactory.php
index 96bbd1d55d..4f1a36c2d8 100644
--- a/app/Factory/AttachmentFactory.php
+++ b/app/Factory/AttachmentFactory.php
@@ -77,7 +77,7 @@ class AttachmentFactory
);
$notes = (string) ($data['notes'] ?? '');
if ('' !== $notes) {
- $note = new Note;
+ $note = new Note();
$note->noteable()->associate($attachment);
$note->text = $notes;
$note->save();
@@ -93,5 +93,4 @@ class AttachmentFactory
{
$this->user = $user;
}
-
}
diff --git a/app/Factory/BillFactory.php b/app/Factory/BillFactory.php
index 96ea82bd50..461e470443 100644
--- a/app/Factory/BillFactory.php
+++ b/app/Factory/BillFactory.php
@@ -37,7 +37,8 @@ use Log;
*/
class BillFactory
{
- use BillServiceTrait, CreatesObjectGroups;
+ use BillServiceTrait;
+ use CreatesObjectGroups;
private User $user;
@@ -129,7 +130,6 @@ class BillFactory
}
return $bill;
-
}
/**
@@ -149,5 +149,4 @@ class BillFactory
{
$this->user = $user;
}
-
}
diff --git a/app/Factory/BudgetFactory.php b/app/Factory/BudgetFactory.php
index c052619988..281e0bedd7 100644
--- a/app/Factory/BudgetFactory.php
+++ b/app/Factory/BudgetFactory.php
@@ -83,5 +83,4 @@ class BudgetFactory
{
$this->user = $user;
}
-
}
diff --git a/app/Factory/CategoryFactory.php b/app/Factory/CategoryFactory.php
index 5b5b41c97c..e7a5bd6758 100644
--- a/app/Factory/CategoryFactory.php
+++ b/app/Factory/CategoryFactory.php
@@ -99,5 +99,4 @@ class CategoryFactory
{
$this->user = $user;
}
-
}
diff --git a/app/Factory/PiggyBankFactory.php b/app/Factory/PiggyBankFactory.php
index 2b7301dbe5..26bf527cfb 100644
--- a/app/Factory/PiggyBankFactory.php
+++ b/app/Factory/PiggyBankFactory.php
@@ -64,7 +64,6 @@ class PiggyBankFactory
}
return null;
-
}
/**
@@ -83,7 +82,5 @@ class PiggyBankFactory
public function setUser(User $user): void
{
$this->user = $user;
-
}
-
}
diff --git a/app/Factory/RecurrenceFactory.php b/app/Factory/RecurrenceFactory.php
index 8849ee7ec4..990aeb1759 100644
--- a/app/Factory/RecurrenceFactory.php
+++ b/app/Factory/RecurrenceFactory.php
@@ -37,8 +37,8 @@ use Log;
*/
class RecurrenceFactory
{
-
- use TransactionTypeTrait, RecurringTransactionTrait;
+ use TransactionTypeTrait;
+ use RecurringTransactionTrait;
private MessageBag $errors;
private User $user;
@@ -50,7 +50,7 @@ class RecurrenceFactory
*/
public function __construct()
{
- $this->errors = new MessageBag;
+ $this->errors = new MessageBag();
}
/**
@@ -120,20 +120,17 @@ class RecurrenceFactory
if (array_key_exists('notes', $data['recurrence'])) {
$this->updateNote($recurrence, (string) $data['recurrence']['notes']);
-
}
$this->createRepetitions($recurrence, $data['repetitions'] ?? []);
try {
$this->createTransactions($recurrence, $data['transactions'] ?? []);
-
} catch (FireflyException $e) {
Log::error($e->getMessage());
$recurrence->forceDelete();
$message = sprintf('Could not create recurring transaction: %s', $e->getMessage());
$this->errors->add('store', $message);
throw new FireflyException($message, 0, $e);
-
}
@@ -155,6 +152,4 @@ class RecurrenceFactory
{
$this->user = $user;
}
-
-
}
diff --git a/app/Factory/TagFactory.php b/app/Factory/TagFactory.php
index de028db2f6..db32fd4316 100644
--- a/app/Factory/TagFactory.php
+++ b/app/Factory/TagFactory.php
@@ -95,7 +95,7 @@ class TagFactory
$tag = Tag::create($array);
if (null !== $tag && null !== $latitude && null !== $longitude) {
// create location object.
- $location = new Location;
+ $location = new Location();
$location->latitude = $latitude;
$location->longitude = $longitude;
$location->zoom_level = $zoomLevel;
@@ -113,5 +113,4 @@ class TagFactory
{
$this->user = $user;
}
-
}
diff --git a/app/Factory/TransactionFactory.php b/app/Factory/TransactionFactory.php
index bc8f9ad0c6..8225cd451f 100644
--- a/app/Factory/TransactionFactory.php
+++ b/app/Factory/TransactionFactory.php
@@ -102,7 +102,6 @@ class TransactionFactory
];
try {
$result = Transaction::create($data);
-
} catch (QueryException $e) {
Log::error(sprintf('Could not create transaction: %s', $e->getMessage()), $data);
Log::error($e->getMessage());
diff --git a/app/Factory/TransactionGroupFactory.php b/app/Factory/TransactionGroupFactory.php
index dae181b197..75790d36cf 100644
--- a/app/Factory/TransactionGroupFactory.php
+++ b/app/Factory/TransactionGroupFactory.php
@@ -78,7 +78,7 @@ class TransactionGroupFactory
throw new FireflyException('Created zero transaction journals.');
}
- $group = new TransactionGroup;
+ $group = new TransactionGroup();
$group->user()->associate($this->user);
$group->title = $title;
$group->save();
diff --git a/app/Factory/TransactionJournalFactory.php b/app/Factory/TransactionJournalFactory.php
index c37375e8ab..b77a646249 100644
--- a/app/Factory/TransactionJournalFactory.php
+++ b/app/Factory/TransactionJournalFactory.php
@@ -106,12 +106,12 @@ class TransactionJournalFactory
$dataObject = new NullArrayObject($data);
Log::debug('Start of TransactionJournalFactory::create()');
- $collection = new Collection;
+ $collection = new Collection();
$transactions = $dataObject['transactions'] ?? [];
if (empty($transactions)) {
Log::error('There are no transactions in the array, the TransactionJournalFactory cannot continue.');
- return new Collection;
+ return new Collection();
}
try {
/** @var array $row */
@@ -312,10 +312,8 @@ class TransactionJournalFactory
unset($dataRow['import_hash_v2'], $dataRow['original_source']);
$json = json_encode($dataRow, JSON_THROW_ON_ERROR);
if (false === $json) {
-
$json = json_encode((string) microtime(), JSON_THROW_ON_ERROR);
Log::error(sprintf('Could not hash the original row! %s', json_last_error_msg()), $dataRow);
-
}
$hash = hash('sha256', $json);
Log::debug(sprintf('The hash is: %s', $hash), $dataRow);
diff --git a/app/Factory/TransactionJournalMetaFactory.php b/app/Factory/TransactionJournalMetaFactory.php
index 6bc1f23878..4bcb5b36ca 100644
--- a/app/Factory/TransactionJournalMetaFactory.php
+++ b/app/Factory/TransactionJournalMetaFactory.php
@@ -87,5 +87,4 @@ class TransactionJournalMetaFactory
return $entry;
}
-
}
diff --git a/app/Factory/TransactionTypeFactory.php b/app/Factory/TransactionTypeFactory.php
index 4a95c67a0b..64294ef1ee 100644
--- a/app/Factory/TransactionTypeFactory.php
+++ b/app/Factory/TransactionTypeFactory.php
@@ -40,5 +40,4 @@ class TransactionTypeFactory
{
return TransactionType::whereType(ucfirst($type))->first();
}
-
}
diff --git a/app/Generator/Report/Audit/MonthReportGenerator.php b/app/Generator/Report/Audit/MonthReportGenerator.php
index 7af6f426ca..4ad3090221 100644
--- a/app/Generator/Report/Audit/MonthReportGenerator.php
+++ b/app/Generator/Report/Audit/MonthReportGenerator.php
@@ -104,76 +104,75 @@ class MonthReportGenerator implements ReportGeneratorInterface
*/
#[ArrayShape(['journals' => "array", 'currency' => "mixed", 'exists' => "bool", 'end' => "string", 'endBalance' => "mixed", 'dayBefore' => "string",
'dayBeforeBalance' => "mixed"])] public function getAuditReport(Account $account, Carbon $date): array
- {
- /** @var AccountRepositoryInterface $accountRepository */
- $accountRepository = app(AccountRepositoryInterface::class);
- $accountRepository->setUser($account->user);
-
- /** @var JournalRepositoryInterface $journalRepository */
- $journalRepository = app(JournalRepositoryInterface::class);
- $journalRepository->setUser($account->user);
+ {
+ /** @var AccountRepositoryInterface $accountRepository */
+ $accountRepository = app(AccountRepositoryInterface::class);
+ $accountRepository->setUser($account->user);
- /** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
- $collector->setAccounts(new Collection([$account]))->setRange($this->start, $this->end)->withAccountInformation()
- ->withBudgetInformation()->withCategoryInformation()->withBillInformation();
- $journals = $collector->getExtractedJournals();
- $journals = array_reverse($journals, true);
- $dayBeforeBalance = app('steam')->balance($account, $date);
- $startBalance = $dayBeforeBalance;
- $defaultCurrency = app('amount')->getDefaultCurrencyByUser($account->user);
- $currency = $accountRepository->getAccountCurrency($account) ?? $defaultCurrency;
+ /** @var JournalRepositoryInterface $journalRepository */
+ $journalRepository = app(JournalRepositoryInterface::class);
+ $journalRepository->setUser($account->user);
- foreach ($journals as $index => $journal) {
- $journals[$index]['balance_before'] = $startBalance;
- $transactionAmount = $journal['amount'];
+ /** @var GroupCollectorInterface $collector */
+ $collector = app(GroupCollectorInterface::class);
+ $collector->setAccounts(new Collection([$account]))->setRange($this->start, $this->end)->withAccountInformation()
+ ->withBudgetInformation()->withCategoryInformation()->withBillInformation();
+ $journals = $collector->getExtractedJournals();
+ $journals = array_reverse($journals, true);
+ $dayBeforeBalance = app('steam')->balance($account, $date);
+ $startBalance = $dayBeforeBalance;
+ $defaultCurrency = app('amount')->getDefaultCurrencyByUser($account->user);
+ $currency = $accountRepository->getAccountCurrency($account) ?? $defaultCurrency;
- // make sure amount is in the right "direction".
- if ($account->id === $journal['destination_account_id']) {
- $transactionAmount = app('steam')->positive($journal['amount']);
- }
+ foreach ($journals as $index => $journal) {
+ $journals[$index]['balance_before'] = $startBalance;
+ $transactionAmount = $journal['amount'];
- if ($currency->id === $journal['foreign_currency_id']) {
- $transactionAmount = $journal['foreign_amount'];
- if ($account->id === $journal['destination_account_id']) {
- $transactionAmount = app('steam')->positive($journal['foreign_amount']);
- }
- }
+ // make sure amount is in the right "direction".
+ if ($account->id === $journal['destination_account_id']) {
+ $transactionAmount = app('steam')->positive($journal['amount']);
+ }
- $newBalance = bcadd($startBalance, $transactionAmount);
- $journals[$index]['balance_after'] = $newBalance;
- $startBalance = $newBalance;
+ if ($currency->id === $journal['foreign_currency_id']) {
+ $transactionAmount = $journal['foreign_amount'];
+ if ($account->id === $journal['destination_account_id']) {
+ $transactionAmount = app('steam')->positive($journal['foreign_amount']);
+ }
+ }
- // add meta dates for each journal.
- $journals[$index]['interest_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'interest_date');
- $journals[$index]['book_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'book_date');
- $journals[$index]['process_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'process_date');
- $journals[$index]['due_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'due_date');
- $journals[$index]['payment_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'payment_date');
- $journals[$index]['invoice_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'invoice_date');
+ $newBalance = bcadd($startBalance, $transactionAmount);
+ $journals[$index]['balance_after'] = $newBalance;
+ $startBalance = $newBalance;
- }
- $locale = app('steam')->getLocale();
+ // add meta dates for each journal.
+ $journals[$index]['interest_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'interest_date');
+ $journals[$index]['book_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'book_date');
+ $journals[$index]['process_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'process_date');
+ $journals[$index]['due_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'due_date');
+ $journals[$index]['payment_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'payment_date');
+ $journals[$index]['invoice_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'invoice_date');
+ }
+ $locale = app('steam')->getLocale();
- return [
- 'journals' => $journals,
- 'currency' => $currency,
- 'exists' => !empty($journals),
- 'end' => $this->end->isoFormat((string) trans('config.month_and_day_moment_js', [], $locale)),
- 'endBalance' => app('steam')->balance($account, $this->end),
- 'dayBefore' => $date->isoFormat((string) trans('config.month_and_day_moment_js', [], $locale)),
- 'dayBeforeBalance' => $dayBeforeBalance,
- ];
- }
+ return [
+ 'journals' => $journals,
+ 'currency' => $currency,
+ 'exists' => !empty($journals),
+ 'end' => $this->end->isoFormat((string) trans('config.month_and_day_moment_js', [], $locale)),
+ 'endBalance' => app('steam')->balance($account, $this->end),
+ 'dayBefore' => $date->isoFormat((string) trans('config.month_and_day_moment_js', [], $locale)),
+ 'dayBeforeBalance' => $dayBeforeBalance,
+ ];
+ }
/**
- * Account collection setter.
- *
- * @param Collection $accounts
- *
- * @return ReportGeneratorInterface
- * @codeCoverageIgnore
- */
+ * Account collection setter.
+ *
+ * @param Collection $accounts
+ *
+ * @return ReportGeneratorInterface
+ * @codeCoverageIgnore
+ */
public function setAccounts(Collection $accounts): ReportGeneratorInterface
{
$this->accounts = $accounts;
diff --git a/app/Generator/Report/Category/MonthReportGenerator.php b/app/Generator/Report/Category/MonthReportGenerator.php
index 81e8273cbf..fb0c5a3cba 100644
--- a/app/Generator/Report/Category/MonthReportGenerator.php
+++ b/app/Generator/Report/Category/MonthReportGenerator.php
@@ -58,8 +58,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
*/
#[Pure] public function __construct()
{
- $this->income = new Collection;
- $this->expenses = new Collection;
+ $this->income = new Collection();
+ $this->expenses = new Collection();
}
/**
diff --git a/app/Generator/Report/Tag/MonthReportGenerator.php b/app/Generator/Report/Tag/MonthReportGenerator.php
index 57f5b83675..c7cfa7b563 100644
--- a/app/Generator/Report/Tag/MonthReportGenerator.php
+++ b/app/Generator/Report/Tag/MonthReportGenerator.php
@@ -56,9 +56,9 @@ class MonthReportGenerator implements ReportGeneratorInterface
*/
#[Pure] public function __construct()
{
- $this->expenses = new Collection;
- $this->income = new Collection;
- $this->tags = new Collection;
+ $this->expenses = new Collection();
+ $this->income = new Collection();
+ $this->tags = new Collection();
}
/**
diff --git a/app/Generator/Webhook/MessageGeneratorInterface.php b/app/Generator/Webhook/MessageGeneratorInterface.php
index 066a203fa1..9a76cbd20a 100644
--- a/app/Generator/Webhook/MessageGeneratorInterface.php
+++ b/app/Generator/Webhook/MessageGeneratorInterface.php
@@ -31,7 +31,6 @@ use Illuminate\Support\Collection;
*/
interface MessageGeneratorInterface
{
-
/**
*
*/
diff --git a/app/Generator/Webhook/StandardMessageGenerator.php b/app/Generator/Webhook/StandardMessageGenerator.php
index 6741af7826..702d672fe8 100644
--- a/app/Generator/Webhook/StandardMessageGenerator.php
+++ b/app/Generator/Webhook/StandardMessageGenerator.php
@@ -147,7 +147,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
$basicMessage['content'] = [];
break;
case WebhookResponse::TRANSACTIONS->value:
- $transformer = new TransactionGroupTransformer;
+ $transformer = new TransactionGroupTransformer();
try {
$basicMessage['content'] = $transformer->transformObject($model);
} catch (FireflyException $e) {
@@ -161,8 +161,8 @@ class StandardMessageGenerator implements MessageGeneratorInterface
case WebhookResponse::ACCOUNTS->value:
$accounts = $this->collectAccounts($model);
foreach ($accounts as $account) {
- $transformer = new AccountTransformer;
- $transformer->setParameters(new ParameterBag);
+ $transformer = new AccountTransformer();
+ $transformer->setParameters(new ParameterBag());
$basicMessage['content'][] = $transformer->transform($account);
}
}
@@ -184,7 +184,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
*/
private function collectAccounts(TransactionGroup $transactionGroup): Collection
{
- $accounts = new Collection;
+ $accounts = new Collection();
/** @var TransactionJournal $journal */
foreach ($transactionGroup->transactionJournals as $journal) {
/** @var Transaction $transaction */
@@ -204,7 +204,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
*/
private function storeMessage(Webhook $webhook, array $message): void
{
- $webhookMessage = new WebhookMessage;
+ $webhookMessage = new WebhookMessage();
$webhookMessage->webhook()->associate($webhook);
$webhookMessage->sent = false;
$webhookMessage->errored = false;
@@ -212,7 +212,6 @@ class StandardMessageGenerator implements MessageGeneratorInterface
$webhookMessage->message = $message;
$webhookMessage->save();
Log::debug(sprintf('Stored new webhook message #%d', $webhookMessage->id));
-
}
/**
diff --git a/app/User.php b/app/User.php
index 2479143db7..91589f7ada 100644
--- a/app/User.php
+++ b/app/User.php
@@ -165,7 +165,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
*/
class User extends Authenticatable
{
- use Notifiable, HasApiTokens;
+ use Notifiable;
+ use HasApiTokens;
/**
* The attributes that should be cast to native types.
@@ -212,7 +213,7 @@ class User extends Authenticatable
return $user;
}
}
- throw new NotFoundHttpException;
+ throw new NotFoundHttpException();
}
/**
@@ -537,7 +538,7 @@ class User extends Authenticatable
*/
public function userGroup(): BelongsTo
{
- return $this->belongsTo(UserGroup::class,);
+ return $this->belongsTo(UserGroup::class, );
}
/**
@@ -605,5 +606,4 @@ class User extends Authenticatable
}
return app('preferences')->getForUser($this, 'slack_webhook_url', '')->data;
}
-
}