mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-18 02:03:40 +00:00
Fix various phpstan issues.
This commit is contained in:
@@ -37,17 +37,17 @@ class PiggyBankEvent extends Model
|
||||
use ReturnsIntegerIdTrait;
|
||||
|
||||
protected $casts
|
||||
= [
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
'date' => SeparateTimezoneCaster::class,
|
||||
'amount' => 'string',
|
||||
'amount' => 'native_string',
|
||||
= [
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
'date' => SeparateTimezoneCaster::class,
|
||||
'amount' => 'string',
|
||||
'native_amount' => 'string',
|
||||
];
|
||||
|
||||
protected $fillable = ['piggy_bank_id', 'transaction_journal_id', 'date', 'date_tz', 'amount', 'native_amount'];
|
||||
|
||||
protected $hidden = ['amount_encrypted'];
|
||||
protected $hidden = ['amount_encrypted'];
|
||||
|
||||
public function piggyBank(): BelongsTo
|
||||
{
|
||||
@@ -73,14 +73,14 @@ class PiggyBankEvent extends Model
|
||||
protected function amount(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn ($value) => (string) $value,
|
||||
get: static fn($value) => (string) $value,
|
||||
);
|
||||
}
|
||||
|
||||
protected function piggyBankId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn ($value) => (int) $value,
|
||||
get: static fn($value) => (int) $value,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
use FireflyIII\Enums\TransactionTypeEnum;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
@@ -86,22 +87,22 @@ class TransactionType extends Model
|
||||
|
||||
public function isDeposit(): bool
|
||||
{
|
||||
return self::DEPOSIT === $this->type;
|
||||
return TransactionTypeEnum::DEPOSIT->value === $this->type;
|
||||
}
|
||||
|
||||
public function isOpeningBalance(): bool
|
||||
{
|
||||
return self::OPENING_BALANCE === $this->type;
|
||||
return TransactionTypeEnum::OPENING_BALANCE->value === $this->type;
|
||||
}
|
||||
|
||||
public function isTransfer(): bool
|
||||
{
|
||||
return self::TRANSFER === $this->type;
|
||||
return TransactionTypeEnum::TRANSFER->value === $this->type;
|
||||
}
|
||||
|
||||
public function isWithdrawal(): bool
|
||||
{
|
||||
return self::WITHDRAWAL === $this->type;
|
||||
return TransactionTypeEnum::WITHDRAWAL->value === $this->type;
|
||||
}
|
||||
|
||||
public function transactionJournals(): HasMany
|
||||
|
Reference in New Issue
Block a user