Add some PHP 8.3-only features.

This commit is contained in:
James Cole 2023-12-02 12:56:48 +01:00
parent 2b0a3ec818
commit b02a61dfbd
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
54 changed files with 350 additions and 348 deletions

View File

@ -51,7 +51,7 @@ abstract class Controller extends BaseController
use DispatchesJobs;
use ValidatesRequests;
protected const CONTENT_TYPE = 'application/vnd.api+json';
protected const string CONTENT_TYPE = 'application/vnd.api+json';
/** @var array<int, string> */
protected array $allowedSort;
protected ParameterBag $parameters;

View File

@ -33,7 +33,7 @@ use Illuminate\Http\JsonResponse;
*/
class DestroyController extends Controller
{
public const RESOURCE_KEY = 'accounts';
public const string RESOURCE_KEY = 'accounts';
private AccountRepositoryInterface $repository;

View File

@ -47,7 +47,7 @@ class ListController extends Controller
{
use TransactionFilter;
public const RESOURCE_KEY = 'accounts';
public const string RESOURCE_KEY = 'accounts';
private AccountRepositoryInterface $repository;

View File

@ -43,7 +43,7 @@ class ShowController extends Controller
{
use AccountFilter;
public const RESOURCE_KEY = 'accounts';
public const string RESOURCE_KEY = 'accounts';
private AccountRepositoryInterface $repository;

View File

@ -35,7 +35,7 @@ use League\Fractal\Resource\Item;
*/
class StoreController extends Controller
{
public const RESOURCE_KEY = 'accounts';
public const string RESOURCE_KEY = 'accounts';
private AccountRepositoryInterface $repository;

View File

@ -36,7 +36,7 @@ use League\Fractal\Resource\Item;
*/
class UpdateController extends Controller
{
public const RESOURCE_KEY = 'accounts';
public const string RESOURCE_KEY = 'accounts';
private AccountRepositoryInterface $repository;

View File

@ -41,8 +41,8 @@ use League\Fractal\Resource\Item;
*/
class PreferencesController extends Controller
{
public const DATE_FORMAT = 'Y-m-d';
public const RESOURCE_KEY = 'preferences';
public const string DATE_FORMAT = 'Y-m-d';
public const string RESOURCE_KEY = 'preferences';
/**
* This endpoint is documented at:

View File

@ -41,7 +41,7 @@ use League\Fractal\Resource\Item;
*/
class AttemptController extends Controller
{
public const RESOURCE_KEY = 'webhook_attempts';
public const string RESOURCE_KEY = 'webhook_attempts';
private WebhookRepositoryInterface $repository;
/**

View File

@ -40,7 +40,7 @@ use League\Fractal\Resource\Item;
*/
class MessageController extends Controller
{
public const RESOURCE_KEY = 'webhook_messages';
public const string RESOURCE_KEY = 'webhook_messages';
private WebhookRepositoryInterface $repository;
/**

View File

@ -43,7 +43,7 @@ use League\Fractal\Resource\Item;
*/
class ShowController extends Controller
{
public const RESOURCE_KEY = 'webhooks';
public const string RESOURCE_KEY = 'webhooks';
private WebhookRepositoryInterface $repository;
/**

View File

@ -35,7 +35,7 @@ use League\Fractal\Resource\Item;
*/
class StoreController extends Controller
{
public const RESOURCE_KEY = 'webhooks';
public const string RESOURCE_KEY = 'webhooks';
private WebhookRepositoryInterface $repository;
/**

View File

@ -50,7 +50,7 @@ class Controller extends BaseController
{
use ValidatesUserGroupTrait;
protected const CONTENT_TYPE = 'application/vnd.api+json';
protected const string CONTENT_TYPE = 'application/vnd.api+json';
protected ParameterBag $parameters;
/**

View File

@ -36,7 +36,7 @@ class FixLongDescriptions extends Command
{
use ShowsFriendlyMessages;
private const MAX_LENGTH = 1000;
private const int MAX_LENGTH = 1000;
protected $description = 'Fixes long descriptions in journals and groups.';
protected $signature = 'firefly-iii:fix-long-descriptions';

View File

@ -40,7 +40,7 @@ class CreateGroupMemberships extends Command
{
use ShowsFriendlyMessages;
public const CONFIG_NAME = '560_create_group_memberships';
public const string CONFIG_NAME = '560_create_group_memberships';
protected $description = 'Update group memberships';
protected $signature = 'firefly-iii:create-group-memberships';

View File

@ -44,7 +44,7 @@ class AccountCurrencies extends Command
{
use ShowsFriendlyMessages;
public const CONFIG_NAME = '480_account_currencies';
public const string CONFIG_NAME = '480_account_currencies';
protected $description = 'Give all accounts proper currency info.';
protected $signature = 'firefly-iii:account-currencies {--F|force : Force the execution of this command.}';

View File

@ -36,7 +36,7 @@ class AppendBudgetLimitPeriods extends Command
{
use ShowsFriendlyMessages;
public const CONFIG_NAME = '550_budget_limit_periods';
public const string CONFIG_NAME = '550_budget_limit_periods';
protected $description = 'Append budget limits with their (estimated) timeframe.';

View File

@ -41,7 +41,7 @@ class BackToJournals extends Command
{
use ShowsFriendlyMessages;
public const CONFIG_NAME = '480_back_to_journals';
public const string CONFIG_NAME = '480_back_to_journals';
protected $description = 'Move meta data back to journals, not individual transactions.';

View File

@ -39,7 +39,7 @@ class BudgetLimitCurrency extends Command
{
use ShowsFriendlyMessages;
public const CONFIG_NAME = '480_bl_currency';
public const string CONFIG_NAME = '480_bl_currency';
protected $description = 'Give budget limits a currency';

View File

@ -39,7 +39,7 @@ class CCLiabilities extends Command
{
use ShowsFriendlyMessages;
public const CONFIG_NAME = '480_cc_liabilities';
public const string CONFIG_NAME = '480_cc_liabilities';
protected $description = 'Convert old credit card liabilities.';
protected $signature = 'firefly-iii:cc-liabilities {--F|force : Force the execution of this command.}';

View File

@ -38,7 +38,7 @@ class MigrateAttachments extends Command
{
use ShowsFriendlyMessages;
public const CONFIG_NAME = '480_migrate_attachments';
public const string CONFIG_NAME = '480_migrate_attachments';
protected $description = 'Migrates attachment meta-data.';

View File

@ -37,7 +37,7 @@ class MigrateJournalNotes extends Command
{
use ShowsFriendlyMessages;
public const CONFIG_NAME = '480_migrate_notes';
public const string CONFIG_NAME = '480_migrate_notes';
protected $description = 'Migrate notes for transaction journals.';

View File

@ -40,7 +40,7 @@ class MigrateRecurrenceMeta extends Command
{
use ShowsFriendlyMessages;
public const CONFIG_NAME = '481_migrate_recurrence_meta';
public const string CONFIG_NAME = '481_migrate_recurrence_meta';
protected $description = 'Migrate recurrence meta data';

View File

@ -39,7 +39,7 @@ class MigrateRecurrenceType extends Command
{
use ShowsFriendlyMessages;
public const CONFIG_NAME = '550_migrate_recurrence_type';
public const string CONFIG_NAME = '550_migrate_recurrence_type';
protected $description = 'Migrate transaction type of recurring transaction.';

View File

@ -38,7 +38,7 @@ class MigrateTagLocations extends Command
{
use ShowsFriendlyMessages;
public const CONFIG_NAME = '500_migrate_tag_locations';
public const string CONFIG_NAME = '500_migrate_tag_locations';
protected $description = 'Migrate tag locations.';

View File

@ -50,7 +50,7 @@ class MigrateToGroups extends Command
{
use ShowsFriendlyMessages;
public const CONFIG_NAME = '480_migrated_to_groups';
public const string CONFIG_NAME = '480_migrated_to_groups';
protected $description = 'Migrates a pre-4.7.8 transaction structure to the 4.7.8+ transaction structure.';
protected $signature = 'firefly-iii:migrate-to-groups {--F|force : Force the migration, even if it fired before.}';
private JournalCLIRepositoryInterface $cliRepository;

View File

@ -44,7 +44,7 @@ class MigrateToRules extends Command
{
use ShowsFriendlyMessages;
public const CONFIG_NAME = '480_bills_to_rules';
public const string CONFIG_NAME = '480_bills_to_rules';
protected $description = 'Migrate bills to rules.';

View File

@ -44,7 +44,7 @@ class OtherCurrenciesCorrections extends Command
{
use ShowsFriendlyMessages;
public const CONFIG_NAME = '480_other_currencies';
public const string CONFIG_NAME = '480_other_currencies';
protected $description = 'Update all journal currency information.';
protected $signature = 'firefly-iii:other-currencies {--F|force : Force the execution of this command.}';
private array $accountCurrencies;

View File

@ -37,7 +37,7 @@ class RenameAccountMeta extends Command
{
use ShowsFriendlyMessages;
public const CONFIG_NAME = '480_rename_account_meta';
public const string CONFIG_NAME = '480_rename_account_meta';
protected $description = 'Rename account meta-data to new format.';

View File

@ -41,7 +41,7 @@ class TransactionIdentifier extends Command
{
use ShowsFriendlyMessages;
public const CONFIG_NAME = '480_transaction_identifier';
public const string CONFIG_NAME = '480_transaction_identifier';
protected $description = 'Fixes transaction identifiers.';
protected $signature = 'firefly-iii:transaction-identifiers {--F|force : Force the execution of this command.}';
private JournalCLIRepositoryInterface $cliRepository;

View File

@ -42,7 +42,7 @@ class TransferCurrenciesCorrections extends Command
{
use ShowsFriendlyMessages;
public const CONFIG_NAME = '480_transfer_currencies';
public const string CONFIG_NAME = '480_transfer_currencies';
protected $description = 'Updates transfer currency information.';
protected $signature = 'firefly-iii:transfer-currencies {--F|force : Force the execution of this command.}';
private array $accountCurrencies;

View File

@ -40,7 +40,7 @@ class UpgradeCurrencyPreferences extends Command
{
use ShowsFriendlyMessages;
public const CONFIG_NAME = '610_upgrade_currency_prefs';
public const string CONFIG_NAME = '610_upgrade_currency_prefs';
protected $description = 'Upgrade user currency preferences';

View File

@ -43,7 +43,7 @@ class UpgradeLiabilities extends Command
{
use ShowsFriendlyMessages;
public const CONFIG_NAME = '560_upgrade_liabilities';
public const string CONFIG_NAME = '560_upgrade_liabilities';
protected $description = 'Upgrade liabilities to new 5.6.0 structure.';
protected $signature = 'firefly-iii:upgrade-liabilities {--F|force : Force the execution of this command.}';

View File

@ -44,7 +44,7 @@ class UpgradeLiabilitiesEight extends Command
{
use ShowsFriendlyMessages;
public const CONFIG_NAME = '600_upgrade_liabilities';
public const string CONFIG_NAME = '600_upgrade_liabilities';
protected $description = 'Upgrade liabilities to new 6.0.0 structure.';
protected $signature = 'firefly-iii:liabilities-600 {--F|force : Force the execution of this command.}';

View File

@ -11,7 +11,7 @@ use Illuminate\Console\Command;
class UpgradeSkeleton extends Command
{
use ShowsFriendlyMessages;
public const CONFIG_NAME = '480_some_name';
public const string CONFIG_NAME = '480_some_name';
protected $description = 'SOME DESCRIPTION';

View File

@ -29,7 +29,7 @@ namespace FireflyIII\Enums;
*/
class ClauseType
{
public const TRANSACTION = 'transaction';
public const UPDATE = 'update';
public const WHERE = 'where';
public const string TRANSACTION = 'transaction';
public const string UPDATE = 'update';
public const string WHERE = 'where';
}

View File

@ -33,7 +33,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
*/
trait CollectorProperties
{
public const TEST = 'Test';
public const string TEST = 'Test';
private bool $expandGroupSearch;
private array $fields;
private bool $hasAccountInfo;

View File

@ -45,9 +45,9 @@ class InstallController extends Controller
{
use GetConfigurationData;
public const BASEDIR_ERROR = 'Firefly III cannot execute the upgrade commands. It is not allowed to because of an open_basedir restriction.';
public const FORBIDDEN_ERROR = 'Internal PHP function "proc_close" is disabled for your installation. Auto-migration is not possible.';
public const OTHER_ERROR = 'An unknown error prevented Firefly III from executing the upgrade commands. Sorry.';
public const string BASEDIR_ERROR = 'Firefly III cannot execute the upgrade commands. It is not allowed to because of an open_basedir restriction.';
public const string FORBIDDEN_ERROR = 'Internal PHP function "proc_close" is disabled for your installation. Auto-migration is not possible.';
public const string OTHER_ERROR = 'An unknown error prevented Firefly III from executing the upgrade commands. Sorry.';
private string $lastError;
private array $upgradeCommands;

View File

@ -53,20 +53,20 @@ class AccountType extends Model
{
use ReturnsIntegerIdTrait;
public const ASSET = 'Asset account';
public const BENEFICIARY = 'Beneficiary account';
public const CASH = 'Cash account';
public const CREDITCARD = 'Credit card';
public const DEBT = 'Debt';
public const DEFAULT = 'Default account';
public const EXPENSE = 'Expense account';
public const IMPORT = 'Import account';
public const INITIAL_BALANCE = 'Initial balance account';
public const LIABILITY_CREDIT = 'Liability credit account';
public const LOAN = 'Loan';
public const MORTGAGE = 'Mortgage';
public const RECONCILIATION = 'Reconciliation account';
public const REVENUE = 'Revenue account';
public const string ASSET = 'Asset account';
public const string BENEFICIARY = 'Beneficiary account';
public const string CASH = 'Cash account';
public const string CREDITCARD = 'Credit card';
public const string DEBT = 'Debt';
public const string DEFAULT = 'Default account';
public const string EXPENSE = 'Expense account';
public const string IMPORT = 'Import account';
public const string INITIAL_BALANCE = 'Initial balance account';
public const string LIABILITY_CREDIT = 'Liability credit account';
public const string LOAN = 'Loan';
public const string MORTGAGE = 'Mortgage';
public const string RECONCILIATION = 'Reconciliation account';
public const string REVENUE = 'Revenue account';
protected $casts

View File

@ -69,9 +69,9 @@ class AutoBudget extends Model
use ReturnsIntegerIdTrait;
use SoftDeletes;
public const AUTO_BUDGET_ADJUSTED = 3;
public const AUTO_BUDGET_RESET = 1;
public const AUTO_BUDGET_ROLLOVER = 2;
public const int AUTO_BUDGET_ADJUSTED = 3;
public const int AUTO_BUDGET_RESET = 1;
public const int AUTO_BUDGET_ROLLOVER = 2;
protected $fillable = ['budget_id', 'amount', 'period'];
/**

View File

@ -67,10 +67,10 @@ class RecurrenceRepetition extends Model
use ReturnsIntegerIdTrait;
use SoftDeletes;
public const WEEKEND_DO_NOTHING = 1;
public const WEEKEND_SKIP_CREATION = 2;
public const WEEKEND_TO_FRIDAY = 3;
public const WEEKEND_TO_MONDAY = 4;
public const int WEEKEND_DO_NOTHING = 1;
public const int WEEKEND_SKIP_CREATION = 2;
public const int WEEKEND_TO_FRIDAY = 3;
public const int WEEKEND_TO_MONDAY = 4;
protected $casts

View File

@ -60,13 +60,13 @@ class TransactionType extends Model
use ReturnsIntegerIdTrait;
use SoftDeletes;
public const DEPOSIT = 'Deposit';
public const INVALID = 'Invalid';
public const LIABILITY_CREDIT = 'Liability credit';
public const OPENING_BALANCE = 'Opening balance';
public const RECONCILIATION = 'Reconciliation';
public const TRANSFER = 'Transfer';
public const WITHDRAWAL = 'Withdrawal';
public const string DEPOSIT = 'Deposit';
public const string INVALID = 'Invalid';
public const string LIABILITY_CREDIT = 'Liability credit';
public const string OPENING_BALANCE = 'Opening balance';
public const string RECONCILIATION = 'Reconciliation';
public const string TRANSFER = 'Transfer';
public const string WITHDRAWAL = 'Withdrawal';
protected $casts
= [

View File

@ -31,7 +31,7 @@ use Illuminate\Support\Facades\Route;
*/
class RouteServiceProvider extends ServiceProvider
{
public const HOME = '/';
public const string HOME = '/';
protected $namespace = '';
/**

View File

@ -34,7 +34,7 @@ use SplObjectStorage;
*/
class Calculator
{
public const DEFAULT_INTERVAL = 1;
public const int DEFAULT_INTERVAL = 1;
private static ?SplObjectStorage $intervalMap = null;
private static array $intervals = [];

View File

@ -30,5 +30,5 @@ namespace FireflyIII\Support\Calendar\Periodicity;
*/
final class Bimonthly extends Monthly
{
public const INTERVAL = 2;
public const int INTERVAL = 2;
}

View File

@ -30,5 +30,5 @@ namespace FireflyIII\Support\Calendar\Periodicity;
*/
final class Fortnightly extends Weekly
{
public const INTERVAL = 2;
public const int INTERVAL = 2;
}

View File

@ -30,5 +30,5 @@ namespace FireflyIII\Support\Calendar\Periodicity;
*/
final class HalfYearly extends Monthly
{
public const INTERVAL = 6;
public const int INTERVAL = 6;
}

View File

@ -30,7 +30,7 @@ namespace FireflyIII\Support\Calendar\Periodicity;
*/
abstract class Interval implements Interspacable
{
public const INTERVAL = 1;
public const int INTERVAL = 1;
/**
* @param int $skip

View File

@ -30,5 +30,5 @@ namespace FireflyIII\Support\Calendar\Periodicity;
*/
final class Quarterly extends Monthly
{
public const INTERVAL = 3;
public const int INTERVAL = 3;
}

View File

@ -66,8 +66,8 @@ class ExportDataGenerator
{
use ConvertsDataTypes;
private const ADD_RECORD_ERR = 'Could not add record to set: %s';
private const EXPORT_ERR = 'Could not export to string: %s';
private const string ADD_RECORD_ERR = 'Could not add record to set: %s';
private const string EXPORT_ERR = 'Could not export to string: %s';
private Collection $accounts;
private Carbon $end;
private bool $exportAccounts;

View File

@ -35,15 +35,15 @@ use Illuminate\Support\Collection;
class AccountSearch implements GenericSearchInterface
{
/** @var string */
public const SEARCH_ALL = 'all';
public const string SEARCH_ALL = 'all';
/** @var string */
public const SEARCH_IBAN = 'iban';
public const string SEARCH_IBAN = 'iban';
/** @var string */
public const SEARCH_ID = 'id';
public const string SEARCH_ID = 'id';
/** @var string */
public const SEARCH_NAME = 'name';
public const string SEARCH_NAME = 'name';
/** @var string */
public const SEARCH_NUMBER = 'number';
public const string SEARCH_NUMBER = 'number';
private string $field;
private string $query;
private array $types;

View File

@ -37,8 +37,8 @@ use Psr\Container\NotFoundExceptionInterface;
*/
class OAuthKeys
{
private const PRIVATE_KEY = 'oauth_private_key';
private const PUBLIC_KEY = 'oauth_public_key';
private const string PRIVATE_KEY = 'oauth_private_key';
private const string PUBLIC_KEY = 'oauth_public_key';
/**
*

View File

@ -33,7 +33,7 @@ use Illuminate\Validation\Validator;
*/
trait CurrencyValidation
{
public const TEST = 'Test';
public const string TEST = 'Test';
/**
* If the transactions contain foreign amounts, there must also be foreign currency information.

View File

@ -65,7 +65,7 @@
}
],
"require": {
"php": ">=8.2",
"php": ">=8.3",
"ext-bcmath": "*",
"ext-curl": "*",
"ext-fileinfo": "*",
@ -186,9 +186,6 @@
]
},
"config": {
"platform": {
"php": "8.2"
},
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true,

519
composer.lock generated

File diff suppressed because it is too large Load Diff