Code cleanup and phpstan fixes. Still breaks but at least it's consistent.

This commit is contained in:
James Cole
2023-11-04 19:00:25 +01:00
parent fe0a205a05
commit 0f6f4e1a50
44 changed files with 80 additions and 154 deletions

View File

@@ -1,21 +1,3 @@
includes:
- ../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:
- Illuminate\Database\Eloquent\Model

View File

@@ -90,7 +90,7 @@ class AccountController extends Controller
$date = $this->parameters->get('date') ?? today(config('app.timezone'));
$result = $this->adminRepository->searchAccount((string)$query, $types, $data['limit']);
$defaultCurrency = app('amount')->getDefaultCurrency();
$groupedResult = [];
$allItems = [];
/** @var Account $account */
foreach ($result as $account) {

View File

@@ -393,7 +393,7 @@ class BasicController extends Controller
*/
foreach ($spent as $currencyId => $row) {
app('log')->debug(sprintf('Processing spent array in currency #%d', $currencyId));
$currencyId = (int)$currencyId;
$currencyId = $currencyId;
$spent = '0';
$spentNative = '0';
// get the sum from the array of transactions (double loop but who cares)

View File

@@ -46,14 +46,14 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int $account_type_id
* @property int|string $user_id
* @property int|string $account_type_id
* @property string $name
* @property string|null $virtual_balance
* @property string|null $iban
* @property bool $active
* @property bool $encrypted
* @property int $order
* @property int|string $order
* @property-read Collection|AccountMeta[] $accountMeta
* @property-read int|null $account_meta_count
* @property AccountType $accountType

View File

@@ -35,7 +35,7 @@ use Carbon\Carbon;
* @property int|string $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property int $account_id
* @property int|string $account_id
* @property string $name
* @property mixed $data
* @property-read Account $account

View File

@@ -42,8 +42,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int $attachable_id
* @property int|string $user_id
* @property int|string $attachable_id
* @property string $attachable_type
* @property bool $file_exists
* @property string $md5
@@ -51,7 +51,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property string|null $title
* @property string|null $description
* @property string $mime
* @property int $size
* @property int|string $size
* @property bool $uploaded
* @property string $notes_text
* @property-read Model|Eloquent $attachable

View File

@@ -46,9 +46,9 @@ use Carbon\Carbon;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $auditable_id
* @property int|string $auditable_id
* @property string $auditable_type
* @property int $changer_id
* @property int|string $changer_id
* @property string $changer_type
* @property string $action
* @property array|null $before

View File

@@ -39,10 +39,10 @@ use Carbon\Carbon;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $budget_id
* @property int $transaction_currency_id
* @property int $auto_budget_type
* @property string $amount
* @property int|string $budget_id
* @property int|string $transaction_currency_id
* @property int|string $auto_budget_type
* @property string|float $amount
* @property string $period
* @property-read Budget $budget
* @property-read TransactionCurrency $transactionCurrency

View File

@@ -40,9 +40,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int $transaction_currency_id
* @property string $amount
* @property int|string $user_id
* @property int|string $transaction_currency_id
* @property string|float $amount
* @property Carbon $start_date
* @property Carbon $end_date
* @property-read TransactionCurrency $transactionCurrency

View File

@@ -45,22 +45,22 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int|string $user_id
* @property int|null $transaction_currency_id
* @property string $name
* @property string $match
* @property string $amount_min
* @property string $amount_max
* @property string|float $amount_min
* @property string|float $amount_max
* @property Carbon $date
* @property Carbon|null $end_date
* @property Carbon|null $extension_date
* @property string $repeat_freq
* @property int $skip
* @property int|string $skip
* @property bool $automatch
* @property bool $active
* @property bool $name_encrypted
* @property bool $match_encrypted
* @property int $order
* @property int|string $order
* @property-read Collection|Attachment[] $attachments
* @property-read int|null $attachments_count
* @property-read Collection|Note[] $notes

View File

@@ -43,11 +43,11 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int|string $user_id
* @property string $name
* @property bool $active
* @property bool $encrypted
* @property int $order
* @property int|string $order
* @property-read Collection|Attachment[] $attachments
* @property-read int|null $attachments_count
* @property-read Collection|AutoBudget[] $autoBudgets

View File

@@ -44,10 +44,10 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property int|null $transaction_currency_id
* @property Carbon $start_date
* @property Carbon|null $end_date
* @property string $amount
* @property string|float $amount
* @property string $spent
* @property string|null $period
* @property int $generated
* @property int|string $generated
* @property-read Budget $budget
* @property-read TransactionCurrency|null $transactionCurrency
* @method static Builder|BudgetLimit newModelQuery()

View File

@@ -42,7 +42,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int|string $user_id
* @property string $name
* @property Carbon $lastActivity
* @property bool $encrypted

View File

@@ -39,11 +39,11 @@ use Carbon\Carbon;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string|null $deleted_at
* @property int $user_id
* @property int $from_currency_id
* @property int $to_currency_id
* @property int|string $user_id
* @property int|string $from_currency_id
* @property int|string $to_currency_id
* @property Carbon $date
* @property string $rate
* @property string|float $rate
* @property string|null $user_rate
* @property-read TransactionCurrency $fromCurrency
* @property-read TransactionCurrency $toCurrency

View File

@@ -34,13 +34,13 @@ use Carbon\Carbon;
/**
* Class GroupMembership
*
* @property int $id
* @property int|string $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string|null $deleted_at
* @property int $user_id
* @property int $user_group_id
* @property int $user_role_id
* @property int|string $user_id
* @property int|string $user_group_id
* @property int|string $user_role_id
* @property-read User $user
* @property-read UserGroup $userGroup
* @property-read UserRole $userRole

View File

@@ -42,7 +42,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property int|string $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property int $user_id
* @property int|string $user_id
* @property string $email
* @property string $invite_code
* @property Carbon $expires

View File

@@ -39,7 +39,7 @@ use Carbon\Carbon;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $locatable_id
* @property int|string $locatable_id
* @property string $locatable_type
* @property float|null $latitude
* @property float|null $longitude

View File

@@ -37,7 +37,7 @@ use Carbon\Carbon;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $noteable_id
* @property int|string $noteable_id
* @property string $noteable_type
* @property string|null $title
* @property string|null $text

View File

@@ -43,7 +43,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property string $title
* @property int $order
* @property int|string $order
* @property-read Collection|Account[] $accounts
* @property-read int|null $accounts_count
* @property-read Collection|Bill[] $bills

View File

@@ -43,12 +43,12 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $account_id
* @property int|string $account_id
* @property string $name
* @property string $targetamount
* @property string|float $targetamount
* @property Carbon|null $startdate
* @property Carbon|null $targetdate
* @property int $order
* @property int|string $order
* @property bool $active
* @property bool $encrypted
* @property-read Account $account

View File

@@ -36,7 +36,7 @@ use Carbon\Carbon;
* @property int|string $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property int $piggy_bank_id
* @property int|string $piggy_bank_id
* @property int|null $transaction_journal_id
* @property Carbon $date
* @property string $amount

View File

@@ -36,10 +36,10 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
* @property int|string $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property int $piggy_bank_id
* @property int|string $piggy_bank_id
* @property Carbon|null $startdate
* @property Carbon|null $targetdate
* @property string $currentamount
* @property string|float $currentamount
* @property-read PiggyBank $piggyBank
* @method static EloquentBuilder|PiggyBankRepetition newModelQuery()
* @method static EloquentBuilder|PiggyBankRepetition newQuery()

View File

@@ -37,7 +37,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property int|string $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property int $user_id
* @property int|string $user_id
* @property string $name
* @property int|string|array|null $data
* @property-read User $user

View File

@@ -42,8 +42,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int $transaction_type_id
* @property int|string $user_id
* @property int|string $transaction_type_id
* @property string $title
* @property string $description
* @property Carbon|null $first_date

View File

@@ -37,7 +37,7 @@ use Carbon\Carbon;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $recurrence_id
* @property int|string $recurrence_id
* @property string $name
* @property mixed $value
* @property-read Recurrence $recurrence

View File

@@ -37,7 +37,7 @@ use Carbon\Carbon;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $recurrence_id
* @property int|string $recurrence_id
* @property string $repetition_type
* @property string $repetition_moment
* @property int $repetition_skip

View File

@@ -40,13 +40,13 @@ use Carbon\Carbon;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $recurrence_id
* @property int $transaction_currency_id
* @property int|string $recurrence_id
* @property int|string $transaction_currency_id
* @property int|null $foreign_currency_id
* @property int $source_id
* @property int $destination_id
* @property string $amount
* @property string|null $foreign_amount
* @property int|string $source_id
* @property int|string $destination_id
* @property string|float $amount
* @property string|float|null $foreign_amount
* @property string $description
* @property-read Account $destinationAccount
* @property-read TransactionCurrency|null $foreignCurrency

View File

@@ -37,7 +37,7 @@ use Carbon\Carbon;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $rt_id
* @property int|string $rt_id
* @property string $name
* @property mixed $value
* @property-read RecurrenceTransaction $recurrenceTransaction

View File

@@ -41,11 +41,11 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int $rule_group_id
* @property int|string $user_id
* @property int|string $rule_group_id
* @property string $title
* @property string|null $description
* @property int $order
* @property int|string $order
* @property bool $active
* @property bool $stop_processing
* @property bool $strict

View File

@@ -35,7 +35,7 @@ use Carbon\Carbon;
* @property int|string $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property int $rule_id
* @property int|string $rule_id
* @property string $action_type
* @property string $action_value
* @property int $order

View File

@@ -41,7 +41,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int|string $user_id
* @property string $title
* @property string|null $description
* @property int $order

View File

@@ -35,9 +35,9 @@ use Carbon\Carbon;
* @property int|string $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property int $rule_id
* @property string $trigger_type
* @property string $trigger_value
* @property int|string $rule_id
* @property string|null $trigger_type
* @property string|null $trigger_value
* @property int $order
* @property bool $active
* @property bool $stop_processing

View File

@@ -42,7 +42,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int|string $user_id
* @property string $tag
* @property string $tagMode
* @property Carbon|null $date

View File

@@ -42,8 +42,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property bool $reconciled
* @property int $account_id
* @property int $transaction_journal_id
* @property int|string $account_id
* @property int|string $transaction_journal_id
* @property string|null $description
* @property int|null $transaction_currency_id
* @property string $modified

View File

@@ -47,7 +47,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property string $code
* @property string $name
* @property string $symbol
* @property int $decimal_places
* @property int|string $decimal_places
* @property-read Collection|BudgetLimit[] $budgetLimits
* @property-read int|null $budget_limits_count
* @property-read Collection|TransactionJournal[] $transactionJournals

View File

@@ -41,7 +41,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int|string $user_id
* @property string|null $title
* @property-read Collection|TransactionJournal[] $transactionJournals
* @property-read int|null $transaction_journals_count

View File

@@ -45,8 +45,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int $transaction_type_id
* @property int|string $user_id
* @property int |string $transaction_type_id
* @property int|null $transaction_group_id
* @property int|null $bill_id
* @property int|null $transaction_currency_id

View File

@@ -38,7 +38,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property int|string $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property int $link_type_id
* @property |stringint $link_type_id
* @property int $source_id
* @property int $destination_id
* @property string|null $comment

View File

@@ -44,7 +44,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int|string $user_id
* @property bool $active
* @property int $trigger
* @property int $response

View File

@@ -39,7 +39,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string|null $deleted_at
* @property int $webhook_message_id
* @property int|string $webhook_message_id
* @property int $status_code
* @property string|null $logs
* @property string|null $response

View File

@@ -41,7 +41,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string|null $deleted_at
* @property int $webhook_id
* @property int|string $webhook_id
* @property bool $sent
* @property bool $errored
* @property int $attempts

View File

@@ -80,7 +80,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* Class User.
*
* @property int $id
* @property int|string $id
* @property string $email
* @property bool $isAdmin
* @property bool $has2FA

View File

@@ -121,7 +121,6 @@
"phpstan/phpstan-deprecation-rules": "^1.1",
"phpstan/phpstan-strict-rules": "^1.4",
"phpunit/phpunit": "^10",
"symplify/phpstan-rules": "^12.4",
"thecodingmachine/phpstan-strict-rules": "^1.0"
},
"suggest": {

57
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "68c12b4cd64c80ddda151a22622e822d",
"content-hash": "40e0d0acc39fde17b9e90f10ff4b7b8c",
"packages": [
{
"name": "bacon/bacon-qr-code",
@@ -11604,61 +11604,6 @@
],
"time": "2023-02-07T11:34:05+00:00"
},
{
"name": "symplify/phpstan-rules",
"version": "12.4.3",
"source": {
"type": "git",
"url": "https://github.com/symplify/phpstan-rules.git",
"reference": "54def05dea85612c8c7729933ba5457dbd3eed64"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symplify/phpstan-rules/zipball/54def05dea85612c8c7729933ba5457dbd3eed64",
"reference": "54def05dea85612c8c7729933ba5457dbd3eed64",
"shasum": ""
},
"require": {
"nette/utils": "^3.2 || ^4.0",
"nikic/php-parser": "^4.17.1",
"php": "^7.2|^8.0",
"phpstan/phpstan": "^1.10.30",
"webmozart/assert": "^1.11"
},
"type": "phpstan-extension",
"extra": {
"phpstan": {
"includes": [
"config/services/services.neon"
]
}
},
"autoload": {
"psr-4": {
"Symplify\\PHPStanRules\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Set of Symplify rules for PHPStan",
"support": {
"issues": "https://github.com/symplify/phpstan-rules/issues",
"source": "https://github.com/symplify/phpstan-rules/tree/12.4.3"
},
"funding": [
{
"url": "https://www.paypal.me/rectorphp",
"type": "custom"
},
{
"url": "https://github.com/tomasvotruba",
"type": "github"
}
],
"time": "2023-10-19T08:45:51+00:00"
},
{
"name": "thecodingmachine/phpstan-strict-rules",
"version": "v1.0.0",