Fix phpstan issues.

This commit is contained in:
James Cole 2025-01-03 18:16:27 +01:00
parent fe4d139817
commit 3898c0c0ef
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
60 changed files with 13 additions and 74 deletions

View File

@ -44,7 +44,7 @@ use Symfony\Component\HttpFoundation\ParameterBag;
/**
* Class Controller.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings("PHPMD.CouplingBetweenObjects")
* @SuppressWarnings(PHPMD.NumberOfChildren)
*/
abstract class Controller extends BaseController

View File

@ -47,7 +47,7 @@ use Symfony\Component\HttpFoundation\ParameterBag;
/**
* Class Controller
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings("PHPMD.CouplingBetweenObjects")
* @SuppressWarnings(PHPMD.NumberOfChildren)
*/
class Controller extends BaseController

View File

@ -36,11 +36,6 @@ class CreatesDatabase extends Command
protected $signature = 'firefly-iii:create-database';
/**
* Execute the console command.
*
* @suppressWarnings(PHPMD.MissingImport)
*/
public function handle(): int
{
if ('mysql' !== config('database.default')) {

View File

@ -54,7 +54,7 @@ use Illuminate\Support\Facades\Log;
/**
* Class TransactionJournalFactory
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings("PHPMD.CouplingBetweenObjects")
*/
class TransactionJournalFactory
{

View File

@ -38,7 +38,7 @@ use Route;
/**
* Class Controller.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings("PHPMD.CouplingBetweenObjects")
* @SuppressWarnings(PHPMD.NumberOfChildren)
*/
abstract class Controller extends BaseController

View File

@ -40,7 +40,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperAccount
*/
class Account extends Model
{

View File

@ -31,7 +31,6 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* @mixin IdeHelperAccountBalance
*/
class AccountBalance extends Model
{

View File

@ -28,7 +28,6 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* @mixin IdeHelperAccountMeta
*/
class AccountMeta extends Model
{

View File

@ -29,7 +29,6 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* @mixin IdeHelperAccountType
*/
class AccountType extends Model
{

View File

@ -35,7 +35,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperAttachment
*/
class Attachment extends Model
{

View File

@ -31,7 +31,6 @@ use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* @mixin IdeHelperAuditLogEntry
*/
class AuditLogEntry extends Model
{

View File

@ -31,7 +31,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* @mixin IdeHelperAutoBudget
*/
class AutoBudget extends Model
{

View File

@ -34,7 +34,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperAvailableBudget
*/
class AvailableBudget extends Model
{

View File

@ -37,7 +37,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperBill
*/
class Bill extends Model
{

View File

@ -36,7 +36,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperBudget
*/
class Budget extends Model
{

View File

@ -35,7 +35,6 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperBudgetLimit
*/
class BudgetLimit extends Model
{

View File

@ -35,7 +35,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperCategory
*/
class Category extends Model
{

View File

@ -28,7 +28,6 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* @mixin IdeHelperConfiguration
*/
class Configuration extends Model
{

View File

@ -33,7 +33,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* @mixin IdeHelperCurrencyExchangeRate
*/
class CurrencyExchangeRate extends Model
{

View File

@ -32,7 +32,6 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* @mixin IdeHelperGroupMembership
*/
class GroupMembership extends Model
{

View File

@ -33,7 +33,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperInvitedUser
*/
class InvitedUser extends Model
{

View File

@ -30,7 +30,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperLinkType
*/
class LinkType extends Model
{

View File

@ -31,7 +31,6 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\Relations\MorphTo;
/**
* @mixin IdeHelperLocation
*/
class Location extends Model
{

View File

@ -30,7 +30,6 @@ use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* @mixin IdeHelperNote
*/
class Note extends Model
{

View File

@ -34,7 +34,6 @@ use Illuminate\Database\Eloquent\Relations\MorphToMany;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperObjectGroup
*/
class ObjectGroup extends Model
{

View File

@ -35,7 +35,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperPiggyBank
*/
class PiggyBank extends Model
{

View File

@ -30,7 +30,6 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* @mixin IdeHelperPiggyBankEvent
*/
class PiggyBankEvent extends Model
{

View File

@ -32,7 +32,6 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* @mixin IdeHelperPiggyBankRepetition
*/
class PiggyBankRepetition extends Model
{

View File

@ -31,7 +31,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperPreference
*/
class Preference extends Model
{

View File

@ -37,7 +37,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperRecurrence
*/
class Recurrence extends Model
{

View File

@ -31,7 +31,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* @mixin IdeHelperRecurrenceMeta
*/
class RecurrenceMeta extends Model
{

View File

@ -31,7 +31,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* @mixin IdeHelperRecurrenceRepetition
*/
class RecurrenceRepetition extends Model
{

View File

@ -32,7 +32,6 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* @mixin IdeHelperRecurrenceTransaction
*/
class RecurrenceTransaction extends Model
{

View File

@ -31,7 +31,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* @mixin IdeHelperRecurrenceTransactionMeta
*/
class RecurrenceTransactionMeta extends Model
{

View File

@ -29,7 +29,6 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
/**
* @mixin IdeHelperRole
*/
class Role extends Model
{

View File

@ -34,7 +34,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperRule
*/
class Rule extends Model
{

View File

@ -32,7 +32,6 @@ use Illuminate\Support\Facades\Log;
use Symfony\Component\ExpressionLanguage\SyntaxError;
/**
* @mixin IdeHelperRuleAction
*/
class RuleAction extends Model
{

View File

@ -34,7 +34,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperRuleGroup
*/
class RuleGroup extends Model
{

View File

@ -29,7 +29,6 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* @mixin IdeHelperRuleTrigger
*/
class RuleTrigger extends Model
{

View File

@ -35,7 +35,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperTag
*/
class Tag extends Model
{

View File

@ -34,7 +34,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* @mixin IdeHelperTransaction
*/
class Transaction extends Model
{

View File

@ -33,7 +33,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperTransactionCurrency
*/
class TransactionCurrency extends Model
{

View File

@ -33,7 +33,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperTransactionGroup
*/
class TransactionGroup extends Model
{

View File

@ -29,7 +29,6 @@ use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
@ -42,7 +41,9 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperTransactionJournal
* @method EloquentBuilder|static before()
* @method EloquentBuilder|static after()
* @method static EloquentBuilder|static query()
*/
class TransactionJournal extends Model
{

View File

@ -31,7 +31,6 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperTransactionJournalLink
*/
class TransactionJournalLink extends Model
{

View File

@ -30,7 +30,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* @mixin IdeHelperTransactionJournalMeta
*/
class TransactionJournalMeta extends Model
{

View File

@ -31,7 +31,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperTransactionType
*/
class TransactionType extends Model
{

View File

@ -36,7 +36,6 @@ use Illuminate\Database\Eloquent\Relations\HasManyThrough;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperUserGroup
*/
class UserGroup extends Model
{

View File

@ -29,7 +29,6 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* @mixin IdeHelperUserRole
*/
class UserRole extends Model
{

View File

@ -37,7 +37,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperWebhook
*/
class Webhook extends Model
{

View File

@ -33,7 +33,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperWebhookAttempt
*/
class WebhookAttempt extends Model
{

View File

@ -33,7 +33,6 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperWebhookMessage
*/
class WebhookMessage extends Model
{

View File

@ -105,7 +105,7 @@ use Laravel\Passport\Events\AccessTokenCreated;
/**
* Class EventServiceProvider.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings("PHPMD.CouplingBetweenObjects")
*/
class EventServiceProvider extends ServiceProvider
{

View File

@ -79,7 +79,7 @@ use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
/**
* Class FireflyServiceProvider.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings("PHPMD.CouplingBetweenObjects")
*/
class FireflyServiceProvider extends ServiceProvider
{

View File

@ -214,7 +214,6 @@ class TagRepository implements TagRepositoryInterface
*/
public function searchTags(string $query, int $limit): Collection
{
/** @var Collection $tags */
$tags = $this->user->tags()->orderBy('tag', 'ASC');
if ('' !== $query) {
$search = sprintf('%%%s%%', $query);

View File

@ -106,10 +106,7 @@ class Amount
/**
* This method will properly format the given number, in color or "black and white",
* as a currency, given two things: the currency required and the current locale.
*
* @throws FireflyException
*
* @SuppressWarnings(PHPMD.MissingImport)
*/
public function formatFlat(string $symbol, int $decimalPlaces, string $amount, ?bool $coloured = null): string
{
@ -229,8 +226,6 @@ class Amount
/**
* @throws FireflyException
*
* @SuppressWarnings(PHPMD.MissingImport)
*/
private function getLocaleInfo(): array
{

View File

@ -62,9 +62,6 @@ class Calculator
return self::loadIntervalMap()->contains($periodicity);
}
/**
* @SuppressWarnings(PHPMD.MissingImport)
*/
private static function loadIntervalMap(): \SplObjectStorage
{
if (null !== self::$intervalMap) {

View File

@ -62,7 +62,7 @@ use Illuminate\Support\Collection;
/**
* Class OperatorQuerySearch
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings("PHPMD.CouplingBetweenObjects")
*/
class OperatorQuerySearch implements SearchInterface
{

View File

@ -166,11 +166,12 @@ class TransactionGroupTwig extends AbstractExtension
private function normalJournalObjectAmount(TransactionJournal $journal): string
{
$type = $journal->transactionType->type;
/** @var Transaction $first */
$first = $journal->transactions()->where('amount', '<', 0)->first();
$currency = $journal->transactionCurrency;
$amount = $first->amount ?? '0';
$colored = true;
$sourceType = $first->account()->first()->accountType()->first()->type;
$sourceType = $first->account->accountType()->first()->type;
$amount = $this->signAmount($amount, $type, $sourceType);
@ -205,7 +206,7 @@ class TransactionGroupTwig extends AbstractExtension
$currency = $first->foreignCurrency;
$amount = '' === $first->foreign_amount ? '0' : $first->foreign_amount;
$colored = true;
$sourceType = $first->account()->first()->accountType()->first()->type;
$sourceType = $first->account->accountType()->first()->type;
$amount = $this->signAmount($amount, $type, $sourceType);

View File

@ -66,9 +66,6 @@ use Laravel\Passport\HasApiTokens;
use NotificationChannels\Pushover\PushoverReceiver;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @mixin IdeHelperUser
*/
class User extends Authenticatable
{
use HasApiTokens;