Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix various code things.
James Cole688f50ee3ffe
diff --git a/.ci/php-cs-fixer/composer.lock b/.ci/php-cs-fixer/composer.lockindex 0e28dfb1d6..cb9e3f8cad 100644--- a/.ci/php-cs-fixer/composer.lock+++ b/.ci/php-cs-fixer/composer.lock@@ -1836,5 +1836,5 @@"prefer-lowest": false,"platform": [],"platform-dev": [],- "plugin-api-version": "2.3.0"+ "plugin-api-version": "2.6.0"}diff --git a/app/Models/Recurrence.php b/app/Models/Recurrence.phpindex d63c762438..4c312ea3ff 100644--- a/app/Models/Recurrence.php+++ b/app/Models/Recurrence.php@@ -49,7 +49,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;* @property Carbon|null $first_date* @property Carbon|null $repeat_until* @property Carbon|null $latest_date- * @property int $repetitions+ * @property int|string $repetitions* @property bool $apply_rules* @property bool $active* @property-read Collection|Attachment[] $attachmentsdiff --git a/app/Models/RecurrenceRepetition.php b/app/Models/RecurrenceRepetition.phpindex 5663a69b26..5801a65c00 100644--- a/app/Models/RecurrenceRepetition.php+++ b/app/Models/RecurrenceRepetition.php@@ -40,8 +40,8 @@ use Carbon\Carbon;* @property int|string $recurrence_id* @property string $repetition_type* @property string $repetition_moment- * @property int $repetition_skip- * @property int $weekend+ * @property int|string $repetition_skip+ * @property int|string $weekend* @property-read Recurrence $recurrence* @method static \Illuminate\Database\Eloquent\Builder|RecurrenceRepetition newModelQuery()* @method static \Illuminate\Database\Eloquent\Builder|RecurrenceRepetition newQuery()diff --git a/app/Models/RecurrenceTransaction.php b/app/Models/RecurrenceTransaction.phpindex 3280e49a54..9c0ea007d7 100644--- a/app/Models/RecurrenceTransaction.php+++ b/app/Models/RecurrenceTransaction.php@@ -42,7 +42,7 @@ use Carbon\Carbon;* @property Carbon|null $deleted_at* @property int|string $recurrence_id* @property int|string $transaction_currency_id- * @property int|null $foreign_currency_id+ * @property int|string|null $foreign_currency_id* @property int|string $source_id* @property int|string $destination_id* @property string|float $amountdiff --git a/app/Models/RuleGroup.php b/app/Models/RuleGroup.phpindex 4ceebae0ca..35d7faeecb 100644--- a/app/Models/RuleGroup.php+++ b/app/Models/RuleGroup.php@@ -42,7 +42,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;* @property Carbon|null $updated_at* @property Carbon|null $deleted_at* @property int|string $user_id- * @property string $title+ * @property string|null $title* @property string|null $description* @property int $order* @property bool $activediff --git a/app/Models/TransactionCurrency.php b/app/Models/TransactionCurrency.phpindex 2379dcdf76..1565bee62a 100644--- a/app/Models/TransactionCurrency.php+++ b/app/Models/TransactionCurrency.php@@ -37,7 +37,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/*** FireflyIII\Models\TransactionCurrency*- * @property int|string $id+ * @property int|string $id* @property Carbon|null $created_at* @property Carbon|null $updated_at* @property Carbon|null $deleted_at@@ -47,7 +47,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;* @property string $code* @property string $name* @property string $symbol- * @property int|string $decimal_places+ * @property int|string $decimal_places* @property-read Collection|BudgetLimit[] $budgetLimits* @property-read int|null $budget_limits_count* @property-read Collection|TransactionJournal[] $transactionJournals@@ -79,6 +79,9 @@ class TransactionCurrency extends Model{use SoftDeletes;+ public bool $userEnabled;+ public bool $userDefault;+/*** The attributes that should be casted to native types.*diff --git a/app/Models/TransactionJournalMeta.php b/app/Models/TransactionJournalMeta.phpindex 0b3e9ec571..16a7d53812 100644--- a/app/Models/TransactionJournalMeta.php+++ b/app/Models/TransactionJournalMeta.php@@ -36,7 +36,7 @@ use Carbon\Carbon;* @property int|string $id* @property Carbon|null $created_at* @property Carbon|null $updated_at- * @property int $transaction_journal_id+ * @property int|string $transaction_journal_id* @property string $name* @property mixed $data* @property string $hashdiff --git a/app/Models/WebhookAttempt.php b/app/Models/WebhookAttempt.phpindex 8ebef89a64..810a5a0094 100644--- a/app/Models/WebhookAttempt.php+++ b/app/Models/WebhookAttempt.php@@ -40,7 +40,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;* @property Carbon|null $updated_at* @property string|null $deleted_at* @property int|string $webhook_message_id- * @property int $status_code+ * @property int|string $status_code* @property string|null $logs* @property string|null $response* @property-read WebhookMessage $webhookMessagediff --git a/app/Services/Internal/Update/CurrencyUpdateService.php b/app/Services/Internal/Update/CurrencyUpdateService.phpindex 01fe1692f6..9271b13981 100644--- a/app/Services/Internal/Update/CurrencyUpdateService.php+++ b/app/Services/Internal/Update/CurrencyUpdateService.php@@ -57,8 +57,8 @@ class CurrencyUpdateServiceif (array_key_exists('decimal_places', $data) && is_int($data['decimal_places'])) {$currency->decimal_places = (int)$data['decimal_places'];}- unset($currency->userEnabled);- unset($currency->userDefault);+ $currency->userEnabled = null;+ $currency->userDefault = null;$currency->save();return $currency;diff --git a/app/Support/Request/ConvertsDataTypes.php b/app/Support/Request/ConvertsDataTypes.phpindex 178f45d62b..5b6b36f11f 100644--- a/app/Support/Request/ConvertsDataTypes.php+++ b/app/Support/Request/ConvertsDataTypes.php@@ -355,7 +355,7 @@ trait ConvertsDataTypesforeach ($fields as $field => $info) {if ($this->has($info[0])) {$method = $info[1];- $return[$field] = $this->$method($info[0]);+ $return[$field] = $this->$method($info[0]); // @phpstan-ignore-line}}@@ -383,7 +383,7 @@ trait ConvertsDataTypes{$result = null;try {- $result = $this->get($field) ? new Carbon($this->get($field), config('app.timezone')) : null;+ $result = '' !== (string) $this->get($field) ? new Carbon((string)$this->get($field), config('app.timezone')) : null;} catch (InvalidFormatException $e) {// @ignoreException}diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.phpindex e4a6386362..0435d30b88 100644--- a/app/Support/Search/OperatorQuerySearch.php+++ b/app/Support/Search/OperatorQuerySearch.php@@ -920,7 +920,7 @@ class OperatorQuerySearch implements SearchInterfacecase 'amount_is':// strip comma's, make dots.app('log')->debug(sprintf('Original value "%s"', $value));- $value = str_replace(',', '.', (string)$value);+ $value = str_replace(',', '.', $value);$amount = app('steam')->positive($value);app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));$this->collector->amountIs($amount);@@ -928,7 +928,7 @@ class OperatorQuerySearch implements SearchInterfacecase '-amount_is':// strip comma's, make dots.app('log')->debug(sprintf('Original value "%s"', $value));- $value = str_replace(',', '.', (string)$value);+ $value = str_replace(',', '.', $value);$amount = app('steam')->positive($value);app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));$this->collector->amountIsNot($amount);@@ -936,7 +936,7 @@ class OperatorQuerySearch implements SearchInterfacecase 'foreign_amount_is':// strip comma's, make dots.- $value = str_replace(',', '.', (string)$value);+ $value = str_replace(',', '.', $value);$amount = app('steam')->positive($value);app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));@@ -945,7 +945,7 @@ class OperatorQuerySearch implements SearchInterfacecase '-foreign_amount_is':// strip comma's, make dots.- $value = str_replace(',', '.', (string)$value);+ $value = str_replace(',', '.', $value);$amount = app('steam')->positive($value);app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));@@ -954,7 +954,7 @@ class OperatorQuerySearch implements SearchInterfacecase '-amount_more':case 'amount_less':// strip comma's, make dots.- $value = str_replace(',', '.', (string)$value);+ $value = str_replace(',', '.', $value);$amount = app('steam')->positive($value);app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));@@ -963,7 +963,7 @@ class OperatorQuerySearch implements SearchInterfacecase '-foreign_amount_more':case 'foreign_amount_less':// strip comma's, make dots.- $value = str_replace(',', '.', (string)$value);+ $value = str_replace(',', '.', $value);$amount = app('steam')->positive($value);app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));@@ -973,7 +973,7 @@ class OperatorQuerySearch implements SearchInterfacecase 'amount_more':app('log')->debug(sprintf('Now handling operator "%s"', $operator));// strip comma's, make dots.- $value = str_replace(',', '.', (string)$value);+ $value = str_replace(',', '.', $value);$amount = app('steam')->positive($value);app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));$this->collector->amountMore($amount);@@ -982,7 +982,7 @@ class OperatorQuerySearch implements SearchInterfacecase 'foreign_amount_more':app('log')->debug(sprintf('Now handling operator "%s"', $operator));// strip comma's, make dots.- $value = str_replace(',', '.', (string)$value);+ $value = str_replace(',', '.', $value);$amount = app('steam')->positive($value);app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));$this->collector->foreignAmountMore($amount);@@ -1492,7 +1492,7 @@ class OperatorQuerySearch implements SearchInterface$filtered = $accounts->filter(static function (Account $account) use ($value, $stringMethod) {// either IBAN or account number- $ibanMatch = $stringMethod(strtolower((string)$account->iban), strtolower((string)$value));+ $ibanMatch = $stringMethod(strtolower((string)$account->iban), strtolower($value));$accountNrMatch = false;/** @var AccountMeta $meta */foreach ($account->accountMeta as $meta) {@@ -1561,7 +1561,7 @@ class OperatorQuerySearch implements SearchInterfaceapp('log')->debug(sprintf('Could not parse date "%s", will return empty array.', $value));$this->invalidOperators[] = ['type' => $type,- 'value' => (string)$value,+ 'value' => $value,];return [];}diff --git a/app/Transformers/TransactionGroupTransformer.php b/app/Transformers/TransactionGroupTransformer.phpindex 35ce7ac32e..aac7e6f410 100644--- a/app/Transformers/TransactionGroupTransformer.php+++ b/app/Transformers/TransactionGroupTransformer.php@@ -253,7 +253,7 @@ class TransactionGroupTransformer extends AbstractTransformer}if (null !== $default) {- return (string)$default;+ return $default;}return null;diff --git a/app/Transformers/V2/PiggyBankTransformer.php b/app/Transformers/V2/PiggyBankTransformer.phpindex 141d15b64d..6b00b29d93 100644--- a/app/Transformers/V2/PiggyBankTransformer.php+++ b/app/Transformers/V2/PiggyBankTransformer.php@@ -80,6 +80,7 @@ class PiggyBankTransformer extends AbstractTransformer$piggyBanks = $objects->pluck('id')->toArray();$accountInfo = Account::whereIn('id', $objects->pluck('account_id')->toArray())->get();$currencyPreferences = AccountMeta::where('name', '"currency_id"')->whereIn('account_id', $objects->pluck('account_id')->toArray())->get();+ $currencies = [];/** @var Account $account */foreach ($accountInfo as $account) {$id = (int)$account->id;diff --git a/app/Transformers/WebhookMessageTransformer.php b/app/Transformers/WebhookMessageTransformer.phpindex 2ffaa2911c..f4a1bea0b9 100644--- a/app/Transformers/WebhookMessageTransformer.php+++ b/app/Transformers/WebhookMessageTransformer.php@@ -24,7 +24,7 @@ declare(strict_types=1);namespace FireflyIII\Transformers;use FireflyIII\Models\WebhookMessage;-use Jsonexception;+use JsonException;/*** Class WebhookMessageTransformerdiff --git a/app/User.php b/app/User.phpindex ec540f7efa..424e61114f 100644--- a/app/User.php+++ b/app/User.php@@ -541,7 +541,7 @@ class User extends Authenticatablepublic function routeNotificationFor($driver, $notification = null){if (method_exists($this, $method = 'routeNotificationFor' . Str::studly($driver))) {- return $this->{$method}($notification);+ return $this->{$method}($notification); // @phpstan-ignore-line}$email = $this->email;// see if user has alternative email address:diff --git a/config/broadcasting.php b/config/broadcasting.phpindex 9f892e15a0..abc48f2e99 100644--- a/config/broadcasting.php+++ b/config/broadcasting.php@@ -57,7 +57,7 @@ return ['app_id' => env('PUSHER_APP_ID'),'options' => ['cluster' => env('PUSHER_APP_CLUSTER'),- 'host' => env('PUSHER_HOST') ?: 'api-' . env('PUSHER_APP_CLUSTER', 'mt1') . '.pusher.com',+ 'host' => null !== env('PUSHER_HOST') ? env('PUSHER_HOST') : 'api-' . env('PUSHER_APP_CLUSTER', 'mt1') . '.pusher.com','port' => env('PUSHER_PORT', 443),'scheme' => env('PUSHER_SCHEME', 'https'),'encrypted' => true,