Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Various code cleanup.
James Colefe0a205a05d1
diff --git a/.ci/phpstan.neon b/.ci/phpstan.neonindex fb533e1beb..6883101544 100644--- a/.ci/phpstan.neon+++ b/.ci/phpstan.neon@@ -1,8 +1,20 @@includes:- - ../vendor/nunomaduro/larastan/extension.neon- - ../vendor/ergebnis/phpstan-rules/rules.neon- - ../vendor/phpstan/phpstan-deprecation-rules/rules.neon- - ../vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon+ - ../vendor/symplify/phpstan-rules/config/code-complexity-rules.neon+ - ../vendor/symplify/phpstan-rules/config/collector-rules.neon+ - ../vendor/symplify/phpstan-rules/config/naming-rules.neon+ - ../vendor/symplify/phpstan-rules/config/regex-rules.neon+ - ../vendor/symplify/phpstan-rules/config/static-rules.neon+ - ../vendor/symplify/phpstan-rules/config/configurable-rules.neon++services:+ -+ class: Symplify\PHPStanRules\Rules\ForbiddenNodeRule+ tags: [phpstan.rules.rule]+ arguments:+ forbiddenNodes:+ - PhpParser\Node\Expr\Empty_+ - PhpParser\Node\Expr\ErrorSuppress+parameters:universalObjectCratesClasses:@@ -10,9 +22,15 @@ parameters:reportUnmatchedIgnoredErrors: falsecheckGenericClassInNonGenericObjectType: false # remove this rule when all other issues are solved.ignoreErrors:+ - '#Use value object over return of values#' # from simplify, ignore it.+ - '#Use explicit names over dynamic ones#' # from simplify, ignore it.+ - '#Use unique name to make classes easy to recognize#'+ - '#Do not name "e", shorter than 2 chars#'+ - '#Do not name "q", shorter than 2 chars#'- '#with no value type specified in iterable type array#' # remove this rule when all other issues are solved.- '#has no value type specified in iterable type array#' # remove this rule when all other issues are solved.- '#is not allowed to extend#'+ - '#switch is forbidden to use#'- '#is neither abstract nor final#'- '#has a nullable return type declaration#'- '#with a nullable type declaration#'@@ -76,5 +94,5 @@ parameters:- ../bootstrap/app.php# The level 8 is the highest level. original was 5- level: 6+ level: 1diff --git a/app/Api/V1/Controllers/Data/Bulk/TransactionController.php b/app/Api/V1/Controllers/Data/Bulk/TransactionController.phpindex 711bec1972..c5db390690 100644--- a/app/Api/V1/Controllers/Data/Bulk/TransactionController.php+++ b/app/Api/V1/Controllers/Data/Bulk/TransactionController.php@@ -76,7 +76,7 @@ class TransactionController extends Controller// this deserves better code, but for now a loop of basic if-statements// to respond to what is in the $query.// this is OK because only one thing can be in the query at the moment.- if ($this->updatesTransactionAccount($params)) {+ if ($this->isUpdateTransactionAccount($params)) {$original = $this->repository->find((int)$params['where']['account_id']);$destination = $this->repository->find((int)$params['update']['account_id']);@@ -93,7 +93,7 @@ class TransactionController extends Controller** @return bool*/- private function updatesTransactionAccount(array $params): bool+ private function isUpdateTransactionAccount(array $params): bool{return array_key_exists('account_id', $params['where']) && array_key_exists('account_id', $params['update']);}diff --git a/app/Models/Budget.php b/app/Models/Budget.phpindex e9ec920744..e3ba8af2a1 100644--- a/app/Models/Budget.php+++ b/app/Models/Budget.php@@ -23,6 +23,7 @@ declare(strict_types=1);namespace FireflyIII\Models;+use Carbon\Carbon;use Eloquent;use FireflyIII\User;use Illuminate\Database\Eloquent\Collection;@@ -33,13 +34,12 @@ use Illuminate\Database\Eloquent\Relations\HasMany;use Illuminate\Database\Eloquent\Relations\MorphMany;use Illuminate\Database\Eloquent\SoftDeletes;use Illuminate\Database\Query\Builder;-use Carbon\Carbon;use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/*** FireflyIII\Models\Budget*- * @property int|string $id+ * @property int|string $id* @property Carbon|null $created_at* @property Carbon|null $updated_at* @property Carbon|null $deleted_atdiff --git a/app/Models/BudgetLimit.php b/app/Models/BudgetLimit.phpindex 6d5b87d4d1..880d09b7c5 100644--- a/app/Models/BudgetLimit.php+++ b/app/Models/BudgetLimit.php@@ -40,7 +40,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;* @property int|string $id* @property Carbon|null $created_at* @property Carbon|null $updated_at- * @property int $budget_id+ * @property int|string $budget_id* @property int|null $transaction_currency_id* @property Carbon $start_date* @property Carbon|null $end_datediff --git a/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php b/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.phpindex d6fde4767e..4896597f0d 100644--- a/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php+++ b/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php@@ -25,6 +25,7 @@ declare(strict_types=1);namespace FireflyIII\Repositories\UserGroups\Currency;+use FireflyIII\Api\V1\Controllers\Data\Bulk\TransactionController;use FireflyIII\Exceptions\FireflyException;use FireflyIII\Models\TransactionCurrency;use FireflyIII\User;@@ -121,7 +122,7 @@ interface CurrencyRepositoryInterface/*** Get the user group's currencies.*- * @return Collection+ * @return Collection<TransactionCurrency>*/public function get(): Collection;diff --git a/app/Services/Internal/Update/CurrencyUpdateService.php b/app/Services/Internal/Update/CurrencyUpdateService.phpindex 9271b13981..01fe1692f6 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'];}- $currency->userEnabled = null;- $currency->userDefault = null;+ unset($currency->userEnabled);+ unset($currency->userDefault);$currency->save();return $currency;diff --git a/composer.json b/composer.jsonindex c8e307f2f6..6ab3bb9bc6 100644--- a/composer.json+++ b/composer.json@@ -147,6 +147,11 @@"includes": ["extension.neon"]+ },+ "phpstan/extension-installer": {+ "ignore": [+ "symplify/phpstan-rules"+ ]}},"scripts": {