diff --git a/.ci/phpstan.neon b/.ci/phpstan.neon index b9701c47a8..5f63b86612 100644 --- a/.ci/phpstan.neon +++ b/.ci/phpstan.neon @@ -74,5 +74,5 @@ parameters: - ../bootstrap/app.php # The level 8 is the highest level. original was 5 - level: 2 + level: 4 diff --git a/app/Console/Commands/System/VerifySecurityAlerts.php b/app/Console/Commands/System/VerifySecurityAlerts.php index a181e3db77..f9ee68fed8 100644 --- a/app/Console/Commands/System/VerifySecurityAlerts.php +++ b/app/Console/Commands/System/VerifySecurityAlerts.php @@ -66,7 +66,7 @@ class VerifySecurityAlerts extends Command $version = config('firefly.version'); $disk = Storage::disk('resources'); // Next line is ignored because it's a Laravel Facade. - if (!$disk->has('alerts.json')) { + if (!$disk->has('alerts.json')) { // @phpstan-ignore-line app('log')->debug('No alerts.json file present.'); return 0; diff --git a/app/Exceptions/IntervalException.php b/app/Exceptions/IntervalException.php index f2307c9783..d67fcab253 100644 --- a/app/Exceptions/IntervalException.php +++ b/app/Exceptions/IntervalException.php @@ -35,9 +35,9 @@ use Throwable; final class IntervalException extends Exception { - public readonly array $availableIntervals; - public readonly Periodicity $periodicity; - protected $message = 'The periodicity %s is unknown. Choose one of available periodicity: %s'; + public array $availableIntervals; + public Periodicity $periodicity; + protected $message = 'The periodicity %s is unknown. Choose one of available periodicity: %s'; public function __construct(string $message = "", int $code = 0, ?Throwable $previous = null) { diff --git a/app/Handlers/Events/Model/BudgetLimitHandler.php b/app/Handlers/Events/Model/BudgetLimitHandler.php index d9a1c2f3a4..74352e9027 100644 --- a/app/Handlers/Events/Model/BudgetLimitHandler.php +++ b/app/Handlers/Events/Model/BudgetLimitHandler.php @@ -251,7 +251,7 @@ class BudgetLimitHandler { app('log')->debug(sprintf('BudgetLimitHandler::deleted(#%s)', $event->budgetLimit->id)); $budgetLimit = $event->budgetLimit; - $budgetLimit->id = null; + $budgetLimit->id = 0; $this->updateAvailableBudget($event->budgetLimit); } diff --git a/app/Handlers/Observer/PiggyBankObserver.php b/app/Handlers/Observer/PiggyBankObserver.php index e448e8378b..999aa831f8 100644 --- a/app/Handlers/Observer/PiggyBankObserver.php +++ b/app/Handlers/Observer/PiggyBankObserver.php @@ -43,7 +43,7 @@ class PiggyBankObserver $repetition->piggyBank()->associate($piggyBank); $repetition->startdate = $piggyBank->startdate; $repetition->targetdate = $piggyBank->targetdate; - $repetition->currentamount = 0; + $repetition->currentamount = '0'; $repetition->save(); } diff --git a/app/Handlers/Observer/WebhookObserver.php b/app/Handlers/Observer/WebhookObserver.php index dd19ebacb5..d7dd0dbca9 100644 --- a/app/Handlers/Observer/WebhookObserver.php +++ b/app/Handlers/Observer/WebhookObserver.php @@ -38,7 +38,7 @@ class WebhookObserver public function deleting(Webhook $webhook): void { app('log')->debug('Observe "deleting" of a webhook.'); - foreach ($webhook->webhookMessages() as $message) { + foreach ($webhook->webhookMessages()->get() as $message) { $message->delete(); } } diff --git a/app/Helpers/Report/NetWorth.php b/app/Helpers/Report/NetWorth.php index 009ca33d76..eb56b0df28 100644 --- a/app/Helpers/Report/NetWorth.php +++ b/app/Helpers/Report/NetWorth.php @@ -159,7 +159,7 @@ class NetWorth implements NetWorthInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null === $user) { + if (!($user instanceof User)) { return; } $this->user = $user; diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index 5f2d7975ed..cfa14e62f8 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -327,12 +327,12 @@ class ReportController extends Controller * * @param ReportFormRequest $request * - * @return RedirectResponse|Redirector + * @return RedirectResponse|Redirector|View * * @throws FireflyException * */ - public function postIndex(ReportFormRequest $request) + public function postIndex(ReportFormRequest $request): RedirectResponse|Redirector|View { // report type: $reportType = $request->get('report_type'); diff --git a/app/Http/Controllers/Rule/SelectController.php b/app/Http/Controllers/Rule/SelectController.php index 3255f17e2c..5a79336a7c 100644 --- a/app/Http/Controllers/Rule/SelectController.php +++ b/app/Http/Controllers/Rule/SelectController.php @@ -107,9 +107,9 @@ class SelectController extends Controller * * @param Rule $rule * - * @return Factory|View + * @return Factory|View|RedirectResponse */ - public function selectTransactions(Rule $rule) + public function selectTransactions(Rule $rule): Factory|View|RedirectResponse { if (false === $rule->active) { session()->flash('warning', trans('firefly.cannot_fire_inactive_rules')); diff --git a/app/Http/Controllers/System/InstallController.php b/app/Http/Controllers/System/InstallController.php index 946c1c008b..61f3b8ef9f 100644 --- a/app/Http/Controllers/System/InstallController.php +++ b/app/Http/Controllers/System/InstallController.php @@ -166,11 +166,8 @@ class InstallController extends Controller */ public function keys(): void { - // switch on PHP version. - $keys = []; - // switch on class existence. - app('log')->info('Will run PHP8 code.'); - $keys = RSA::createKey(4096); + + $key = RSA::createKey(4096); [$publicKey, $privateKey] = [ Passport::keyPath('oauth-public.key'), @@ -181,7 +178,7 @@ class InstallController extends Controller return; } - file_put_contents($publicKey, $keys['publickey']); - file_put_contents($privateKey, $keys['privatekey']); + file_put_contents($publicKey, (string) $key->getPublicKey()); + file_put_contents($privateKey, $key->toString('PKCS1')); } } diff --git a/app/Jobs/CreateAutoBudgetLimits.php b/app/Jobs/CreateAutoBudgetLimits.php index 72601de596..70f5d09009 100644 --- a/app/Jobs/CreateAutoBudgetLimits.php +++ b/app/Jobs/CreateAutoBudgetLimits.php @@ -240,7 +240,7 @@ class CreateAutoBudgetLimits implements ShouldQueue $budgetLimit->end_date = $end; $budgetLimit->amount = $amount ?? $autoBudget->amount; $budgetLimit->period = $autoBudget->period; - $budgetLimit->generated = true; + $budgetLimit->generated = 1; $budgetLimit->save(); app('log')->debug(sprintf('Created budget limit #%d.', $budgetLimit->id)); diff --git a/app/Models/Account.php b/app/Models/Account.php index 4271f1c4ca..7c12a111ad 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -43,9 +43,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; * Class Account * * @property int $id - * @property \Illuminate\Support\Carbon|null $created_at - * @property \Illuminate\Support\Carbon|null $updated_at - * @property \Illuminate\Support\Carbon|null $deleted_at + * @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 string $name diff --git a/app/Models/AccountMeta.php b/app/Models/AccountMeta.php index 2cf48336f8..ad60404040 100644 --- a/app/Models/AccountMeta.php +++ b/app/Models/AccountMeta.php @@ -27,7 +27,7 @@ use Eloquent; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; -use Illuminate\Support\Carbon; +use Carbon\Carbon; /** * Class AccountMeta diff --git a/app/Models/AccountType.php b/app/Models/AccountType.php index b166052150..076ff9675c 100644 --- a/app/Models/AccountType.php +++ b/app/Models/AccountType.php @@ -28,7 +28,7 @@ use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; -use Illuminate\Support\Carbon; +use Carbon\Carbon; /** * FireflyIII\Models\AccountType diff --git a/app/Models/Attachment.php b/app/Models/Attachment.php index 235a8c1663..71b7da418a 100644 --- a/app/Models/Attachment.php +++ b/app/Models/Attachment.php @@ -32,7 +32,7 @@ use Illuminate\Database\Eloquent\Relations\MorphMany; use Illuminate\Database\Eloquent\Relations\MorphTo; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Query\Builder; -use Illuminate\Support\Carbon; +use Carbon\Carbon; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** diff --git a/app/Models/AuditLogEntry.php b/app/Models/AuditLogEntry.php index fac7d1a7ef..07e0cdd37a 100644 --- a/app/Models/AuditLogEntry.php +++ b/app/Models/AuditLogEntry.php @@ -29,7 +29,7 @@ use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\MorphTo; use Illuminate\Database\Eloquent\SoftDeletes; -use Illuminate\Support\Carbon; +use Carbon\Carbon; /** * Class AuditLogEntry diff --git a/app/Models/AutoBudget.php b/app/Models/AutoBudget.php index 41f446da71..7f41e43db9 100644 --- a/app/Models/AutoBudget.php +++ b/app/Models/AutoBudget.php @@ -30,7 +30,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Query\Builder; -use Illuminate\Support\Carbon; +use Carbon\Carbon; /** * FireflyIII\Models\AutoBudget diff --git a/app/Models/AvailableBudget.php b/app/Models/AvailableBudget.php index eac01d5043..897380870f 100644 --- a/app/Models/AvailableBudget.php +++ b/app/Models/AvailableBudget.php @@ -30,7 +30,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Query\Builder; -use Illuminate\Support\Carbon; +use Carbon\Carbon; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** diff --git a/app/Models/Bill.php b/app/Models/Bill.php index f9f2510fc2..546186428a 100644 --- a/app/Models/Bill.php +++ b/app/Models/Bill.php @@ -33,7 +33,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\MorphMany; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Query\Builder; -use Illuminate\Support\Carbon; +use Carbon\Carbon; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** diff --git a/app/Models/Budget.php b/app/Models/Budget.php index 88e6a30138..df9dc5f460 100644 --- a/app/Models/Budget.php +++ b/app/Models/Budget.php @@ -33,7 +33,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\MorphMany; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Query\Builder; -use Illuminate\Support\Carbon; +use Carbon\Carbon; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** diff --git a/app/Models/BudgetLimit.php b/app/Models/BudgetLimit.php index 59cec2c1f1..2a26b8bde5 100644 --- a/app/Models/BudgetLimit.php +++ b/app/Models/BudgetLimit.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Models; +use Carbon\Carbon; use Eloquent; use FireflyIII\Events\Model\BudgetLimit\Created; use FireflyIII\Events\Model\BudgetLimit\Deleted; @@ -31,7 +32,6 @@ use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; -use Illuminate\Support\Carbon; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** diff --git a/app/Models/Category.php b/app/Models/Category.php index dc52f22bbb..7c709b40e3 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -39,9 +39,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; * FireflyIII\Models\Category * * @property int $id - * @property \Illuminate\Support\Carbon|null $created_at - * @property \Illuminate\Support\Carbon|null $updated_at - * @property \Illuminate\Support\Carbon|null $deleted_at + * @property Carbon|null $created_at + * @property Carbon|null $updated_at + * @property Carbon|null $deleted_at * @property int $user_id * @property string $name * @property Carbon $lastActivity diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index 8abf4eb569..4a14e2cd8d 100644 --- a/app/Models/Configuration.php +++ b/app/Models/Configuration.php @@ -27,7 +27,7 @@ use Eloquent; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Query\Builder; -use Illuminate\Support\Carbon; +use Carbon\Carbon; /** * FireflyIII\Models\Configuration diff --git a/app/Models/CurrencyExchangeRate.php b/app/Models/CurrencyExchangeRate.php index 31a95e8348..da9a213139 100644 --- a/app/Models/CurrencyExchangeRate.php +++ b/app/Models/CurrencyExchangeRate.php @@ -30,7 +30,7 @@ use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\SoftDeletes; -use Illuminate\Support\Carbon; +use Carbon\Carbon; /** * Class CurrencyExchangeRate diff --git a/app/Models/GroupMembership.php b/app/Models/GroupMembership.php index 1af5447862..1ca2128374 100644 --- a/app/Models/GroupMembership.php +++ b/app/Models/GroupMembership.php @@ -29,7 +29,7 @@ use FireflyIII\User; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; -use Illuminate\Support\Carbon; +use Carbon\Carbon; /** * Class GroupMembership diff --git a/app/Models/LinkType.php b/app/Models/LinkType.php index 1703672153..bf8bac28b5 100644 --- a/app/Models/LinkType.php +++ b/app/Models/LinkType.php @@ -29,7 +29,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Query\Builder; -use Illuminate\Support\Carbon; +use Carbon\Carbon; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** diff --git a/app/Models/Location.php b/app/Models/Location.php index 76ea452351..63c8896330 100644 --- a/app/Models/Location.php +++ b/app/Models/Location.php @@ -30,7 +30,7 @@ use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\MorphMany; use Illuminate\Database\Eloquent\Relations\MorphTo; -use Illuminate\Support\Carbon; +use Carbon\Carbon; /** * FireflyIII\Models\Location diff --git a/app/Models/Note.php b/app/Models/Note.php index 1a8a2cab11..890cf9cb27 100644 --- a/app/Models/Note.php +++ b/app/Models/Note.php @@ -28,7 +28,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\MorphTo; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Query\Builder; -use Illuminate\Support\Carbon; +use Carbon\Carbon; /** * FireflyIII\Models\Note diff --git a/app/Models/ObjectGroup.php b/app/Models/ObjectGroup.php index 5524921312..9574018a5d 100644 --- a/app/Models/ObjectGroup.php +++ b/app/Models/ObjectGroup.php @@ -31,7 +31,7 @@ use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\MorphToMany; -use Illuminate\Support\Carbon; +use Carbon\Carbon; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php index ced5b6876a..b037720b67 100644 --- a/app/Models/PiggyBank.php +++ b/app/Models/PiggyBank.php @@ -33,7 +33,7 @@ use Illuminate\Database\Eloquent\Relations\MorphMany; use Illuminate\Database\Eloquent\Relations\MorphToMany; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Query\Builder; -use Illuminate\Support\Carbon; +use Carbon\Carbon; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** diff --git a/app/Models/PiggyBankEvent.php b/app/Models/PiggyBankEvent.php index 8334aac725..5cddd23b8a 100644 --- a/app/Models/PiggyBankEvent.php +++ b/app/Models/PiggyBankEvent.php @@ -28,7 +28,7 @@ use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; -use Illuminate\Support\Carbon; +use Carbon\Carbon; /** * FireflyIII\Models\PiggyBankEvent diff --git a/app/Models/PiggyBankRepetition.php b/app/Models/PiggyBankRepetition.php index c00650b38c..a7f1572fb5 100644 --- a/app/Models/PiggyBankRepetition.php +++ b/app/Models/PiggyBankRepetition.php @@ -34,11 +34,11 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; * FireflyIII\Models\PiggyBankRepetition * * @property int $id - * @property \Illuminate\Support\Carbon|null $created_at - * @property \Illuminate\Support\Carbon|null $updated_at + * @property Carbon|null $created_at + * @property Carbon|null $updated_at * @property int $piggy_bank_id - * @property \Illuminate\Support\Carbon|null $startdate - * @property \Illuminate\Support\Carbon|null $targetdate + * @property Carbon|null $startdate + * @property Carbon|null $targetdate * @property string $currentamount * @property-read PiggyBank $piggyBank * @method static EloquentBuilder|PiggyBankRepetition newModelQuery() diff --git a/app/Models/Preference.php b/app/Models/Preference.php index e83e2e60d1..0728f8e1cb 100644 --- a/app/Models/Preference.php +++ b/app/Models/Preference.php @@ -28,7 +28,7 @@ use FireflyIII\User; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; -use Illuminate\Support\Carbon; +use Carbon\Carbon; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** diff --git a/app/Models/Recurrence.php b/app/Models/Recurrence.php index df6f6f21a3..5e7f61e926 100644 --- a/app/Models/Recurrence.php +++ b/app/Models/Recurrence.php @@ -32,7 +32,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\MorphMany; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Query\Builder; -use Illuminate\Support\Carbon; +use Carbon\Carbon; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** diff --git a/app/Models/RecurrenceMeta.php b/app/Models/RecurrenceMeta.php index d5e764fb61..9e2967c506 100644 --- a/app/Models/RecurrenceMeta.php +++ b/app/Models/RecurrenceMeta.php @@ -28,7 +28,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Query\Builder; -use Illuminate\Support\Carbon; +use Carbon\Carbon; /** * FireflyIII\Models\RecurrenceMeta diff --git a/app/Models/RecurrenceRepetition.php b/app/Models/RecurrenceRepetition.php index 8e8970e4a3..889feb685a 100644 --- a/app/Models/RecurrenceRepetition.php +++ b/app/Models/RecurrenceRepetition.php @@ -28,7 +28,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Query\Builder; -use Illuminate\Support\Carbon; +use Carbon\Carbon; /** * FireflyIII\Models\RecurrenceRepetition diff --git a/app/Models/RecurrenceTransaction.php b/app/Models/RecurrenceTransaction.php index e7911de4a7..54db032bb8 100644 --- a/app/Models/RecurrenceTransaction.php +++ b/app/Models/RecurrenceTransaction.php @@ -31,7 +31,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Query\Builder; -use Illuminate\Support\Carbon; +use Carbon\Carbon; /** * FireflyIII\Models\RecurrenceTransaction diff --git a/app/Models/RecurrenceTransactionMeta.php b/app/Models/RecurrenceTransactionMeta.php index c290cba2fb..e6a54d689f 100644 --- a/app/Models/RecurrenceTransactionMeta.php +++ b/app/Models/RecurrenceTransactionMeta.php @@ -28,7 +28,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Query\Builder; -use Illuminate\Support\Carbon; +use Carbon\Carbon; /** * FireflyIII\Models\RecurrenceTransactionMeta diff --git a/app/Models/Role.php b/app/Models/Role.php index d9cb20b297..0f4700ecd3 100644 --- a/app/Models/Role.php +++ b/app/Models/Role.php @@ -29,7 +29,7 @@ use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsToMany; -use Illuminate\Support\Carbon; +use Carbon\Carbon; /** * FireflyIII\Models\Role diff --git a/app/Models/Rule.php b/app/Models/Rule.php index 18e2e6d1dd..c3fc8bcf04 100644 --- a/app/Models/Rule.php +++ b/app/Models/Rule.php @@ -31,7 +31,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Query\Builder; -use Illuminate\Support\Carbon; +use Carbon\Carbon; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** diff --git a/app/Models/RuleAction.php b/app/Models/RuleAction.php index 977aa71354..5ea117d134 100644 --- a/app/Models/RuleAction.php +++ b/app/Models/RuleAction.php @@ -27,7 +27,7 @@ use Eloquent; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; -use Illuminate\Support\Carbon; +use Carbon\Carbon; /** * FireflyIII\Models\RuleAction diff --git a/app/Models/RuleGroup.php b/app/Models/RuleGroup.php index ae8863fdd3..14768e34fb 100644 --- a/app/Models/RuleGroup.php +++ b/app/Models/RuleGroup.php @@ -31,7 +31,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Query\Builder; -use Illuminate\Support\Carbon; +use Carbon\Carbon; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** diff --git a/app/Models/RuleTrigger.php b/app/Models/RuleTrigger.php index 20cf189375..dd1954569e 100644 --- a/app/Models/RuleTrigger.php +++ b/app/Models/RuleTrigger.php @@ -27,7 +27,7 @@ use Eloquent; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; -use Illuminate\Support\Carbon; +use Carbon\Carbon; /** * FireflyIII\Models\RuleTrigger diff --git a/app/Models/Tag.php b/app/Models/Tag.php index 1e0e28fd14..95f8709ff7 100644 --- a/app/Models/Tag.php +++ b/app/Models/Tag.php @@ -32,7 +32,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\MorphMany; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Query\Builder; -use Illuminate\Support\Carbon; +use Carbon\Carbon; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php index b726594471..78e35d6de0 100644 --- a/app/Models/Transaction.php +++ b/app/Models/Transaction.php @@ -38,9 +38,9 @@ use Illuminate\Database\Eloquent\SoftDeletes; * FireflyIII\Models\Transaction * * @property int $id - * @property \Illuminate\Support\Carbon|null $created_at - * @property \Illuminate\Support\Carbon|null $updated_at - * @property \Illuminate\Support\Carbon|null $deleted_at + * @property Carbon|null $created_at + * @property Carbon|null $updated_at + * @property Carbon|null $deleted_at * @property bool $reconciled * @property int $account_id * @property int $transaction_journal_id diff --git a/app/Models/TransactionCurrency.php b/app/Models/TransactionCurrency.php index e94adc077c..a55a0bd923 100644 --- a/app/Models/TransactionCurrency.php +++ b/app/Models/TransactionCurrency.php @@ -31,7 +31,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Query\Builder; -use Illuminate\Support\Carbon; +use Carbon\Carbon; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** diff --git a/app/Models/TransactionGroup.php b/app/Models/TransactionGroup.php index 5d88cad7e7..8280932837 100644 --- a/app/Models/TransactionGroup.php +++ b/app/Models/TransactionGroup.php @@ -31,7 +31,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Query\Builder; -use Illuminate\Support\Carbon; +use Carbon\Carbon; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** diff --git a/app/Models/TransactionJournalLink.php b/app/Models/TransactionJournalLink.php index 30740c9990..f393689427 100644 --- a/app/Models/TransactionJournalLink.php +++ b/app/Models/TransactionJournalLink.php @@ -29,7 +29,7 @@ use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\MorphMany; -use Illuminate\Support\Carbon; +use Carbon\Carbon; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** diff --git a/app/Models/TransactionJournalMeta.php b/app/Models/TransactionJournalMeta.php index 7c27a31e88..b9814eb5e5 100644 --- a/app/Models/TransactionJournalMeta.php +++ b/app/Models/TransactionJournalMeta.php @@ -28,7 +28,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Query\Builder; -use Illuminate\Support\Carbon; +use Carbon\Carbon; /** * FireflyIII\Models\TransactionJournalMeta diff --git a/app/Models/TransactionType.php b/app/Models/TransactionType.php index 3fc2d21efc..ec99eccf9f 100644 --- a/app/Models/TransactionType.php +++ b/app/Models/TransactionType.php @@ -29,7 +29,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Query\Builder; -use Illuminate\Support\Carbon; +use Carbon\Carbon; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** diff --git a/app/Models/UserGroup.php b/app/Models/UserGroup.php index fdfa22d631..bc7172e0c0 100644 --- a/app/Models/UserGroup.php +++ b/app/Models/UserGroup.php @@ -33,7 +33,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasManyThrough; -use Illuminate\Support\Carbon; +use Carbon\Carbon; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** diff --git a/app/Models/UserRole.php b/app/Models/UserRole.php index 5dbfa9b27c..3085393a5c 100644 --- a/app/Models/UserRole.php +++ b/app/Models/UserRole.php @@ -29,7 +29,7 @@ use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; -use Illuminate\Support\Carbon; +use Carbon\Carbon; /** * Class UserRole diff --git a/app/Models/Webhook.php b/app/Models/Webhook.php index 4d8a64bf7f..8df214cade 100644 --- a/app/Models/Webhook.php +++ b/app/Models/Webhook.php @@ -34,7 +34,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\SoftDeletes; -use Illuminate\Support\Carbon; +use Carbon\Carbon; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** diff --git a/app/Models/WebhookAttempt.php b/app/Models/WebhookAttempt.php index 2dd236663e..7e6bda4a60 100644 --- a/app/Models/WebhookAttempt.php +++ b/app/Models/WebhookAttempt.php @@ -29,7 +29,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Query\Builder; -use Illuminate\Support\Carbon; +use Carbon\Carbon; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** diff --git a/app/Models/WebhookMessage.php b/app/Models/WebhookMessage.php index f04bafae99..1330396d4d 100644 --- a/app/Models/WebhookMessage.php +++ b/app/Models/WebhookMessage.php @@ -31,7 +31,7 @@ use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; -use Illuminate\Support\Carbon; +use Carbon\Carbon; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index 08cb517328..6ff16fff20 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -250,7 +250,7 @@ class AccountRepository implements AccountRepositoryInterface static function (Attachment $attachment) use ($disk) { $notes = $attachment->notes()->first(); $attachment->file_exists = $disk->exists($attachment->fileName()); - $attachment->notes = $notes ? $notes->text : ''; + $attachment->notes_text = $notes ? $notes->text : ''; return $attachment; } @@ -279,7 +279,7 @@ class AccountRepository implements AccountRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } diff --git a/app/Repositories/Account/AccountTasker.php b/app/Repositories/Account/AccountTasker.php index 692a89a397..2711baa589 100644 --- a/app/Repositories/Account/AccountTasker.php +++ b/app/Repositories/Account/AccountTasker.php @@ -315,7 +315,7 @@ class AccountTasker implements AccountTaskerInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } diff --git a/app/Repositories/Account/OperationsRepository.php b/app/Repositories/Account/OperationsRepository.php index df5a0fa99e..a6e44b860e 100644 --- a/app/Repositories/Account/OperationsRepository.php +++ b/app/Repositories/Account/OperationsRepository.php @@ -83,7 +83,7 @@ class OperationsRepository implements OperationsRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } diff --git a/app/Repositories/Attachment/AttachmentRepository.php b/app/Repositories/Attachment/AttachmentRepository.php index 99c2fcc2e4..e3c0392007 100644 --- a/app/Repositories/Attachment/AttachmentRepository.php +++ b/app/Repositories/Attachment/AttachmentRepository.php @@ -156,7 +156,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php index 2d73d404aa..250734caf5 100644 --- a/app/Repositories/Bill/BillRepository.php +++ b/app/Repositories/Bill/BillRepository.php @@ -199,7 +199,7 @@ class BillRepository implements BillRepositoryInterface static function (Attachment $attachment) use ($disk) { $notes = $attachment->notes()->first(); $attachment->file_exists = $disk->exists($attachment->fileName()); - $attachment->notes = $notes ? $notes->text : ''; + $attachment->notes_text = $notes ? $notes->text : ''; return $attachment; } @@ -344,7 +344,7 @@ class BillRepository implements BillRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } diff --git a/app/Repositories/Budget/AvailableBudgetRepository.php b/app/Repositories/Budget/AvailableBudgetRepository.php index 86ef18f8c4..4aedcc6608 100644 --- a/app/Repositories/Budget/AvailableBudgetRepository.php +++ b/app/Repositories/Budget/AvailableBudgetRepository.php @@ -248,8 +248,8 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface $availableBudget = new AvailableBudget(); $availableBudget->user()->associate($this->user); $availableBudget->transactionCurrency()->associate($currency); - $availableBudget->start_date = $start->format('Y-m-d'); - $availableBudget->end_date = $end->format('Y-m-d'); + $availableBudget->start_date = $start->startOfDay(); + $availableBudget->end_date = $end->endOfDay(); } $availableBudget->amount = $amount; $availableBudget->save(); @@ -262,7 +262,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } diff --git a/app/Repositories/Budget/BudgetLimitRepository.php b/app/Repositories/Budget/BudgetLimitRepository.php index 09869e9dad..92ba3fae56 100644 --- a/app/Repositories/Budget/BudgetLimitRepository.php +++ b/app/Repositories/Budget/BudgetLimitRepository.php @@ -275,7 +275,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php index caceb91a35..4cef859d8d 100644 --- a/app/Repositories/Budget/BudgetRepository.php +++ b/app/Repositories/Budget/BudgetRepository.php @@ -148,7 +148,7 @@ class BudgetRepository implements BudgetRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } @@ -589,7 +589,7 @@ class BudgetRepository implements BudgetRepositoryInterface static function (Attachment $attachment) use ($disk) { $notes = $attachment->notes()->first(); $attachment->file_exists = $disk->exists($attachment->fileName()); - $attachment->notes = $notes ? $notes->text : ''; + $attachment->notes_text = $notes ? $notes->text : ''; return $attachment; } diff --git a/app/Repositories/Budget/NoBudgetRepository.php b/app/Repositories/Budget/NoBudgetRepository.php index 037a3c3a08..028b91d52f 100644 --- a/app/Repositories/Budget/NoBudgetRepository.php +++ b/app/Repositories/Budget/NoBudgetRepository.php @@ -143,7 +143,7 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } diff --git a/app/Repositories/Budget/OperationsRepository.php b/app/Repositories/Budget/OperationsRepository.php index 61b646f9f0..ba03116cfd 100644 --- a/app/Repositories/Budget/OperationsRepository.php +++ b/app/Repositories/Budget/OperationsRepository.php @@ -204,7 +204,7 @@ class OperationsRepository implements OperationsRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.php index 1f1f05091d..06422c0bde 100644 --- a/app/Repositories/Category/CategoryRepository.php +++ b/app/Repositories/Category/CategoryRepository.php @@ -200,7 +200,7 @@ class CategoryRepository implements CategoryRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } @@ -306,7 +306,7 @@ class CategoryRepository implements CategoryRepositoryInterface static function (Attachment $attachment) use ($disk) { $notes = $attachment->notes()->first(); $attachment->file_exists = $disk->exists($attachment->fileName()); - $attachment->notes = $notes ? $notes->text : ''; + $attachment->notes_text = $notes ? $notes->text : ''; return $attachment; } diff --git a/app/Repositories/Category/NoCategoryRepository.php b/app/Repositories/Category/NoCategoryRepository.php index f43f674c87..9560ab49c4 100644 --- a/app/Repositories/Category/NoCategoryRepository.php +++ b/app/Repositories/Category/NoCategoryRepository.php @@ -95,7 +95,7 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } diff --git a/app/Repositories/Category/OperationsRepository.php b/app/Repositories/Category/OperationsRepository.php index 9211a0d060..220ffb87db 100644 --- a/app/Repositories/Category/OperationsRepository.php +++ b/app/Repositories/Category/OperationsRepository.php @@ -121,7 +121,7 @@ class OperationsRepository implements OperationsRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.php index 3a85e29560..6015a872ee 100644 --- a/app/Repositories/Currency/CurrencyRepository.php +++ b/app/Repositories/Currency/CurrencyRepository.php @@ -76,7 +76,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface { if ($fromCurrency->id === $toCurrency->id) { $rate = new CurrencyExchangeRate(); - $rate->rate = 1; + $rate->rate = "1"; $rate->id = 0; return $rate; @@ -123,7 +123,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } diff --git a/app/Repositories/Journal/JournalAPIRepository.php b/app/Repositories/Journal/JournalAPIRepository.php index 6eb5f743a1..9aea1b3128 100644 --- a/app/Repositories/Journal/JournalAPIRepository.php +++ b/app/Repositories/Journal/JournalAPIRepository.php @@ -74,7 +74,7 @@ class JournalAPIRepository implements JournalAPIRepositoryInterface static function (Attachment $attachment) use ($disk) { $notes = $attachment->notes()->first(); $attachment->file_exists = $disk->exists($attachment->fileName()); - $attachment->notes = $notes ? $notes->text : ''; // TODO should not set notes like this. + $attachment->notes_text = $notes ? $notes->text : ''; // TODO should not set notes like this. return $attachment; } @@ -115,7 +115,7 @@ class JournalAPIRepository implements JournalAPIRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php index bf34aa5c94..b6febf258a 100644 --- a/app/Repositories/Journal/JournalRepository.php +++ b/app/Repositories/Journal/JournalRepository.php @@ -257,7 +257,7 @@ class JournalRepository implements JournalRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } diff --git a/app/Repositories/LinkType/LinkTypeRepository.php b/app/Repositories/LinkType/LinkTypeRepository.php index f0600088f2..71bb0989f1 100644 --- a/app/Repositories/LinkType/LinkTypeRepository.php +++ b/app/Repositories/LinkType/LinkTypeRepository.php @@ -209,7 +209,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } diff --git a/app/Repositories/ObjectGroup/ObjectGroupRepository.php b/app/Repositories/ObjectGroup/ObjectGroupRepository.php index 2ed56112e2..28a8d4aafa 100644 --- a/app/Repositories/ObjectGroup/ObjectGroupRepository.php +++ b/app/Repositories/ObjectGroup/ObjectGroupRepository.php @@ -155,7 +155,7 @@ class ObjectGroupRepository implements ObjectGroupRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php index fbda675b2d..8ddadbba88 100644 --- a/app/Repositories/PiggyBank/PiggyBankRepository.php +++ b/app/Repositories/PiggyBank/PiggyBankRepository.php @@ -125,7 +125,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface static function (Attachment $attachment) use ($disk) { $notes = $attachment->notes()->first(); $attachment->file_exists = $disk->exists($attachment->fileName()); - $attachment->notes = $notes ? $notes->text : ''; // TODO setting the text to the 'notes' field doesn't work. + $attachment->notes_text = $notes ? $notes->text : ''; return $attachment; } @@ -278,7 +278,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } diff --git a/app/Repositories/Recurring/RecurringRepository.php b/app/Repositories/Recurring/RecurringRepository.php index e1f9e36ec1..22977319ab 100644 --- a/app/Repositories/Recurring/RecurringRepository.php +++ b/app/Repositories/Recurring/RecurringRepository.php @@ -349,7 +349,7 @@ class RecurringRepository implements RecurringRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } diff --git a/app/Repositories/Rule/RuleRepository.php b/app/Repositories/Rule/RuleRepository.php index 8cb8832881..3815e05251 100644 --- a/app/Repositories/Rule/RuleRepository.php +++ b/app/Repositories/Rule/RuleRepository.php @@ -366,7 +366,7 @@ class RuleRepository implements RuleRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } diff --git a/app/Repositories/RuleGroup/RuleGroupRepository.php b/app/Repositories/RuleGroup/RuleGroupRepository.php index ec72f74c2c..9ff584e7e7 100644 --- a/app/Repositories/RuleGroup/RuleGroupRepository.php +++ b/app/Repositories/RuleGroup/RuleGroupRepository.php @@ -447,7 +447,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } diff --git a/app/Repositories/Tag/OperationsRepository.php b/app/Repositories/Tag/OperationsRepository.php index 874afc2f4e..0ea45c2fd0 100644 --- a/app/Repositories/Tag/OperationsRepository.php +++ b/app/Repositories/Tag/OperationsRepository.php @@ -124,7 +124,7 @@ class OperationsRepository implements OperationsRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php index adbd52d126..fefa4f9135 100644 --- a/app/Repositories/Tag/TagRepository.php +++ b/app/Repositories/Tag/TagRepository.php @@ -113,7 +113,7 @@ class TagRepository implements TagRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User ) { $this->user = $user; } } diff --git a/app/Repositories/TransactionGroup/TransactionGroupRepository.php b/app/Repositories/TransactionGroup/TransactionGroupRepository.php index 4b33a4935c..4d22bdc832 100644 --- a/app/Repositories/TransactionGroup/TransactionGroupRepository.php +++ b/app/Repositories/TransactionGroup/TransactionGroupRepository.php @@ -193,7 +193,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof user) { $this->user = $user; } } diff --git a/app/Repositories/UserGroup/UserGroupRepository.php b/app/Repositories/UserGroup/UserGroupRepository.php index 4156df6cc3..4cf7559b9f 100644 --- a/app/Repositories/UserGroup/UserGroupRepository.php +++ b/app/Repositories/UserGroup/UserGroupRepository.php @@ -182,7 +182,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface public function setUser(Authenticatable | User | null $user): void { app('log')->debug(sprintf('Now in %s', __METHOD__)); - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } diff --git a/app/Repositories/UserGroups/Account/AccountRepositoryInterface.php b/app/Repositories/UserGroups/Account/AccountRepositoryInterface.php index 600419b790..8bacdc32f4 100644 --- a/app/Repositories/UserGroups/Account/AccountRepositoryInterface.php +++ b/app/Repositories/UserGroups/Account/AccountRepositoryInterface.php @@ -27,6 +27,7 @@ namespace FireflyIII\Repositories\UserGroups\Account; use FireflyIII\Models\Account; use FireflyIII\Models\TransactionCurrency; +use FireflyIII\Models\UserGroup; use FireflyIII\User; use Illuminate\Support\Collection; @@ -35,6 +36,12 @@ use Illuminate\Support\Collection; */ interface AccountRepositoryInterface { + /** + * @param UserGroup $userGroup + * + * @return void + */ + public function setUserGroup(UserGroup $userGroup): void; /** * @param User $user diff --git a/app/Repositories/UserGroups/Budget/BudgetRepositoryInterface.php b/app/Repositories/UserGroups/Budget/BudgetRepositoryInterface.php index 7f65743397..51a1733743 100644 --- a/app/Repositories/UserGroups/Budget/BudgetRepositoryInterface.php +++ b/app/Repositories/UserGroups/Budget/BudgetRepositoryInterface.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace FireflyIII\Repositories\UserGroups\Budget; +use FireflyIII\Models\UserGroup; use FireflyIII\User; use Illuminate\Support\Collection; @@ -39,6 +40,13 @@ interface BudgetRepositoryInterface * @return void */ public function setUser(User $user): void; + + /** + * @param UserGroup $userGroup + * + * @return void + */ + public function setUserGroup(UserGroup $userGroup): void; /** * @return Collection */ diff --git a/app/Repositories/Webhook/WebhookRepository.php b/app/Repositories/Webhook/WebhookRepository.php index 451e376bae..12a28bf15d 100644 --- a/app/Repositories/Webhook/WebhookRepository.php +++ b/app/Repositories/Webhook/WebhookRepository.php @@ -109,7 +109,7 @@ class WebhookRepository implements WebhookRepositoryInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } diff --git a/app/Rules/ValidRecurrenceRepetitionType.php b/app/Rules/ValidRecurrenceRepetitionType.php index 50505a64e7..2181e3532d 100644 --- a/app/Rules/ValidRecurrenceRepetitionType.php +++ b/app/Rules/ValidRecurrenceRepetitionType.php @@ -36,11 +36,9 @@ class ValidRecurrenceRepetitionType implements ValidationRule /** * Determine if the validation rule passes. * - * @param string $attribute - * @param mixed $value - * - * @return bool - * + * @param string $attribute + * @param mixed $value + * @param Closure $fail */ public function validate(string $attribute, mixed $value, Closure $fail): void { diff --git a/app/Support/Amount.php b/app/Support/Amount.php index 8352d1e077..8b13ae0fee 100644 --- a/app/Support/Amount.php +++ b/app/Support/Amount.php @@ -136,7 +136,7 @@ class Amount } /** - * @param User $user + * @param UserGroup $userGroup * * @return TransactionCurrency */ diff --git a/app/Support/Http/Controllers/CreateStuff.php b/app/Support/Http/Controllers/CreateStuff.php index a856a2ea64..8715acb9b6 100644 --- a/app/Support/Http/Controllers/CreateStuff.php +++ b/app/Support/Http/Controllers/CreateStuff.php @@ -112,12 +112,12 @@ trait CreateStuff return; } - $keys = RSA::createKey(4096); + $key = RSA::createKey(4096); Log::alert('NO OAuth keys were found. They have been created.'); - file_put_contents($publicKey, $keys['publickey']); - file_put_contents($privateKey, $keys['privatekey']); + file_put_contents($publicKey, (string) $key->getPublicKey()); + file_put_contents($privateKey, $key->toString('PKCS1')); } /** diff --git a/app/Support/Repositories/UserGroup/UserGroupTrait.php b/app/Support/Repositories/UserGroup/UserGroupTrait.php index 87e18cb43c..9db484dc58 100644 --- a/app/Support/Repositories/UserGroup/UserGroupTrait.php +++ b/app/Support/Repositories/UserGroup/UserGroupTrait.php @@ -66,7 +66,7 @@ trait UserGroupTrait */ public function setUser(Authenticatable | User | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; $this->userGroup = $user->userGroup; } diff --git a/app/Support/Search/AccountSearch.php b/app/Support/Search/AccountSearch.php index 7ca86aa79e..b333023473 100644 --- a/app/Support/Search/AccountSearch.php +++ b/app/Support/Search/AccountSearch.php @@ -139,7 +139,7 @@ class AccountSearch implements GenericSearchInterface */ public function setUser(User | Authenticatable | null $user): void { - if (null !== $user) { + if ($user instanceof User) { $this->user = $user; } } diff --git a/app/Transformers/V2/PiggyBankTransformer.php b/app/Transformers/V2/PiggyBankTransformer.php index bb3abdd430..141d15b64d 100644 --- a/app/Transformers/V2/PiggyBankTransformer.php +++ b/app/Transformers/V2/PiggyBankTransformer.php @@ -239,7 +239,12 @@ class PiggyBankTransformer extends AbstractTransformer } /** - * @return string|null + * @param string $currentAmount + * @param string $targetAmount + * @param Carbon|null $startDate + * @param Carbon|null $targetDate + * + * @return string */ private function getSuggestedMonthlyAmount(string $currentAmount, string $targetAmount, ?Carbon $startDate, ?Carbon $targetDate): string { diff --git a/app/User.php b/app/User.php index 0effda5f39..de4e8640b3 100644 --- a/app/User.php +++ b/app/User.php @@ -66,7 +66,7 @@ use Illuminate\Notifications\DatabaseNotification; use Illuminate\Notifications\DatabaseNotificationCollection; use Illuminate\Notifications\Notifiable; use Illuminate\Notifications\Notification; -use Illuminate\Support\Carbon; +use Carbon\Carbon; use Illuminate\Support\Collection; use Illuminate\Support\Str; use Laravel\Passport\Client; @@ -389,7 +389,8 @@ class User extends Authenticatable * * @param UserGroup $userGroup * @param UserRoleEnum $role - * @param bool $allowOverride + * @param bool $allowGroupOverride + * @param bool $allowSystemOverride * * @return bool */ diff --git a/resources/views/list/attachments.twig b/resources/views/list/attachments.twig index 91b33089b8..e67e669062 100644 --- a/resources/views/list/attachments.twig +++ b/resources/views/list/attachments.twig @@ -27,8 +27,8 @@ {% endif %} ({{ attachment.size|filesize }}) - {% if null != attachment.notes and '' != attachment.notes %} - {{ attachment.notes|default('')|markdown }} + {% if null != attachment.notes_text and '' != attachment.notes_text %} + {{ attachment.notes_text|default('')|markdown }} {% endif %} {% endif %} {% if not attachment.file_exists %}