mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Various code cleanup.
This commit is contained in:
@@ -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: false
|
||||
checkGenericClassInNonGenericObjectType: 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: 1
|
||||
|
||||
|
@@ -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']);
|
||||
}
|
||||
|
@@ -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_at
|
||||
|
@@ -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_date
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -57,8 +57,8 @@ class CurrencyUpdateService
|
||||
if (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;
|
||||
|
@@ -147,6 +147,11 @@
|
||||
"includes": [
|
||||
"extension.neon"
|
||||
]
|
||||
},
|
||||
"phpstan/extension-installer": {
|
||||
"ignore": [
|
||||
"symplify/phpstan-rules"
|
||||
]
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
|
Reference in New Issue
Block a user