Skip to content

Firefly III: a personal finances manager

Remove unused enums

James Colecab298708cb2
diff --git a/app/Api/V1/Requests/Data/Bulk/TransactionRequest.php b/app/Api/V1/Requests/Data/Bulk/TransactionRequest.php
index 3238e24f89..a2b3ee78fe 100644
--- a/app/Api/V1/Requests/Data/Bulk/TransactionRequest.php
+++ b/app/Api/V1/Requests/Data/Bulk/TransactionRequest.php
@@ -61,7 +61,7 @@ class TransactionRequest extends FormRequest
public function rules(): array
{
- return ['query' => ['required', 'min:1', 'max:255', 'json', new IsValidBulkClause(ClauseType::TRANSACTION)]];
+ return ['query' => ['required', 'min:1', 'max:255', 'json', new IsValidBulkClause(ClauseType::TRANSACTION->value)]];
}
public function withValidator(Validator $validator): void
diff --git a/app/Entities/AccountBalance.php b/app/Entities/AccountBalance.php
deleted file mode 100644
index b7e6247126..0000000000
--- a/app/Entities/AccountBalance.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-
-/*
- * AccountBalance.php
- * Copyright (c) 2024 [email protected].
- *
- * This file is part of Firefly III (https://github.com/firefly-iii).
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see https://www.gnu.org/licenses/.
- */
-
-declare(strict_types=1);
-
-namespace FireflyIII\Entities;
-
-use FireflyIII\Models\Account;
-
-class AccountBalance
-{
- public string $amount;
- public string $currencyId;
- public string $id;
-
- public static function fromArray(): self
- {
- $balance = new self();
- $balance->id = (string) random_int(1, 1000);
- // $balance->name = (string) random_int(1, 1000);
- $balance->amount = (string) random_int(1, 1000);
- $balance->currencyId = '1';
-
- return $balance;
- }
-
- public function getAccount(): Account
- {
- return Account::inRandomOrder()->first();
- }
-}
diff --git a/app/Enums/ClauseType.php b/app/Enums/ClauseType.php
index 47f50192f8..f36884224d 100644
--- a/app/Enums/ClauseType.php
+++ b/app/Enums/ClauseType.php
@@ -27,9 +27,9 @@ namespace FireflyIII\Enums;
/**
* Class ClauseType
*/
-class ClauseType
+enum ClauseType: string
{
- public const string TRANSACTION = 'transaction';
- public const string UPDATE = 'update';
- public const string WHERE = 'where';
+ case TRANSACTION = 'transaction';
+ case UPDATE = 'update';
+ case WHERE = 'where';
}
diff --git a/app/Models/AccountType.php b/app/Models/AccountType.php
index f7d7b9bdec..740f76c775 100644
--- a/app/Models/AccountType.php
+++ b/app/Models/AccountType.php
@@ -32,62 +32,6 @@ class AccountType extends Model
{
use ReturnsIntegerIdTrait;
- /** @deprecated */
- #[Deprecated]
- public const string ASSET = 'Asset account';
-
- /** @deprecated */
- #[Deprecated]
- public const string BENEFICIARY = 'Beneficiary account';
-
- /** @deprecated */
- #[Deprecated]
- public const string CASH = 'Cash account';
-
- /** @deprecated */
- #[Deprecated]
- public const string CREDITCARD = 'Credit card';
-
- /** @deprecated */
- #[Deprecated]
- public const string DEBT = 'Debt';
-
- /** @deprecated */
- #[Deprecated]
- public const string DEFAULT = 'Default account';
-
- /** @deprecated */
- #[Deprecated]
- public const string EXPENSE = 'Expense account';
-
- /** @deprecated */
- #[Deprecated]
- public const string IMPORT = 'Import account';
-
- /** @deprecated */
- #[Deprecated]
- public const string INITIAL_BALANCE = 'Initial balance account';
-
- /** @deprecated */
- #[Deprecated]
- public const string LIABILITY_CREDIT = 'Liability credit account';
-
- /** @deprecated */
- #[Deprecated]
- public const string LOAN = 'Loan';
-
- /** @deprecated */
- #[Deprecated]
- public const string MORTGAGE = 'Mortgage';
-
- /** @deprecated */
- #[Deprecated]
- public const string RECONCILIATION = 'Reconciliation account';
-
- /** @deprecated */
- #[Deprecated]
- public const string REVENUE = 'Revenue account';
-
protected $casts = ['created_at' => 'datetime', 'updated_at' => 'datetime'];
protected $fillable = ['type'];
diff --git a/app/Models/AutoBudget.php b/app/Models/AutoBudget.php
index eb01aa96d1..197384d6ba 100644
--- a/app/Models/AutoBudget.php
+++ b/app/Models/AutoBudget.php
@@ -39,18 +39,6 @@ class AutoBudget extends Model
use ReturnsIntegerIdTrait;
use SoftDeletes;
- /** @deprecated */
- #[Deprecated]
- public const int AUTO_BUDGET_ADJUSTED = 3;
-
- /** @deprecated */
- #[Deprecated]
- public const int AUTO_BUDGET_RESET = 1;
-
- /** @deprecated */
- #[Deprecated]
- public const int AUTO_BUDGET_ROLLOVER = 2;
-
protected $casts = ['amount' => 'string', 'native_amount' => 'string'];
protected $fillable = ['budget_id', 'amount', 'period', 'native_amount'];
diff --git a/app/Models/RecurrenceRepetition.php b/app/Models/RecurrenceRepetition.php
index 711eee4027..4fe8074c66 100644
--- a/app/Models/RecurrenceRepetition.php
+++ b/app/Models/RecurrenceRepetition.php
@@ -36,22 +36,6 @@ class RecurrenceRepetition extends Model
use ReturnsIntegerIdTrait;
use SoftDeletes;
- /** @deprecated */
- #[Deprecated]
- public const int WEEKEND_DO_NOTHING = 1;
-
- /** @deprecated */
- #[Deprecated]
- public const int WEEKEND_SKIP_CREATION = 2;
-
- /** @deprecated */
- #[Deprecated]
- public const int WEEKEND_TO_FRIDAY = 3;
-
- /** @deprecated */
- #[Deprecated]
- public const int WEEKEND_TO_MONDAY = 4;
-
protected $casts = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php
index 6b35261c96..27fc1cb6ea 100644
--- a/app/Models/Transaction.php
+++ b/app/Models/Transaction.php
@@ -39,7 +39,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
#[ObservedBy([TransactionObserver::class])]
class Transaction extends Model
{
- use HasFactory;
use ReturnsIntegerIdTrait;
use SoftDeletes;
diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php
index 696c18494c..56fa76feb7 100644
--- a/app/Models/TransactionJournal.php
+++ b/app/Models/TransactionJournal.php
@@ -53,7 +53,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
#[ObservedBy([DeletedTransactionJournalObserver::class])]
class TransactionJournal extends Model
{
- use HasFactory;
use ReturnsIntegerIdTrait;
use ReturnsIntegerUserIdTrait;
use SoftDeletes;
diff --git a/app/Models/TransactionType.php b/app/Models/TransactionType.php
index 87d9593363..2f3f1e3bf8 100644
--- a/app/Models/TransactionType.php
+++ b/app/Models/TransactionType.php
@@ -36,34 +36,6 @@ class TransactionType extends Model
use ReturnsIntegerIdTrait;
use SoftDeletes;
- /** @deprecated */
- #[Deprecated]
- public const string DEPOSIT = 'Deposit';
-
- /** @deprecated */
- #[Deprecated]
- public const string INVALID = 'Invalid';
-
- /** @deprecated */
- #[Deprecated]
- public const string LIABILITY_CREDIT = 'Liability credit';
-
- /** @deprecated */
- #[Deprecated]
- public const string OPENING_BALANCE = 'Opening balance';
-
- /** @deprecated */
- #[Deprecated]
- public const string RECONCILIATION = 'Reconciliation';
-
- /** @deprecated */
- #[Deprecated]
- public const string TRANSFER = 'Transfer';
-
- /** @deprecated */
- #[Deprecated]
- public const string WITHDRAWAL = 'Withdrawal';
-
protected $casts = ['created_at' => 'datetime', 'updated_at' => 'datetime', 'deleted_at' => 'datetime'];
protected $fillable = ['type'];
diff --git a/config/bulk.php b/config/bulk.php
index 7184d3702b..9ba6de0560 100644
--- a/config/bulk.php
+++ b/config/bulk.php
@@ -25,11 +25,11 @@ declare(strict_types=1);
use FireflyIII\Enums\ClauseType;
return [
- ClauseType::TRANSACTION => [
- ClauseType::WHERE => [
+ ClauseType::TRANSACTION->value => [
+ ClauseType::WHERE->value => [
'account_id' => 'required|numeric|belongsToUser:accounts,id',
],
- ClauseType::UPDATE => [
+ ClauseType::UPDATE->value => [
'account_id' => 'required|numeric|belongsToUser:accounts,id',
],
],