Use PSR-12 code style

This commit is contained in:
James Cole
2022-10-30 14:24:28 +01:00
parent 2eebcb21f1
commit f53923f16c
187 changed files with 429 additions and 482 deletions

View File

@@ -43,7 +43,10 @@ use Log;
*/
class CreateAutoBudgetLimits implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Dispatchable;
use InteractsWithQueue;
use Queueable;
use SerializesModels;
private Carbon $date;
@@ -222,7 +225,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
if (null !== $amount) {
Log::debug(sprintf('Amount is overruled and will be set to %s', $amount));
}
$budgetLimit = new BudgetLimit;
$budgetLimit = new BudgetLimit();
$budgetLimit->budget()->associate($autoBudget->budget);
$budgetLimit->transactionCurrency()->associate($autoBudget->transactionCurrency);
$budgetLimit->start_date = $start;

View File

@@ -50,7 +50,10 @@ use Log;
*/
class CreateRecurringTransactions implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Dispatchable;
use InteractsWithQueue;
use Queueable;
use SerializesModels;
public int $created;
public int $executed;
@@ -76,7 +79,7 @@ class CreateRecurringTransactions implements ShouldQueue
$this->date = $newDate;
}
if (null === $date) {
$newDate = new Carbon;
$newDate = new Carbon();
$newDate->startOfDay();
$this->date = $newDate;
}
@@ -109,7 +112,7 @@ class CreateRecurringTransactions implements ShouldQueue
/** @var Recurrence $recurrence */
foreach ($filtered as $recurrence) {
if (!array_key_exists($recurrence->user_id, $result)) {
$result[$recurrence->user_id] = new Collection;
$result[$recurrence->user_id] = new Collection();
}
$this->repository->setUser($recurrence->user);
$this->journalRepository->setUser($recurrence->user);
@@ -296,7 +299,7 @@ class CreateRecurringTransactions implements ShouldQueue
*/
private function handleRepetitions(Recurrence $recurrence): Collection
{
$collection = new Collection;
$collection = new Collection();
/** @var RecurrenceRepetition $repetition */
foreach ($recurrence->recurrenceRepetitions as $repetition) {
Log::debug(
@@ -336,7 +339,7 @@ class CreateRecurringTransactions implements ShouldQueue
*/
private function handleOccurrences(Recurrence $recurrence, RecurrenceRepetition $repetition, array $occurrences): Collection
{
$collection = new Collection;
$collection = new Collection();
/** @var Carbon $date */
foreach ($occurrences as $date) {
$result = $this->handleOccurrence($recurrence, $repetition, $date);
@@ -361,7 +364,6 @@ class CreateRecurringTransactions implements ShouldQueue
{
$date->startOfDay();
if ($date->ne($this->date)) {
return null;
}
Log::debug(sprintf('%s IS today (%s)', $date->format('Y-m-d'), $this->date->format('Y-m-d')));
@@ -386,9 +388,8 @@ class CreateRecurringTransactions implements ShouldQueue
$first = $recurrence->recurrenceTransactions()->first();
$groupTitle = $first->description;
}
if(0 === $count) {
if (0 === $count) {
Log::error('No transactions to be created in this recurrence. Cannot continue.');
return null;

View File

@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Jobs;
use Carbon\Carbon;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
@@ -43,7 +42,10 @@ use Log;
*/
class DownloadExchangeRates implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Dispatchable;
use InteractsWithQueue;
use Queueable;
use SerializesModels;
private Carbon $date;
private CurrencyRepositoryInterface $repository;
@@ -107,7 +109,7 @@ class DownloadExchangeRates implements ShouldQueue
{
Log::debug(sprintf('Now downloading new exchange rates for currency %s.', $currency->code));
$base = sprintf('%s/%s/%s', (string) config('cer.url'), $this->date->year, $this->date->isoWeek);
$client = new Client;
$client = new Client();
$url = sprintf('%s/%s.json', $base, $currency->code);
$res = $client->get($url);
$statusCode = $res->getStatusCode();

View File

@@ -37,7 +37,8 @@ use Mail;
*/
class MailError extends Job implements ShouldQueue
{
use InteractsWithQueue, SerializesModels;
use InteractsWithQueue;
use SerializesModels;
protected string $destination;
protected array $exception;

View File

@@ -38,7 +38,10 @@ use Log;
*/
class SendWebhookMessage implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Dispatchable;
use InteractsWithQueue;
use Queueable;
use SerializesModels;
private WebhookMessage $message;

View File

@@ -39,7 +39,10 @@ use Log;
*/
class WarnAboutBills implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Dispatchable;
use InteractsWithQueue;
use Queueable;
use SerializesModels;
private Carbon $date;
private bool $force;
@@ -53,7 +56,7 @@ class WarnAboutBills implements ShouldQueue
*/
public function __construct(?Carbon $date)
{
$newDate = new Carbon;
$newDate = new Carbon();
$newDate->startOfDay();
$this->date = $newDate;