diff --git a/.ci/php-cs-fixer/.php-cs-fixer.php b/.ci/php-cs-fixer/.php-cs-fixer.php index 9ecec0fc77..51e31775a7 100644 --- a/.ci/php-cs-fixer/.php-cs-fixer.php +++ b/.ci/php-cs-fixer/.php-cs-fixer.php @@ -53,6 +53,9 @@ return $config->setRules( 'statement_indentation' => true, 'void_return' => true, + // about importing statements + 'global_namespace_import' => ['import_classes' => true, 'import_constants' => true, 'import_functions' => true], + // disabled rules 'native_function_invocation' => false, // annoying 'php_unit_data_provider_name' => false, // bloody annoying long test names diff --git a/.ci/phpcs.sh b/.ci/phpcs.sh index 3d6dc02c62..16487b2411 100755 --- a/.ci/phpcs.sh +++ b/.ci/phpcs.sh @@ -29,7 +29,7 @@ rm -f .php-cs-fixer.cache PHP_CS_FIXER_IGNORE_ENV=true ./vendor/bin/php-cs-fixer fix \ --config $SCRIPT_DIR/php-cs-fixer/.php-cs-fixer.php \ --format=txt -v \ - --allow-risky=yes + --allow-risky=yes -v EXIT_CODE=$? diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index e3260c0370..1c842783e7 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -5,7 +5,6 @@ on: push: branches: - main - - develop env: DB_CONNECTION: sqlite APP_KEY: TestTestTestTestTestTestTestTest diff --git a/app/Console/Commands/Correction/CorrectsAmounts.php b/app/Console/Commands/Correction/CorrectsAmounts.php index fdc206cf80..5616908377 100644 --- a/app/Console/Commands/Correction/CorrectsAmounts.php +++ b/app/Console/Commands/Correction/CorrectsAmounts.php @@ -42,6 +42,7 @@ use FireflyIII\Support\Facades\Amount; use Illuminate\Console\Command; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; +use ValueError; class CorrectsAmounts extends Command { @@ -234,7 +235,7 @@ class CorrectsAmounts extends Command { try { $check = bccomp((string) $item->trigger_value, '0'); - } catch (\ValueError) { + } catch (ValueError) { $this->friendlyError(sprintf('Rule #%d contained invalid %s-trigger "%s". The trigger has been removed, and the rule is disabled.', $item->rule_id, $item->trigger_type, $item->trigger_value)); $item->rule->active = false; $item->rule->save(); diff --git a/app/Console/Commands/Correction/CorrectsUnevenAmount.php b/app/Console/Commands/Correction/CorrectsUnevenAmount.php index a864fcb115..5f8593800d 100644 --- a/app/Console/Commands/Correction/CorrectsUnevenAmount.php +++ b/app/Console/Commands/Correction/CorrectsUnevenAmount.php @@ -34,6 +34,8 @@ use FireflyIII\Support\Models\AccountBalanceCalculator; use Illuminate\Console\Command; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; +use ValueError; +use stdClass; class CorrectsUnevenAmount extends Command { @@ -135,7 +137,7 @@ class CorrectsUnevenAmount extends Command ->get(['transaction_journal_id', DB::raw('SUM(amount) AS the_sum')]) ; - /** @var \stdClass $entry */ + /** @var stdClass $entry */ foreach ($journals as $entry) { $sum = (string) $entry->the_sum; if (!is_numeric($sum) @@ -157,7 +159,7 @@ class CorrectsUnevenAmount extends Command try { $res = bccomp($sum, '0'); - } catch (\ValueError $e) { + } catch (ValueError $e) { $this->friendlyError(sprintf('Could not bccomp("%s", "0").', $sum)); Log::error($e->getMessage()); Log::error($e->getTraceAsString()); diff --git a/app/Console/Commands/Correction/CreatesAccessTokens.php b/app/Console/Commands/Correction/CreatesAccessTokens.php index 2dcfcb7ffd..f73e8d2258 100644 --- a/app/Console/Commands/Correction/CreatesAccessTokens.php +++ b/app/Console/Commands/Correction/CreatesAccessTokens.php @@ -28,6 +28,7 @@ use FireflyIII\Console\Commands\ShowsFriendlyMessages; use FireflyIII\Repositories\User\UserRepositoryInterface; use FireflyIII\User; use Illuminate\Console\Command; +use Exception; class CreatesAccessTokens extends Command { @@ -40,7 +41,7 @@ class CreatesAccessTokens extends Command /** * Execute the console command. * - * @throws \Exception + * @throws Exception */ public function handle(): int { diff --git a/app/Console/Commands/Correction/RemovesEmptyGroups.php b/app/Console/Commands/Correction/RemovesEmptyGroups.php index 7f64fc048a..2fac48e95b 100644 --- a/app/Console/Commands/Correction/RemovesEmptyGroups.php +++ b/app/Console/Commands/Correction/RemovesEmptyGroups.php @@ -27,6 +27,7 @@ namespace FireflyIII\Console\Commands\Correction; use FireflyIII\Console\Commands\ShowsFriendlyMessages; use FireflyIII\Models\TransactionGroup; use Illuminate\Console\Command; +use Exception; class RemovesEmptyGroups extends Command { @@ -38,7 +39,7 @@ class RemovesEmptyGroups extends Command /** * Execute the console command. * - * @throws \Exception + * @throws Exception */ public function handle(): int { diff --git a/app/Console/Commands/Correction/RemovesOrphanedTransactions.php b/app/Console/Commands/Correction/RemovesOrphanedTransactions.php index 2952fd133a..f44ee5fb0d 100644 --- a/app/Console/Commands/Correction/RemovesOrphanedTransactions.php +++ b/app/Console/Commands/Correction/RemovesOrphanedTransactions.php @@ -28,6 +28,8 @@ use FireflyIII\Console\Commands\ShowsFriendlyMessages; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use Illuminate\Console\Command; +use Exception; +use stdClass; /** * Deletes transactions where the journal has been deleted. @@ -43,7 +45,7 @@ class RemovesOrphanedTransactions extends Command /** * Execute the console command. * - * @throws \Exception + * @throws Exception */ public function handle(): int { @@ -85,7 +87,7 @@ class RemovesOrphanedTransactions extends Command } /** - * @throws \Exception + * @throws Exception */ private function deleteOrphanedTransactions(): void { @@ -102,7 +104,7 @@ class RemovesOrphanedTransactions extends Command ) ; - /** @var \stdClass $entry */ + /** @var stdClass $entry */ foreach ($set as $entry) { $transaction = Transaction::find((int) $entry->transaction_id); if (null !== $transaction) { diff --git a/app/Console/Commands/Export/ExportsData.php b/app/Console/Commands/Export/ExportsData.php index 9205749126..139d01caf2 100644 --- a/app/Console/Commands/Export/ExportsData.php +++ b/app/Console/Commands/Export/ExportsData.php @@ -35,6 +35,8 @@ use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use FireflyIII\Support\Export\ExportDataGenerator; use Illuminate\Console\Command; use Illuminate\Support\Collection; +use Exception; +use InvalidArgumentException; class ExportsData extends Command { @@ -139,7 +141,7 @@ class ExportsData extends Command /** * @throws FireflyException - * @throws \Exception + * @throws Exception */ private function parseOptions(): array { @@ -169,7 +171,7 @@ class ExportsData extends Command } /** - * @throws \Exception + * @throws Exception */ private function getDateParameter(string $field): Carbon { @@ -183,7 +185,7 @@ class ExportsData extends Command if (is_string($this->option($field))) { try { $date = Carbon::createFromFormat('!Y-m-d', $this->option($field)); - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { app('log')->error($e->getMessage()); $this->friendlyError(sprintf('%s date "%s" must be formatted YYYY-MM-DD. Field will be ignored.', $field, $this->option('start'))); $error = true; diff --git a/app/Console/Commands/Integrity/ReportsEmptyObjects.php b/app/Console/Commands/Integrity/ReportsEmptyObjects.php index 06c9d99d0c..b2d26ba555 100644 --- a/app/Console/Commands/Integrity/ReportsEmptyObjects.php +++ b/app/Console/Commands/Integrity/ReportsEmptyObjects.php @@ -30,6 +30,7 @@ use FireflyIII\Models\Budget; use FireflyIII\Models\Category; use FireflyIII\Models\Tag; use Illuminate\Console\Command; +use stdClass; class ReportsEmptyObjects extends Command { @@ -66,7 +67,7 @@ class ReportsEmptyObjects extends Command ->get(['budgets.id', 'budgets.name', 'budgets.user_id', 'users.email']) ; - /** @var \stdClass $entry */ + /** @var stdClass $entry */ foreach ($set as $entry) { $line = sprintf( 'User #%d (%s) has budget #%d ("%s") which has no transaction journals.', @@ -92,7 +93,7 @@ class ReportsEmptyObjects extends Command ->get(['categories.id', 'categories.name', 'categories.user_id', 'users.email']) ; - /** @var \stdClass $entry */ + /** @var stdClass $entry */ foreach ($set as $entry) { $line = sprintf( 'User #%d (%s) has category #%d ("%s") which has no transaction journals.', @@ -115,7 +116,7 @@ class ReportsEmptyObjects extends Command ->get(['tags.id', 'tags.tag', 'tags.user_id', 'users.email']) ; - /** @var \stdClass $entry */ + /** @var stdClass $entry */ foreach ($set as $entry) { $line = sprintf( 'User #%d (%s) has tag #%d ("%s") which has no transaction journals.', @@ -142,7 +143,7 @@ class ReportsEmptyObjects extends Command ) ; - /** @var \stdClass $entry */ + /** @var stdClass $entry */ foreach ($set as $entry) { $line = 'User #%d (%s) has account #%d ("%s") which has no transactions.'; $line = sprintf($line, $entry->user_id, $entry->email, $entry->id, $entry->name); diff --git a/app/Console/Commands/System/CreatesDatabase.php b/app/Console/Commands/System/CreatesDatabase.php index 97d644445f..1e88f7209f 100644 --- a/app/Console/Commands/System/CreatesDatabase.php +++ b/app/Console/Commands/System/CreatesDatabase.php @@ -27,6 +27,7 @@ namespace FireflyIII\Console\Commands\System; use FireflyIII\Console\Commands\ShowsFriendlyMessages; use Illuminate\Console\Command; use PDO; +use PDOException; class CreatesDatabase extends Command { @@ -53,15 +54,15 @@ class CreatesDatabase extends Command $this->friendlyLine(sprintf('DSN is %s', $dsn)); $options = [ - \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, - \PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC, - \PDO::ATTR_EMULATE_PREPARES => false, + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, + PDO::ATTR_EMULATE_PREPARES => false, ]; // when it fails, display error try { - $pdo = new \PDO($dsn, (string) env('DB_USERNAME'), (string) env('DB_PASSWORD'), $options); - } catch (\PDOException $e) { + $pdo = new PDO($dsn, (string) env('DB_USERNAME'), (string) env('DB_PASSWORD'), $options); + } catch (PDOException $e) { $this->friendlyError(sprintf('Error when connecting to DB: %s', $e->getMessage())); return 1; diff --git a/app/Console/Commands/Tools/Cron.php b/app/Console/Commands/Tools/Cron.php index c220ccf307..663089e240 100644 --- a/app/Console/Commands/Tools/Cron.php +++ b/app/Console/Commands/Tools/Cron.php @@ -34,6 +34,7 @@ use FireflyIII\Support\Cronjobs\RecurringCronjob; use FireflyIII\Support\Cronjobs\UpdateCheckCronjob; use Illuminate\Console\Command; use Illuminate\Support\Facades\Log; +use InvalidArgumentException; class Cron extends Command { @@ -62,7 +63,7 @@ class Cron extends Command try { $date = new Carbon($this->option('date')); - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $this->friendlyError(sprintf('"%s" is not a valid date', $this->option('date'))); } $force = (bool) $this->option('force'); // @phpstan-ignore-line diff --git a/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php b/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php index 9bc4477888..2d761a0192 100644 --- a/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php +++ b/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php @@ -31,6 +31,8 @@ use Illuminate\Console\Command; use Illuminate\Contracts\Encryption\DecryptException; use Illuminate\Support\Facades\Crypt; use Illuminate\Support\Facades\DB; +use JsonException; +use stdClass; class RemovesDatabaseDecryption extends Command { @@ -105,13 +107,13 @@ class RemovesDatabaseDecryption extends Command { $rows = DB::table($table)->get(['id', $field]); - /** @var \stdClass $row */ + /** @var stdClass $row */ foreach ($rows as $row) { $this->decryptRow($table, $field, $row); } } - private function decryptRow(string $table, string $field, \stdClass $row): void + private function decryptRow(string $table, string $field, stdClass $row): void { $original = $row->{$field}; if (null === $original) { @@ -168,7 +170,7 @@ class RemovesDatabaseDecryption extends Command // try to json_decrypt the value. try { $newValue = \Safe\json_decode($value, true, 512, JSON_THROW_ON_ERROR) ?? $value; - } catch (\JsonException $e) { + } catch (JsonException $e) { $message = sprintf('Could not JSON decode preference row #%d: %s. This does not have to be a problem.', $id, $e->getMessage()); $this->friendlyError($message); app('log')->warning($message); diff --git a/app/Console/Commands/Upgrade/UpgradesToGroups.php b/app/Console/Commands/Upgrade/UpgradesToGroups.php index 137a9f8bea..ec42f4e510 100644 --- a/app/Console/Commands/Upgrade/UpgradesToGroups.php +++ b/app/Console/Commands/Upgrade/UpgradesToGroups.php @@ -36,6 +36,7 @@ use FireflyIII\Services\Internal\Destroy\JournalDestroyService; use Illuminate\Console\Command; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; +use Exception; class UpgradesToGroups extends Command { @@ -103,7 +104,7 @@ class UpgradesToGroups extends Command } /** - * @throws \Exception + * @throws Exception */ private function makeGroupsFromSplitJournals(): void { @@ -119,7 +120,7 @@ class UpgradesToGroups extends Command } /** - * @throws \Exception + * @throws Exception */ private function makeMultiGroup(TransactionJournal $journal): void { diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index e29ec31305..bccbb2c3e5 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -26,6 +26,7 @@ namespace FireflyIII\Console; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; +use Override; /** * File to make sure commands work. @@ -35,7 +36,7 @@ class Kernel extends ConsoleKernel /** * Register the commands for the application. */ - #[\Override] + #[Override] protected function commands(): void { $this->load(__DIR__.'/Commands'); @@ -46,7 +47,7 @@ class Kernel extends ConsoleKernel /** * Define the application's command schedule. */ - #[\Override] + #[Override] protected function schedule(Schedule $schedule): void { $schedule->call( diff --git a/app/Exceptions/BadHttpHeaderException.php b/app/Exceptions/BadHttpHeaderException.php index 19e1e5a7af..375466c218 100644 --- a/app/Exceptions/BadHttpHeaderException.php +++ b/app/Exceptions/BadHttpHeaderException.php @@ -24,7 +24,9 @@ declare(strict_types=1); namespace FireflyIII\Exceptions; -class BadHttpHeaderException extends \Exception +use Exception; + +class BadHttpHeaderException extends Exception { public int $statusCode = 406; } diff --git a/app/Exceptions/DuplicateTransactionException.php b/app/Exceptions/DuplicateTransactionException.php index b8d6ece025..f468652981 100644 --- a/app/Exceptions/DuplicateTransactionException.php +++ b/app/Exceptions/DuplicateTransactionException.php @@ -24,7 +24,9 @@ declare(strict_types=1); namespace FireflyIII\Exceptions; +use Exception; + /** * Class DuplicateTransactionException */ -class DuplicateTransactionException extends \Exception {} +class DuplicateTransactionException extends Exception {} diff --git a/app/Exceptions/FireflyException.php b/app/Exceptions/FireflyException.php index 18b3fb0a35..bca7de92bd 100644 --- a/app/Exceptions/FireflyException.php +++ b/app/Exceptions/FireflyException.php @@ -24,7 +24,9 @@ declare(strict_types=1); namespace FireflyIII\Exceptions; +use Exception; + /** * Class FireflyException. */ -class FireflyException extends \Exception {} +class FireflyException extends Exception {} diff --git a/app/Exceptions/GracefulNotFoundHandler.php b/app/Exceptions/GracefulNotFoundHandler.php index 7faa9e03e2..7866d20047 100644 --- a/app/Exceptions/GracefulNotFoundHandler.php +++ b/app/Exceptions/GracefulNotFoundHandler.php @@ -34,6 +34,8 @@ use FireflyIII\User; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Illuminate\Http\Request; use Symfony\Component\HttpFoundation\Response; +use Override; +use Throwable; /** * Class GracefulNotFoundHandler @@ -45,12 +47,12 @@ class GracefulNotFoundHandler extends ExceptionHandler * * @param Request $request * - * @throws \Throwable + * @throws Throwable * * @SuppressWarnings("PHPMD.CyclomaticComplexity") */ - #[\Override] - public function render($request, \Throwable $e): Response + #[Override] + public function render($request, Throwable $e): Response { $route = $request->route(); if (null === $route) { @@ -149,9 +151,9 @@ class GracefulNotFoundHandler extends ExceptionHandler } /** - * @throws \Throwable + * @throws Throwable */ - private function handleAccount(Request $request, \Throwable $exception): Response + private function handleAccount(Request $request, Throwable $exception): Response { app('log')->debug('404 page is probably a deleted account. Redirect to overview of account types.'); @@ -184,9 +186,9 @@ class GracefulNotFoundHandler extends ExceptionHandler /** * @return Response * - * @throws \Throwable + * @throws Throwable */ - private function handleGroup(Request $request, \Throwable $exception) + private function handleGroup(Request $request, Throwable $exception) { app('log')->debug('404 page is probably a deleted group. Redirect to overview of group types.'); @@ -224,9 +226,9 @@ class GracefulNotFoundHandler extends ExceptionHandler /** * @return Response * - * @throws \Throwable + * @throws Throwable */ - private function handleAttachment(Request $request, \Throwable $exception) + private function handleAttachment(Request $request, Throwable $exception) { app('log')->debug('404 page is probably a deleted attachment. Redirect to parent object.'); diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 9368d57cc0..26e5b88da7 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -44,6 +44,9 @@ use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use ErrorException; +use Override; +use Throwable; // temp /** @@ -52,7 +55,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; class Handler extends ExceptionHandler { /** - * @var array> + * @var array> */ protected $dontReport = [ @@ -70,7 +73,7 @@ class Handler extends ExceptionHandler /** * Register the exception handling callbacks for the application. */ - #[\Override] + #[Override] public function register(): void {} /** @@ -79,13 +82,13 @@ class Handler extends ExceptionHandler * * @param Request $request * - * @throws \Throwable + * @throws Throwable * * @SuppressWarnings("PHPMD.NPathComplexity") * @SuppressWarnings("PHPMD.CyclomaticComplexity") */ - #[\Override] - public function render($request, \Throwable $e): Response + #[Override] + public function render($request, Throwable $e): Response { $expectsJson = $request->expectsJson(); @@ -188,7 +191,7 @@ class Handler extends ExceptionHandler return response()->view('errors.DatabaseException', ['exception' => $e, 'debug' => $isDebug], 500); } - if ($e instanceof FireflyException || $e instanceof \ErrorException || $e instanceof OAuthServerException) { + if ($e instanceof FireflyException || $e instanceof ErrorException || $e instanceof OAuthServerException) { app('log')->debug('Return Firefly III error view.'); $isDebug = config('app.debug'); @@ -203,10 +206,10 @@ class Handler extends ExceptionHandler /** * Report or log an exception. * - * @throws \Throwable + * @throws Throwable */ - #[\Override] - public function report(\Throwable $e): void + #[Override] + public function report(Throwable $e): void { $doMailError = (bool) config('firefly.send_error_message'); if ($this->shouldntReportLocal($e) || !$doMailError) { @@ -250,7 +253,7 @@ class Handler extends ExceptionHandler parent::report($e); } - private function shouldntReportLocal(\Throwable $e): bool + private function shouldntReportLocal(Throwable $e): bool { return null !== Arr::first( $this->dontReport, @@ -263,7 +266,7 @@ class Handler extends ExceptionHandler * * @param Request $request */ - #[\Override] + #[Override] protected function invalid($request, LaravelValidationException $exception): \Illuminate\Http\Response|JsonResponse|RedirectResponse { // protect against open redirect when submitting invalid forms. diff --git a/app/Exceptions/IntervalException.php b/app/Exceptions/IntervalException.php index c411b2dd1c..45fe7cddfb 100644 --- a/app/Exceptions/IntervalException.php +++ b/app/Exceptions/IntervalException.php @@ -25,11 +25,13 @@ declare(strict_types=1); namespace FireflyIII\Exceptions; use FireflyIII\Support\Calendar\Periodicity; +use Exception; +use Throwable; /** * Class IntervalException */ -final class IntervalException extends \Exception +final class IntervalException extends Exception { public array $availableIntervals; public Periodicity $periodicity; @@ -37,7 +39,7 @@ final class IntervalException extends \Exception /** @var mixed */ protected $message = 'The periodicity %s is unknown. Choose one of available periodicity: %s'; - public function __construct(string $message = '', int $code = 0, ?\Throwable $previous = null) + public function __construct(string $message = '', int $code = 0, ?Throwable $previous = null) { parent::__construct($message, $code, $previous); $this->availableIntervals = []; @@ -48,7 +50,7 @@ final class IntervalException extends \Exception Periodicity $periodicity, array $intervals, int $code = 0, - ?\Throwable $previous = null + ?Throwable $previous = null ): self { $message = sprintf( 'The periodicity %s is unknown. Choose one of available periodicity: %s', diff --git a/app/Exceptions/NotImplementedException.php b/app/Exceptions/NotImplementedException.php index 37bc63c0bb..40d6a6e362 100644 --- a/app/Exceptions/NotImplementedException.php +++ b/app/Exceptions/NotImplementedException.php @@ -24,7 +24,9 @@ declare(strict_types=1); namespace FireflyIII\Exceptions; +use Exception; + /** * Class NotImplementedException. */ -class NotImplementedException extends \Exception {} +class NotImplementedException extends Exception {} diff --git a/app/Exceptions/ValidationException.php b/app/Exceptions/ValidationException.php index 1927df03ef..5a89abb0c2 100644 --- a/app/Exceptions/ValidationException.php +++ b/app/Exceptions/ValidationException.php @@ -24,7 +24,9 @@ declare(strict_types=1); namespace FireflyIII\Exceptions; +use Exception; + /** * Class ValidationExceptions. */ -class ValidationException extends \Exception {} +class ValidationException extends Exception {} diff --git a/app/Factory/TransactionJournalFactory.php b/app/Factory/TransactionJournalFactory.php index f89c86b3aa..47357a4a26 100644 --- a/app/Factory/TransactionJournalFactory.php +++ b/app/Factory/TransactionJournalFactory.php @@ -51,6 +51,8 @@ use FireflyIII\User; use FireflyIII\Validation\AccountValidator; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; +use Exception; +use JsonException; /** * Class TransactionJournalFactory @@ -76,7 +78,7 @@ class TransactionJournalFactory /** * Constructor. * - * @throws \Exception + * @throws Exception */ public function __construct() { @@ -324,7 +326,7 @@ class TransactionJournalFactory try { $json = \Safe\json_encode($dataRow, JSON_THROW_ON_ERROR); - } catch (\JsonException $e) { + } catch (JsonException $e) { Log::error(sprintf('Could not encode dataRow: %s', $e->getMessage())); $json = microtime(); } diff --git a/app/Generator/Report/Account/MonthReportGenerator.php b/app/Generator/Report/Account/MonthReportGenerator.php index 49487a84b5..f711be2185 100644 --- a/app/Generator/Report/Account/MonthReportGenerator.php +++ b/app/Generator/Report/Account/MonthReportGenerator.php @@ -27,6 +27,7 @@ use Carbon\Carbon; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Generator\Report\ReportGeneratorInterface; use Illuminate\Support\Collection; +use Throwable; /** * Class MonthReportGenerator. @@ -56,7 +57,7 @@ class MonthReportGenerator implements ReportGeneratorInterface ->with('doubles', $this->expense) ->render() ; - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->error(sprintf('Cannot render reports.double.report: %s', $e->getMessage())); app('log')->error($e->getTraceAsString()); $result = sprintf('Could not render report view: %s', $e->getMessage()); diff --git a/app/Generator/Report/Account/MultiYearReportGenerator.php b/app/Generator/Report/Account/MultiYearReportGenerator.php index ff59598046..467b461113 100644 --- a/app/Generator/Report/Account/MultiYearReportGenerator.php +++ b/app/Generator/Report/Account/MultiYearReportGenerator.php @@ -23,6 +23,8 @@ declare(strict_types=1); namespace FireflyIII\Generator\Report\Account; +use Override; + /** * Class MultiYearReportGenerator. */ @@ -31,7 +33,7 @@ class MultiYearReportGenerator extends MonthReportGenerator /** * Returns the preferred period. */ - #[\Override] + #[Override] protected function preferredPeriod(): string { return 'year'; diff --git a/app/Generator/Report/Account/YearReportGenerator.php b/app/Generator/Report/Account/YearReportGenerator.php index 4b39570840..90a1b03cb6 100644 --- a/app/Generator/Report/Account/YearReportGenerator.php +++ b/app/Generator/Report/Account/YearReportGenerator.php @@ -23,6 +23,8 @@ declare(strict_types=1); namespace FireflyIII\Generator\Report\Account; +use Override; + /** * Class YearReportGenerator. */ @@ -31,7 +33,7 @@ class YearReportGenerator extends MonthReportGenerator /** * Returns the preferred period. */ - #[\Override] + #[Override] protected function preferredPeriod(): string { return 'month'; diff --git a/app/Generator/Report/Audit/MonthReportGenerator.php b/app/Generator/Report/Audit/MonthReportGenerator.php index 5d6767a6db..a8bbca3b18 100644 --- a/app/Generator/Report/Audit/MonthReportGenerator.php +++ b/app/Generator/Report/Audit/MonthReportGenerator.php @@ -34,6 +34,7 @@ use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use FireflyIII\Support\Facades\Steam; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; +use Throwable; /** * Class MonthReportGenerator. @@ -103,7 +104,7 @@ class MonthReportGenerator implements ReportGeneratorInterface ->with('start', $this->start)->with('end', $this->end)->with('accounts', $this->accounts) ->render() ; - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->error(sprintf('Cannot render reports.audit.report: %s', $e->getMessage())); app('log')->error($e->getTraceAsString()); $result = sprintf('Could not render report view: %s', $e->getMessage()); diff --git a/app/Generator/Report/Budget/MonthReportGenerator.php b/app/Generator/Report/Budget/MonthReportGenerator.php index 2e86d36c15..7c19c19e54 100644 --- a/app/Generator/Report/Budget/MonthReportGenerator.php +++ b/app/Generator/Report/Budget/MonthReportGenerator.php @@ -29,6 +29,7 @@ use FireflyIII\Exceptions\FireflyException; use FireflyIII\Generator\Report\ReportGeneratorInterface; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use Illuminate\Support\Collection; +use Throwable; /** * Class MonthReportGenerator. @@ -70,7 +71,7 @@ class MonthReportGenerator implements ReportGeneratorInterface ->with('accounts', $this->accounts) ->render() ; - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->error(sprintf('Cannot render reports.account.report: %s', $e->getMessage())); app('log')->error($e->getTraceAsString()); $result = sprintf('Could not render report view: %s', $e->getMessage()); diff --git a/app/Generator/Report/Category/MonthReportGenerator.php b/app/Generator/Report/Category/MonthReportGenerator.php index f0acb5520a..61dd7f5cac 100644 --- a/app/Generator/Report/Category/MonthReportGenerator.php +++ b/app/Generator/Report/Category/MonthReportGenerator.php @@ -29,6 +29,7 @@ use FireflyIII\Exceptions\FireflyException; use FireflyIII\Generator\Report\ReportGeneratorInterface; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use Illuminate\Support\Collection; +use Throwable; /** * Class MonthReportGenerator. @@ -71,7 +72,7 @@ class MonthReportGenerator implements ReportGeneratorInterface ->with('accounts', $this->accounts) ->render() ; - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->error(sprintf('Cannot render reports.category.month: %s', $e->getMessage())); app('log')->error($e->getTraceAsString()); $result = sprintf('Could not render report view: %s', $e->getMessage()); diff --git a/app/Generator/Report/Standard/MonthReportGenerator.php b/app/Generator/Report/Standard/MonthReportGenerator.php index fe70dc3041..edbe7910b6 100644 --- a/app/Generator/Report/Standard/MonthReportGenerator.php +++ b/app/Generator/Report/Standard/MonthReportGenerator.php @@ -27,6 +27,7 @@ use Carbon\Carbon; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Generator\Report\ReportGeneratorInterface; use Illuminate\Support\Collection; +use Throwable; /** * Class MonthReportGenerator. @@ -54,7 +55,7 @@ class MonthReportGenerator implements ReportGeneratorInterface try { return view('reports.default.month', compact('accountIds', 'reportType'))->with('start', $this->start)->with('end', $this->end)->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->error(sprintf('Cannot render reports.default.month: %s', $e->getMessage())); app('log')->error($e->getTraceAsString()); $result = 'Could not render report view.'; diff --git a/app/Generator/Report/Standard/MultiYearReportGenerator.php b/app/Generator/Report/Standard/MultiYearReportGenerator.php index f40dcfe8eb..d5e42a4dcb 100644 --- a/app/Generator/Report/Standard/MultiYearReportGenerator.php +++ b/app/Generator/Report/Standard/MultiYearReportGenerator.php @@ -27,6 +27,7 @@ use Carbon\Carbon; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Generator\Report\ReportGeneratorInterface; use Illuminate\Support\Collection; +use Throwable; /** * Class MonthReportGenerator. @@ -58,7 +59,7 @@ class MultiYearReportGenerator implements ReportGeneratorInterface 'reports.default.multi-year', compact('accountIds', 'reportType') )->with('start', $this->start)->with('end', $this->end)->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->error(sprintf('Cannot render reports.default.multi-year: %s', $e->getMessage())); app('log')->error($e->getTraceAsString()); $result = sprintf('Could not render report view: %s', $e->getMessage()); diff --git a/app/Generator/Report/Standard/YearReportGenerator.php b/app/Generator/Report/Standard/YearReportGenerator.php index 74b3b57ea9..6ac88700c2 100644 --- a/app/Generator/Report/Standard/YearReportGenerator.php +++ b/app/Generator/Report/Standard/YearReportGenerator.php @@ -27,6 +27,7 @@ use Carbon\Carbon; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Generator\Report\ReportGeneratorInterface; use Illuminate\Support\Collection; +use Throwable; /** * Class MonthReportGenerator. @@ -58,7 +59,7 @@ class YearReportGenerator implements ReportGeneratorInterface 'reports.default.year', compact('accountIds', 'reportType') )->with('start', $this->start)->with('end', $this->end)->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->error(sprintf('Cannot render reports.account.report: %s', $e->getMessage())); app('log')->error($e->getTraceAsString()); $result = 'Could not render report view.'; diff --git a/app/Generator/Report/Tag/MonthReportGenerator.php b/app/Generator/Report/Tag/MonthReportGenerator.php index 12f94d62cf..82d1c0c247 100644 --- a/app/Generator/Report/Tag/MonthReportGenerator.php +++ b/app/Generator/Report/Tag/MonthReportGenerator.php @@ -28,6 +28,7 @@ use Carbon\Carbon; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Generator\Report\ReportGeneratorInterface; use Illuminate\Support\Collection; +use Throwable; /** * Class MonthReportGenerator. @@ -65,7 +66,7 @@ class MonthReportGenerator implements ReportGeneratorInterface 'reports.tag.month', compact('accountIds', 'reportType', 'tagIds') )->with('start', $this->start)->with('end', $this->end)->with('tags', $this->tags)->with('accounts', $this->accounts)->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->error(sprintf('Cannot render reports.tag.month: %s', $e->getMessage())); app('log')->error($e->getTraceAsString()); $result = sprintf('Could not render report view: %s', $e->getMessage()); diff --git a/app/Handlers/Events/APIEventHandler.php b/app/Handlers/Events/APIEventHandler.php index cad6117f7a..7d59a4b636 100644 --- a/app/Handlers/Events/APIEventHandler.php +++ b/app/Handlers/Events/APIEventHandler.php @@ -28,6 +28,7 @@ use FireflyIII\Notifications\User\NewAccessToken; use FireflyIII\Repositories\User\UserRepositoryInterface; use Illuminate\Support\Facades\Notification; use Laravel\Passport\Events\AccessTokenCreated; +use Exception; /** * Class APIEventHandler @@ -48,7 +49,7 @@ class APIEventHandler if (null !== $user) { try { Notification::send($user, new NewAccessToken()); - } catch (\Exception $e) { + } catch (Exception $e) { $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); diff --git a/app/Handlers/Events/AdminEventHandler.php b/app/Handlers/Events/AdminEventHandler.php index 3121a569c9..5fe258067c 100644 --- a/app/Handlers/Events/AdminEventHandler.php +++ b/app/Handlers/Events/AdminEventHandler.php @@ -37,6 +37,7 @@ use FireflyIII\Notifications\Test\OwnerTestNotificationPushover; use FireflyIII\Notifications\Test\OwnerTestNotificationSlack; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Notification; +use Exception; /** * Class AdminEventHandler. @@ -52,7 +53,7 @@ class AdminEventHandler try { Notification::send(new OwnerNotifiable(), new UserInvitation($event->invitee)); - } catch (\Exception $e) { + } catch (Exception $e) { $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); @@ -74,7 +75,7 @@ class AdminEventHandler try { $owner = new OwnerNotifiable(); Notification::send($owner, new UnknownUserLoginAttempt($event->address)); - } catch (\Exception $e) { + } catch (Exception $e) { $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); @@ -104,7 +105,7 @@ class AdminEventHandler try { $owner = new OwnerNotifiable(); Notification::send($owner, new VersionCheckResult($event->message)); - } catch (\Exception $e) { + } catch (Exception $e) { $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); @@ -158,7 +159,7 @@ class AdminEventHandler try { Notification::send($event->owner, new $class()); - } catch (\Exception $e) { + } catch (Exception $e) { $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); diff --git a/app/Handlers/Events/AutomationHandler.php b/app/Handlers/Events/AutomationHandler.php index 4d5b4e8006..11b11a7b65 100644 --- a/app/Handlers/Events/AutomationHandler.php +++ b/app/Handlers/Events/AutomationHandler.php @@ -31,6 +31,7 @@ use FireflyIII\Notifications\User\TransactionCreation; use FireflyIII\Repositories\User\UserRepositoryInterface; use FireflyIII\Transformers\TransactionGroupTransformer; use Illuminate\Support\Facades\Notification; +use Exception; /** * Class AutomationHandler @@ -78,7 +79,7 @@ class AutomationHandler try { Notification::send($user, new TransactionCreation($groups)); - } catch (\Exception $e) { + } catch (Exception $e) { $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); diff --git a/app/Handlers/Events/BillEventHandler.php b/app/Handlers/Events/BillEventHandler.php index b600fe2dbe..8ecb2fab82 100644 --- a/app/Handlers/Events/BillEventHandler.php +++ b/app/Handlers/Events/BillEventHandler.php @@ -27,6 +27,7 @@ namespace FireflyIII\Handlers\Events; use FireflyIII\Events\WarnUserAboutBill; use FireflyIII\Notifications\User\BillReminder; use Illuminate\Support\Facades\Notification; +use Exception; /** * Class BillEventHandler @@ -47,7 +48,7 @@ class BillEventHandler try { Notification::send($bill->user, new BillReminder($bill, $event->field, $event->diff)); - } catch (\Exception $e) { + } catch (Exception $e) { $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); diff --git a/app/Handlers/Events/Security/MFAHandler.php b/app/Handlers/Events/Security/MFAHandler.php index 9b24cc0495..a259a742e2 100644 --- a/app/Handlers/Events/Security/MFAHandler.php +++ b/app/Handlers/Events/Security/MFAHandler.php @@ -39,6 +39,7 @@ use FireflyIII\Notifications\Security\MFAManyFailedAttemptsNotification; use FireflyIII\Notifications\Security\MFAUsedBackupCodeNotification; use FireflyIII\Notifications\Security\NewBackupCodesNotification; use Illuminate\Support\Facades\Notification; +use Exception; class MFAHandler { @@ -51,7 +52,7 @@ class MFAHandler try { Notification::send($user, new MFABackupFewLeftNotification($user, $count)); - } catch (\Exception $e) { + } catch (Exception $e) { $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); @@ -76,7 +77,7 @@ class MFAHandler try { Notification::send($user, new MFABackupNoLeftNotification($user)); - } catch (\Exception $e) { + } catch (Exception $e) { $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); @@ -101,7 +102,7 @@ class MFAHandler try { Notification::send($user, new DisabledMFANotification($user)); - } catch (\Exception $e) { + } catch (Exception $e) { $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); @@ -126,7 +127,7 @@ class MFAHandler try { Notification::send($user, new EnabledMFANotification($user)); - } catch (\Exception $e) { + } catch (Exception $e) { $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); @@ -152,7 +153,7 @@ class MFAHandler try { Notification::send($user, new MFAManyFailedAttemptsNotification($user, $count)); - } catch (\Exception $e) { + } catch (Exception $e) { $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); @@ -177,7 +178,7 @@ class MFAHandler try { Notification::send($user, new NewBackupCodesNotification($user)); - } catch (\Exception $e) { + } catch (Exception $e) { $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); @@ -202,7 +203,7 @@ class MFAHandler try { Notification::send($user, new MFAUsedBackupCodeNotification($user)); - } catch (\Exception $e) { + } catch (Exception $e) { $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.php index 70e2c8dab2..3cc02a08bb 100644 --- a/app/Handlers/Events/UserEventHandler.php +++ b/app/Handlers/Events/UserEventHandler.php @@ -56,6 +56,7 @@ use Illuminate\Auth\Events\Login; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Notification; +use Exception; /** * Class UserEventHandler. @@ -203,7 +204,7 @@ class UserEventHandler if (false === $entry['notified']) { try { Notification::send($user, new UserLogin()); - } catch (\Exception $e) { + } catch (Exception $e) { $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); @@ -233,7 +234,7 @@ class UserEventHandler try { Notification::send($owner, new AdminRegistrationNotification($event->user)); - } catch (\Exception $e) { + } catch (Exception $e) { $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); @@ -267,7 +268,7 @@ class UserEventHandler try { Mail::to($newEmail)->send(new ConfirmEmailChangeMail($newEmail, $oldEmail, $url)); - } catch (\Exception $e) { + } catch (Exception $e) { app('log')->error($e->getMessage()); app('log')->error($e->getTraceAsString()); @@ -292,7 +293,7 @@ class UserEventHandler try { Mail::to($oldEmail)->send(new UndoEmailChangeMail($newEmail, $oldEmail, $url)); - } catch (\Exception $e) { + } catch (Exception $e) { app('log')->error($e->getMessage()); app('log')->error($e->getTraceAsString()); @@ -304,7 +305,7 @@ class UserEventHandler { try { Notification::send($event->user, new UserFailedLoginAttempt($event->user)); - } catch (\Exception $e) { + } catch (Exception $e) { $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); @@ -328,7 +329,7 @@ class UserEventHandler { try { Notification::send($event->user, new UserNewPassword(route('password.reset', [$event->token]))); - } catch (\Exception $e) { + } catch (Exception $e) { $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); @@ -356,7 +357,7 @@ class UserEventHandler try { Mail::to($invitee)->send(new InvitationMail($invitee, $admin, $url)); - } catch (\Exception $e) { + } catch (Exception $e) { app('log')->error($e->getMessage()); app('log')->error($e->getTraceAsString()); @@ -374,7 +375,7 @@ class UserEventHandler if ($sendMail) { try { Notification::send($event->user, new UserRegistrationNotification()); - } catch (\Exception $e) { + } catch (Exception $e) { $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); @@ -429,7 +430,7 @@ class UserEventHandler try { Notification::send($event->user, new $class()); - } catch (\Exception $e) { + } catch (Exception $e) { $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); diff --git a/app/Helpers/Attachments/AttachmentHelper.php b/app/Helpers/Attachments/AttachmentHelper.php index 3d8583805e..5922b84a68 100644 --- a/app/Helpers/Attachments/AttachmentHelper.php +++ b/app/Helpers/Attachments/AttachmentHelper.php @@ -37,6 +37,8 @@ use Illuminate\Support\Facades\Storage; use Illuminate\Support\MessageBag; use Symfony\Component\HttpFoundation\File\UploadedFile; +use const DIRECTORY_SEPARATOR; + /** * Class AttachmentHelper. */ @@ -85,7 +87,7 @@ class AttachmentHelper implements AttachmentHelperInterface */ public function getAttachmentLocation(Attachment $attachment): string { - return sprintf('%sat-%d.data', \DIRECTORY_SEPARATOR, $attachment->id); + return sprintf('%sat-%d.data', DIRECTORY_SEPARATOR, $attachment->id); } /** diff --git a/app/Helpers/Collector/Extensions/AccountCollection.php b/app/Helpers/Collector/Extensions/AccountCollection.php index a8d408a15e..2328b5dabc 100644 --- a/app/Helpers/Collector/Extensions/AccountCollection.php +++ b/app/Helpers/Collector/Extensions/AccountCollection.php @@ -30,13 +30,14 @@ use FireflyIII\Support\Facades\Steam; use Illuminate\Database\Eloquent\Builder as EloquentBuilder; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; +use Override; /** * Trait AccountCollection */ trait AccountCollection { - #[\Override] + #[Override] public function accountBalanceIs(string $direction, string $operator, string $value): GroupCollectorInterface { Log::warning(sprintf('GroupCollector will be SLOW: accountBalanceIs: "%s" "%s" "%s"', $direction, $operator, $value)); diff --git a/app/Helpers/Collector/GroupCollector.php b/app/Helpers/Collector/GroupCollector.php index 4cff722226..036b3de9cc 100644 --- a/app/Helpers/Collector/GroupCollector.php +++ b/app/Helpers/Collector/GroupCollector.php @@ -45,6 +45,8 @@ use Illuminate\Database\Query\JoinClause; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; +use Closure; +use Override; /** * Class GroupCollector @@ -582,7 +584,7 @@ class GroupCollector implements GroupCollectorInterface $result['date']->setTimezone(config('app.timezone')); $result['created_at']->setTimezone(config('app.timezone')); $result['updated_at']->setTimezone(config('app.timezone')); - } catch (\Exception $e) { // intentional generic exception + } catch (Exception $e) { // intentional generic exception app('log')->error($e->getMessage()); throw new FireflyException($e->getMessage(), 0, $e); @@ -778,7 +780,7 @@ class GroupCollector implements GroupCollectorInterface app('log')->debug(sprintf('GroupCollector: postFilterCollection has %d filter(s) and %d transaction(s).', count($this->postFilters), count($currentCollection))); /** - * @var \Closure $function + * @var Closure $function */ foreach ($this->postFilters as $function) { app('log')->debug('Applying filter...'); @@ -812,7 +814,7 @@ class GroupCollector implements GroupCollectorInterface return $currentCollection; } - #[\Override] + #[Override] public function sortCollection(Collection $collection): Collection { /** @@ -1004,7 +1006,7 @@ class GroupCollector implements GroupCollectorInterface return $this; } - #[\Override] + #[Override] public function setSorting(array $instructions): GroupCollectorInterface { $this->sorting = $instructions; diff --git a/app/Helpers/Webhook/Sha3SignatureGenerator.php b/app/Helpers/Webhook/Sha3SignatureGenerator.php index e1b77af37d..51306071de 100644 --- a/app/Helpers/Webhook/Sha3SignatureGenerator.php +++ b/app/Helpers/Webhook/Sha3SignatureGenerator.php @@ -26,6 +26,7 @@ namespace FireflyIII\Helpers\Webhook; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\WebhookMessage; +use JsonException; /** * Class Sha3SignatureGenerator @@ -47,7 +48,7 @@ class Sha3SignatureGenerator implements SignatureGeneratorInterface try { $json = \Safe\json_encode($message->message, JSON_THROW_ON_ERROR); - } catch (\JsonException $e) { + } catch (JsonException $e) { app('log')->error('Could not generate hash.'); app('log')->error(sprintf('JSON value: %s', $json)); app('log')->error($e->getMessage()); diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.php index dd570b63a9..71f7b7dc27 100644 --- a/app/Http/Controllers/DebugController.php +++ b/app/Http/Controllers/DebugController.php @@ -53,6 +53,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use function Safe\file_get_contents; use function Safe\ini_get; +use const PHP_INT_SIZE; +use const PHP_SAPI; + /** * Class DebugController */ @@ -177,8 +180,8 @@ class DebugController extends Controller 'php_version' => PHP_VERSION, 'php_os' => PHP_OS, 'uname' => php_uname('m'), - 'interface' => \PHP_SAPI, - 'bits' => \PHP_INT_SIZE * 8, + 'interface' => PHP_SAPI, + 'bits' => PHP_INT_SIZE * 8, 'bcscale' => bcscale(), 'display_errors' => ini_get('display_errors'), 'error_reporting' => $this->errorReporting((int) ini_get('error_reporting')), diff --git a/app/Jobs/MailError.php b/app/Jobs/MailError.php index 229a55b28d..bc18bfe682 100644 --- a/app/Jobs/MailError.php +++ b/app/Jobs/MailError.php @@ -30,6 +30,7 @@ use Illuminate\Queue\SerializesModels; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Mail; use Symfony\Component\Mailer\Exception\TransportException; +use Exception; /** * Class MailError. @@ -80,7 +81,7 @@ class MailError extends Job implements ShouldQueue } } ); - } catch (\Exception|TransportException $e) { + } catch (Exception|TransportException $e) { $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not email or log the error. Please validate your email settings, use the .env.example file as a guide.'); diff --git a/app/Models/AccountType.php b/app/Models/AccountType.php index cffbf7a8bf..d4571fde77 100644 --- a/app/Models/AccountType.php +++ b/app/Models/AccountType.php @@ -32,46 +32,46 @@ class AccountType extends Model { use ReturnsIntegerIdTrait; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const string ASSET = 'Asset account'; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const string BENEFICIARY = 'Beneficiary account'; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const string CASH = 'Cash account'; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const string CREDITCARD = 'Credit card'; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const string DEBT = 'Debt'; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const string DEFAULT = 'Default account'; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const string EXPENSE = 'Expense account'; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const string IMPORT = 'Import account'; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const string INITIAL_BALANCE = 'Initial balance account'; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const string LIABILITY_CREDIT = 'Liability credit account'; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const string LOAN = 'Loan'; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const string MORTGAGE = 'Mortgage'; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const string RECONCILIATION = 'Reconciliation account'; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const string REVENUE = 'Revenue account'; protected $casts diff --git a/app/Models/AutoBudget.php b/app/Models/AutoBudget.php index 85deb27d83..7f53584616 100644 --- a/app/Models/AutoBudget.php +++ b/app/Models/AutoBudget.php @@ -36,13 +36,13 @@ class AutoBudget extends Model use ReturnsIntegerIdTrait; use SoftDeletes; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const int AUTO_BUDGET_ADJUSTED = 3; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const int AUTO_BUDGET_RESET = 1; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const int AUTO_BUDGET_ROLLOVER = 2; protected $casts = [ diff --git a/app/Models/RecurrenceRepetition.php b/app/Models/RecurrenceRepetition.php index a5bcfc7f17..93ad02a196 100644 --- a/app/Models/RecurrenceRepetition.php +++ b/app/Models/RecurrenceRepetition.php @@ -36,16 +36,16 @@ class RecurrenceRepetition extends Model use ReturnsIntegerIdTrait; use SoftDeletes; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const int WEEKEND_DO_NOTHING = 1; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const int WEEKEND_SKIP_CREATION = 2; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const int WEEKEND_TO_FRIDAY = 3; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const int WEEKEND_TO_MONDAY = 4; protected $casts diff --git a/app/Models/TransactionType.php b/app/Models/TransactionType.php index 06fcde6c17..0b04ead8b5 100644 --- a/app/Models/TransactionType.php +++ b/app/Models/TransactionType.php @@ -36,25 +36,25 @@ class TransactionType extends Model use ReturnsIntegerIdTrait; use SoftDeletes; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const string DEPOSIT = 'Deposit'; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const string INVALID = 'Invalid'; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const string LIABILITY_CREDIT = 'Liability credit'; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const string OPENING_BALANCE = 'Opening balance'; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const string RECONCILIATION = 'Reconciliation'; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const string TRANSFER = 'Transfer'; - #[\Deprecated] /** @deprecated */ + #[Deprecated] /** @deprecated */ public const string WITHDRAWAL = 'Withdrawal'; protected $casts diff --git a/app/Providers/AccountServiceProvider.php b/app/Providers/AccountServiceProvider.php index 939815c8a8..311aae4bba 100644 --- a/app/Providers/AccountServiceProvider.php +++ b/app/Providers/AccountServiceProvider.php @@ -31,6 +31,7 @@ use FireflyIII\Repositories\Account\OperationsRepository; use FireflyIII\Repositories\Account\OperationsRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; +use Override; /** * Class AccountServiceProvider. @@ -45,7 +46,7 @@ class AccountServiceProvider extends ServiceProvider /** * Register the application services. */ - #[\Override] + #[Override] public function register(): void { $this->registerRepository(); diff --git a/app/Providers/AdminServiceProvider.php b/app/Providers/AdminServiceProvider.php index 1709ca658d..ac768ddb9d 100644 --- a/app/Providers/AdminServiceProvider.php +++ b/app/Providers/AdminServiceProvider.php @@ -27,6 +27,7 @@ use FireflyIII\Repositories\LinkType\LinkTypeRepository; use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; +use Override; /** * Class AdminServiceProvider @@ -41,7 +42,7 @@ class AdminServiceProvider extends ServiceProvider /** * Register the application services. */ - #[\Override] + #[Override] public function register(): void { $this->linkType(); diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 169258cb36..fd0b48b003 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -29,6 +29,7 @@ use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Schema; use Illuminate\Support\ServiceProvider; use Laravel\Passport\Passport; +use Override; /** * Class AppServiceProvider @@ -87,7 +88,7 @@ class AppServiceProvider extends ServiceProvider /** * Register any application services. */ - #[\Override] + #[Override] public function register(): void { Passport::ignoreRoutes(); diff --git a/app/Providers/AttachmentServiceProvider.php b/app/Providers/AttachmentServiceProvider.php index c4cfb6d264..50a00766fe 100644 --- a/app/Providers/AttachmentServiceProvider.php +++ b/app/Providers/AttachmentServiceProvider.php @@ -27,6 +27,7 @@ use FireflyIII\Repositories\Attachment\AttachmentRepository; use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; +use Override; /** * Class AttachmentServiceProvider. @@ -41,7 +42,7 @@ class AttachmentServiceProvider extends ServiceProvider /** * Register the application services. */ - #[\Override] + #[Override] public function register(): void { $this->app->bind( diff --git a/app/Providers/BillServiceProvider.php b/app/Providers/BillServiceProvider.php index e2a3a42e71..2035762a51 100644 --- a/app/Providers/BillServiceProvider.php +++ b/app/Providers/BillServiceProvider.php @@ -27,6 +27,7 @@ use FireflyIII\Repositories\Bill\BillRepository; use FireflyIII\Repositories\Bill\BillRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; +use Override; /** * Class BillServiceProvider. @@ -41,7 +42,7 @@ class BillServiceProvider extends ServiceProvider /** * Register the application services. */ - #[\Override] + #[Override] public function register(): void { $this->app->bind( diff --git a/app/Providers/BudgetServiceProvider.php b/app/Providers/BudgetServiceProvider.php index 8da9ef97b8..25184a1aac 100644 --- a/app/Providers/BudgetServiceProvider.php +++ b/app/Providers/BudgetServiceProvider.php @@ -35,6 +35,7 @@ use FireflyIII\Repositories\Budget\OperationsRepository; use FireflyIII\Repositories\Budget\OperationsRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; +use Override; /** * Class BudgetServiceProvider. @@ -51,7 +52,7 @@ class BudgetServiceProvider extends ServiceProvider * * @SuppressWarnings("PHPMD.ExcessiveMethodLength") */ - #[\Override] + #[Override] public function register(): void { // reference to auth is not understood by phpstan. diff --git a/app/Providers/CategoryServiceProvider.php b/app/Providers/CategoryServiceProvider.php index 4c86c9800e..2ab8db6ff5 100644 --- a/app/Providers/CategoryServiceProvider.php +++ b/app/Providers/CategoryServiceProvider.php @@ -31,6 +31,7 @@ use FireflyIII\Repositories\Category\OperationsRepository; use FireflyIII\Repositories\Category\OperationsRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; +use Override; /** * Class CategoryServiceProvider. @@ -45,7 +46,7 @@ class CategoryServiceProvider extends ServiceProvider /** * Register the application services. */ - #[\Override] + #[Override] public function register(): void { // phpstan does not understand reference to 'auth'. diff --git a/app/Providers/CurrencyServiceProvider.php b/app/Providers/CurrencyServiceProvider.php index 4f9c466cb8..6ffb3688f7 100644 --- a/app/Providers/CurrencyServiceProvider.php +++ b/app/Providers/CurrencyServiceProvider.php @@ -31,6 +31,7 @@ use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepository; use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; +use Override; /** * Class CurrencyServiceProvider. @@ -45,7 +46,7 @@ class CurrencyServiceProvider extends ServiceProvider /** * Register the application services. */ - #[\Override] + #[Override] public function register(): void { $this->app->bind( diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 7b3be85ddc..b016fe0e4d 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -101,6 +101,7 @@ use FireflyIII\Models\WebhookMessage; use Illuminate\Auth\Events\Login; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; use Laravel\Passport\Events\AccessTokenCreated; +use Override; /** * Class EventServiceProvider. @@ -260,7 +261,7 @@ class EventServiceProvider extends ServiceProvider /** * Register any events for your application. */ - #[\Override] + #[Override] public function boot(): void { $this->registerObservers(); diff --git a/app/Providers/FireflyServiceProvider.php b/app/Providers/FireflyServiceProvider.php index 2b9360f85a..83b4c1e585 100644 --- a/app/Providers/FireflyServiceProvider.php +++ b/app/Providers/FireflyServiceProvider.php @@ -76,6 +76,7 @@ use Illuminate\Foundation\Application; use Illuminate\Support\Facades\Validator; use Illuminate\Support\ServiceProvider; use Symfony\Component\ExpressionLanguage\ExpressionLanguage; +use Override; /** * Class FireflyServiceProvider. @@ -99,7 +100,7 @@ class FireflyServiceProvider extends ServiceProvider * * @SuppressWarnings("PHPMD.ExcessiveMethodLength") */ - #[\Override] + #[Override] public function register(): void { $this->app->bind( diff --git a/app/Providers/FireflySessionProvider.php b/app/Providers/FireflySessionProvider.php index 249325dd55..fee1b30ed6 100644 --- a/app/Providers/FireflySessionProvider.php +++ b/app/Providers/FireflySessionProvider.php @@ -26,6 +26,7 @@ namespace FireflyIII\Providers; use FireflyIII\Http\Middleware\StartFireflySession; use Illuminate\Session\SessionManager; use Illuminate\Support\ServiceProvider; +use Override; /** * Class FireflySessionProvider @@ -35,7 +36,7 @@ class FireflySessionProvider extends ServiceProvider /** * Register the service provider. */ - #[\Override] + #[Override] public function register(): void { $this->registerSessionManager(); diff --git a/app/Providers/JournalServiceProvider.php b/app/Providers/JournalServiceProvider.php index 8e758ca143..3c02bbaed4 100644 --- a/app/Providers/JournalServiceProvider.php +++ b/app/Providers/JournalServiceProvider.php @@ -35,6 +35,7 @@ use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepository; use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; +use Override; /** * Class JournalServiceProvider. @@ -49,7 +50,7 @@ class JournalServiceProvider extends ServiceProvider /** * Register the application services. */ - #[\Override] + #[Override] public function register(): void { $this->registerRepository(); diff --git a/app/Providers/PiggyBankServiceProvider.php b/app/Providers/PiggyBankServiceProvider.php index 53e35d02fe..c89fe9c6d0 100644 --- a/app/Providers/PiggyBankServiceProvider.php +++ b/app/Providers/PiggyBankServiceProvider.php @@ -27,6 +27,7 @@ use FireflyIII\Repositories\PiggyBank\PiggyBankRepository; use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; +use Override; /** * Class PiggyBankServiceProvider. @@ -41,7 +42,7 @@ class PiggyBankServiceProvider extends ServiceProvider /** * Register the application services. */ - #[\Override] + #[Override] public function register(): void { $this->app->bind( diff --git a/app/Providers/RecurringServiceProvider.php b/app/Providers/RecurringServiceProvider.php index 9f77c8bdc9..b9aeed4c4f 100644 --- a/app/Providers/RecurringServiceProvider.php +++ b/app/Providers/RecurringServiceProvider.php @@ -27,6 +27,7 @@ use FireflyIII\Repositories\Recurring\RecurringRepository; use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; +use Override; /** * Class RecurringServiceProvider. @@ -41,7 +42,7 @@ class RecurringServiceProvider extends ServiceProvider /** * Register the application services. */ - #[\Override] + #[Override] public function register(): void { $this->app->bind( diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 6e02c53603..caec293d3d 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -25,6 +25,7 @@ namespace FireflyIII\Providers; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; use Illuminate\Support\Facades\Route; +use Override; /** * Class RouteServiceProvider @@ -37,7 +38,7 @@ class RouteServiceProvider extends ServiceProvider /** * Define the routes for the application. */ - #[\Override] + #[Override] public function boot(): void { $this->routes(function (): void { diff --git a/app/Providers/RuleGroupServiceProvider.php b/app/Providers/RuleGroupServiceProvider.php index ff1f0c777d..df76177faf 100644 --- a/app/Providers/RuleGroupServiceProvider.php +++ b/app/Providers/RuleGroupServiceProvider.php @@ -27,6 +27,7 @@ use FireflyIII\Repositories\RuleGroup\RuleGroupRepository; use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; +use Override; /** * Class RuleGroupServiceProvider. @@ -41,7 +42,7 @@ class RuleGroupServiceProvider extends ServiceProvider /** * Register the application services. */ - #[\Override] + #[Override] public function register(): void { $this->app->bind( diff --git a/app/Providers/RuleServiceProvider.php b/app/Providers/RuleServiceProvider.php index e6ef01b7fd..6c3df05f49 100644 --- a/app/Providers/RuleServiceProvider.php +++ b/app/Providers/RuleServiceProvider.php @@ -27,6 +27,7 @@ use FireflyIII\Repositories\Rule\RuleRepository; use FireflyIII\Repositories\Rule\RuleRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; +use Override; /** * Class RuleServiceProvider. @@ -41,7 +42,7 @@ class RuleServiceProvider extends ServiceProvider /** * Register the application services. */ - #[\Override] + #[Override] public function register(): void { $this->app->bind( diff --git a/app/Providers/SearchServiceProvider.php b/app/Providers/SearchServiceProvider.php index 10df8973e2..93b96a4b97 100644 --- a/app/Providers/SearchServiceProvider.php +++ b/app/Providers/SearchServiceProvider.php @@ -30,6 +30,7 @@ use FireflyIII\Support\Search\QueryParser\QueryParserInterface; use FireflyIII\Support\Search\SearchInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; +use Override; /** * Class SearchServiceProvider. @@ -44,7 +45,7 @@ class SearchServiceProvider extends ServiceProvider /** * Register the application services. */ - #[\Override] + #[Override] public function register(): void { $this->app->bind( diff --git a/app/Providers/SessionServiceProvider.php b/app/Providers/SessionServiceProvider.php index 9c5f4e86f2..2fdf356bd3 100644 --- a/app/Providers/SessionServiceProvider.php +++ b/app/Providers/SessionServiceProvider.php @@ -25,6 +25,7 @@ namespace FireflyIII\Providers; use FireflyIII\Http\Middleware\StartFireflySession; use Illuminate\Session\SessionServiceProvider as BaseSessionServiceProvider; +use Override; /** * Class SessionServiceProvider. @@ -34,7 +35,7 @@ class SessionServiceProvider extends BaseSessionServiceProvider /** * Register the service provider. */ - #[\Override] + #[Override] public function register(): void { $this->registerSessionManager(); diff --git a/app/Providers/TagServiceProvider.php b/app/Providers/TagServiceProvider.php index 271e4160d2..0b11619c22 100644 --- a/app/Providers/TagServiceProvider.php +++ b/app/Providers/TagServiceProvider.php @@ -29,6 +29,7 @@ use FireflyIII\Repositories\Tag\TagRepository; use FireflyIII\Repositories\Tag\TagRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; +use Override; /** * Class TagServiceProvider. @@ -43,7 +44,7 @@ class TagServiceProvider extends ServiceProvider /** * Register the application services. */ - #[\Override] + #[Override] public function register(): void { $this->app->bind( diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index c498f6a5b1..149c5eb263 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -45,6 +45,7 @@ use Illuminate\Database\Eloquent\Builder as EloquentBuilder; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Storage; +use Override; /** * Class AccountRepository. @@ -162,7 +163,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac return $account; } - #[\Override] + #[Override] public function getAccountBalances(Account $account): Collection { return $account->accountBalances; @@ -533,7 +534,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac return null; } - #[\Override] + #[Override] public function periodCollection(Account $account, Carbon $start, Carbon $end): array { return $account->transactions() diff --git a/app/Repositories/Attachment/AttachmentRepository.php b/app/Repositories/Attachment/AttachmentRepository.php index 961127f085..0e41c59cf4 100644 --- a/app/Repositories/Attachment/AttachmentRepository.php +++ b/app/Repositories/Attachment/AttachmentRepository.php @@ -35,6 +35,8 @@ use Illuminate\Support\Collection; use Illuminate\Support\Facades\Crypt; use Illuminate\Support\Facades\Storage; use League\Flysystem\UnableToDeleteFile; +use Exception; +use LogicException; /** * Class AttachmentRepository. @@ -44,7 +46,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface, UserGroupIn use UserGroupTrait; /** - * @throws \Exception + * @throws Exception */ public function destroy(Attachment $attachment): bool { @@ -158,7 +160,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface, UserGroupIn if (null !== $dbNote) { try { $dbNote->delete(); - } catch (\LogicException $e) { + } catch (LogicException $e) { app('log')->error($e->getMessage()); } } diff --git a/app/Repositories/Budget/BudgetLimitRepository.php b/app/Repositories/Budget/BudgetLimitRepository.php index 456e8197f6..e25af43169 100644 --- a/app/Repositories/Budget/BudgetLimitRepository.php +++ b/app/Repositories/Budget/BudgetLimitRepository.php @@ -36,6 +36,7 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; +use Override; /** * Class BudgetLimitRepository @@ -254,7 +255,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup ; } - #[\Override] + #[Override] public function getNoteText(BudgetLimit $budgetLimit): string { return (string) $budgetLimit->notes()->first()?->text; @@ -323,7 +324,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup ; } - #[\Override] + #[Override] public function setNoteText(BudgetLimit $budgetLimit, string $text): void { $dbNote = $budgetLimit->notes()->first(); diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.php index 19d1447857..b56ed2828e 100644 --- a/app/Repositories/Category/CategoryRepository.php +++ b/app/Repositories/Category/CategoryRepository.php @@ -39,6 +39,7 @@ use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Storage; +use Exception; /** * Class CategoryRepository. @@ -271,7 +272,7 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf } /** - * @throws \Exception + * @throws Exception */ public function lastUseDate(Category $category, Collection $accounts): ?Carbon { @@ -314,7 +315,7 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf } /** - * @throws \Exception + * @throws Exception */ private function getLastTransactionDate(Category $category, Collection $accounts): ?Carbon { @@ -347,7 +348,7 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf } /** - * @throws \Exception + * @throws Exception */ public function update(Category $category, array $data): Category { diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.php index 9676766b6c..2034209c0b 100644 --- a/app/Repositories/Currency/CurrencyRepository.php +++ b/app/Repositories/Currency/CurrencyRepository.php @@ -42,6 +42,7 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; +use Override; /** * Class CurrencyRepository. @@ -277,7 +278,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf return $result; } - #[\Override] + #[Override] public function find(int $currencyId): ?TransactionCurrency { return TransactionCurrency::find($currencyId); diff --git a/app/Repositories/ExchangeRate/ExchangeRateRepository.php b/app/Repositories/ExchangeRate/ExchangeRateRepository.php index cce27ba123..6a56c17369 100644 --- a/app/Repositories/ExchangeRate/ExchangeRateRepository.php +++ b/app/Repositories/ExchangeRate/ExchangeRateRepository.php @@ -31,24 +31,25 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Collection; +use Override; class ExchangeRateRepository implements ExchangeRateRepositoryInterface, UserGroupInterface { use UserGroupTrait; - #[\Override] + #[Override] public function deleteRate(CurrencyExchangeRate $rate): void { $this->userGroup->currencyExchangeRates()->where('id', $rate->id)->delete(); } - #[\Override] + #[Override] public function getAll(): Collection { return $this->userGroup->currencyExchangeRates()->orderBy('date', 'ASC')->get(); } - #[\Override] + #[Override] public function getRates(TransactionCurrency $from, TransactionCurrency $to): Collection { // orderBy('date', 'DESC')->toRawSql(); @@ -71,7 +72,7 @@ class ExchangeRateRepository implements ExchangeRateRepositoryInterface, UserGro } - #[\Override] + #[Override] public function getSpecificRateOnDate(TransactionCurrency $from, TransactionCurrency $to, Carbon $date): ?CurrencyExchangeRate { /** @var null|CurrencyExchangeRate */ @@ -84,7 +85,7 @@ class ExchangeRateRepository implements ExchangeRateRepositoryInterface, UserGro ; } - #[\Override] + #[Override] public function storeExchangeRate(TransactionCurrency $from, TransactionCurrency $to, string $rate, Carbon $date): CurrencyExchangeRate { $object = new CurrencyExchangeRate(); @@ -100,7 +101,7 @@ class ExchangeRateRepository implements ExchangeRateRepositoryInterface, UserGro return $object; } - #[\Override] + #[Override] public function updateExchangeRate(CurrencyExchangeRate $object, string $rate, ?Carbon $date = null): CurrencyExchangeRate { $object->rate = $rate; diff --git a/app/Repositories/Journal/JournalCLIRepository.php b/app/Repositories/Journal/JournalCLIRepository.php index c3b51cd860..b908dcc82f 100644 --- a/app/Repositories/Journal/JournalCLIRepository.php +++ b/app/Repositories/Journal/JournalCLIRepository.php @@ -32,6 +32,7 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; +use stdClass; /** * Class JournalCLIRepository @@ -184,7 +185,7 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface, UserGroupIn $result = $query->get(['transaction_journals.id as id', DB::raw('count(transactions.id) as transaction_count')]); // @phpstan-ignore-line $journalIds = []; - /** @var \stdClass $row */ + /** @var stdClass $row */ foreach ($result as $row) { if ((int) $row->transaction_count > 2) { $journalIds[] = (int) $row->id; diff --git a/app/Repositories/LinkType/LinkTypeRepository.php b/app/Repositories/LinkType/LinkTypeRepository.php index 08a346db38..f4e59624a7 100644 --- a/app/Repositories/LinkType/LinkTypeRepository.php +++ b/app/Repositories/LinkType/LinkTypeRepository.php @@ -31,6 +31,7 @@ use FireflyIII\Models\TransactionJournalLink; use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; +use Exception; /** * Class LinkTypeRepository. @@ -71,7 +72,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterf } /** - * @throws \Exception + * @throws Exception */ public function destroyLink(TransactionJournalLink $link): bool { @@ -170,7 +171,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterf /** * Store link between two journals. * - * @throws \Exception + * @throws Exception */ public function storeLink(array $information, TransactionJournal $inward, TransactionJournal $outward): ?TransactionJournalLink { @@ -237,7 +238,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterf } /** - * @throws \Exception + * @throws Exception */ private function setNoteText(TransactionJournalLink $link, string $text): void { @@ -279,7 +280,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterf /** * Update an existing transaction journal link. * - * @throws \Exception + * @throws Exception */ public function updateLink(TransactionJournalLink $journalLink, array $data): TransactionJournalLink { diff --git a/app/Repositories/PiggyBank/ModifiesPiggyBanks.php b/app/Repositories/PiggyBank/ModifiesPiggyBanks.php index dd05aefcc4..fdff8e8de0 100644 --- a/app/Repositories/PiggyBank/ModifiesPiggyBanks.php +++ b/app/Repositories/PiggyBank/ModifiesPiggyBanks.php @@ -36,6 +36,7 @@ use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\ObjectGroup\CreatesObjectGroups; use FireflyIII\Support\Http\Api\ExchangeRateConverter; use Illuminate\Support\Facades\Log; +use Exception; /** * Trait ModifiesPiggyBanks @@ -142,7 +143,7 @@ trait ModifiesPiggyBanks } /** - * @throws \Exception + * @throws Exception */ public function destroy(PiggyBank $piggyBank): bool { diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php index 9296d3c977..497b8a6ca3 100644 --- a/app/Repositories/PiggyBank/PiggyBankRepository.php +++ b/app/Repositories/PiggyBank/PiggyBankRepository.php @@ -41,6 +41,7 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Storage; +use Override; /** * Class PiggyBankRepository. @@ -390,7 +391,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte return $balance; } - #[\Override] + #[Override] public function purgeAll(): void { PiggyBank::withTrashed() @@ -407,7 +408,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte ; } - #[\Override] + #[Override] public function resetOrder(): void { $factory = new PiggyBankFactory(); diff --git a/app/Repositories/Rule/RuleRepository.php b/app/Repositories/Rule/RuleRepository.php index 1af214b037..5774e84e9e 100644 --- a/app/Repositories/Rule/RuleRepository.php +++ b/app/Repositories/Rule/RuleRepository.php @@ -33,6 +33,7 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use FireflyIII\Support\Search\OperatorQuerySearch; use Illuminate\Support\Collection; +use Exception; /** * Class RuleRepository. @@ -42,7 +43,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface use UserGroupTrait; /** - * @throws \Exception + * @throws Exception */ public function destroy(Rule $rule): bool { diff --git a/app/Repositories/RuleGroup/RuleGroupRepository.php b/app/Repositories/RuleGroup/RuleGroupRepository.php index 8615e346ec..4a57735e2d 100644 --- a/app/Repositories/RuleGroup/RuleGroupRepository.php +++ b/app/Repositories/RuleGroup/RuleGroupRepository.php @@ -32,6 +32,7 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; +use Exception; /** * Class RuleGroupRepository. @@ -72,7 +73,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte } /** - * @throws \Exception + * @throws Exception */ public function destroy(RuleGroup $ruleGroup, ?RuleGroup $moveTo): bool { diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php index 425582b559..937c6492da 100644 --- a/app/Repositories/Tag/TagRepository.php +++ b/app/Repositories/Tag/TagRepository.php @@ -37,6 +37,7 @@ use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Storage; +use Exception; /** * Class TagRepository. @@ -51,7 +52,7 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface } /** - * @throws \Exception + * @throws Exception */ public function destroy(Tag $tag): bool { diff --git a/app/Repositories/TransactionGroup/TransactionGroupRepository.php b/app/Repositories/TransactionGroup/TransactionGroupRepository.php index c9c3063685..8f9b793aa9 100644 --- a/app/Repositories/TransactionGroup/TransactionGroupRepository.php +++ b/app/Repositories/TransactionGroup/TransactionGroupRepository.php @@ -48,6 +48,7 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; +use Exception; /** * Class TransactionGroupRepository @@ -291,7 +292,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, /** * Return object with all found meta field things as Carbon objects. * - * @throws \Exception + * @throws Exception */ public function getMetaDateFields(int $journalId, array $fields): NullArrayObject { diff --git a/app/Repositories/User/UserRepository.php b/app/Repositories/User/UserRepository.php index 9abc8554a3..5c018c6e04 100644 --- a/app/Repositories/User/UserRepository.php +++ b/app/Repositories/User/UserRepository.php @@ -34,6 +34,8 @@ use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Database\QueryException; use Illuminate\Support\Collection; use Illuminate\Support\Str; +use Exception; +use Override; /** * Class UserRepository. @@ -44,7 +46,7 @@ class UserRepository implements UserRepositoryInterface * This updates the users email address and records some things so it can be confirmed or undone later. * The user is blocked until the change is confirmed. * - * @throws \Exception + * @throws Exception * * @see updateEmail */ @@ -99,7 +101,7 @@ class UserRepository implements UserRepositoryInterface } /** - * @throws \Exception + * @throws Exception */ public function destroy(User $user): bool { @@ -243,7 +245,7 @@ class UserRepository implements UserRepositoryInterface return false; } - #[\Override] + #[Override] public function getUserGroups(User $user): Collection { $memberships = $user->groupMemberships()->get(); diff --git a/app/Repositories/UserGroup/UserGroupRepository.php b/app/Repositories/UserGroup/UserGroupRepository.php index e2c266b5e1..15f49774ee 100644 --- a/app/Repositories/UserGroup/UserGroupRepository.php +++ b/app/Repositories/UserGroup/UserGroupRepository.php @@ -35,6 +35,8 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use FireflyIII\User; use Illuminate\Support\Collection; +use Override; +use ValueError; /** * Class UserGroupRepository @@ -176,13 +178,13 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte return UserGroup::all(); } - #[\Override] + #[Override] public function getById(int $id): ?UserGroup { return UserGroup::find($id); } - #[\Override] + #[Override] public function getMembershipsFromGroupId(int $groupId): Collection { return $this->user->groupMemberships()->where('user_group_id', $groupId)->get(); @@ -286,7 +288,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte foreach ($rolesSimplified as $role) { try { $enum = UserRoleEnum::from($role); - } catch (\ValueError) { + } catch (ValueError) { // TODO error message continue; } @@ -313,7 +315,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte return $roles; } - #[\Override] + #[Override] public function useUserGroup(UserGroup $userGroup): void { $this->user->user_group_id = $userGroup->id; diff --git a/app/Repositories/UserGroups/Account/AccountRepository.php b/app/Repositories/UserGroups/Account/AccountRepository.php index f7aae4dfce..15d8b4d52a 100644 --- a/app/Repositories/UserGroups/Account/AccountRepository.php +++ b/app/Repositories/UserGroups/Account/AccountRepository.php @@ -37,6 +37,8 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Database\Eloquent\Builder as EloquentBuilder; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; +use Override; +use stdClass; /** * Class AccountRepository @@ -47,7 +49,7 @@ class AccountRepository implements AccountRepositoryInterface { use UserGroupTrait; - #[\Override] + #[Override] public function countAccounts(array $types): int { $query = $this->userGroup->accounts(); @@ -120,7 +122,7 @@ class AccountRepository implements AccountRepositoryInterface return $account; } - #[\Override] + #[Override] public function getAccountBalances(Account $account): Collection { return $account->accountBalances; @@ -172,7 +174,7 @@ class AccountRepository implements AccountRepositoryInterface return $account; } - #[\Override] + #[Override] public function getAccountTypes(Collection $accounts): Collection { return AccountType::leftJoin('accounts', 'accounts.account_type_id', '=', 'account_types.id') @@ -195,7 +197,7 @@ class AccountRepository implements AccountRepositoryInterface return $query->get(['accounts.*']); } - #[\Override] + #[Override] public function getAccountsInOrder(array $types, array $sort, int $startRow, int $endRow): Collection { $query = $this->userGroup->accounts(); @@ -235,7 +237,7 @@ class AccountRepository implements AccountRepositoryInterface return $query->get(['accounts.*']); } - #[\Override] + #[Override] public function getLastActivity(Collection $accounts): array { return Transaction::whereIn('account_id', $accounts->pluck('id')->toArray()) @@ -245,7 +247,7 @@ class AccountRepository implements AccountRepositoryInterface ; } - #[\Override] + #[Override] public function getMetaValues(Collection $accounts, array $fields): Collection { $query = AccountMeta::whereIn('account_id', $accounts->pluck('id')->toArray()); @@ -256,7 +258,7 @@ class AccountRepository implements AccountRepositoryInterface return $query->get(['account_meta.id', 'account_meta.account_id', 'account_meta.name', 'account_meta.data']); } - #[\Override] + #[Override] public function getObjectGroups(Collection $accounts): array { $groupIds = []; @@ -265,14 +267,14 @@ class AccountRepository implements AccountRepositoryInterface ->whereIn('object_groupable_id', $accounts->pluck('id')->toArray())->get() ; - /** @var \stdClass $row */ + /** @var stdClass $row */ foreach ($set as $row) { $groupIds[] = $row->object_group_id; } $groupIds = array_unique($groupIds); $groups = ObjectGroup::whereIn('id', $groupIds)->get(); - /** @var \stdClass $row */ + /** @var stdClass $row */ foreach ($set as $row) { if (!array_key_exists($row->object_groupable_id, $return)) { /** @var null|ObjectGroup $group */ @@ -368,7 +370,7 @@ class AccountRepository implements AccountRepositoryInterface return $query->get(['accounts.*']); } - #[\Override] + #[Override] public function update(Account $account, array $data): Account { /** @var AccountUpdateService $service */ diff --git a/app/Repositories/UserGroups/ExchangeRate/ExchangeRateRepository.php b/app/Repositories/UserGroups/ExchangeRate/ExchangeRateRepository.php index 2460d7d572..56e0fcb1df 100644 --- a/app/Repositories/UserGroups/ExchangeRate/ExchangeRateRepository.php +++ b/app/Repositories/UserGroups/ExchangeRate/ExchangeRateRepository.php @@ -30,6 +30,7 @@ use FireflyIII\Models\TransactionCurrency; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Collection; +use Override; /** * Class ExchangeRateRepository @@ -40,19 +41,19 @@ class ExchangeRateRepository implements ExchangeRateRepositoryInterface { use UserGroupTrait; - #[\Override] + #[Override] public function deleteRate(CurrencyExchangeRate $rate): void { $this->userGroup->currencyExchangeRates()->where('id', $rate->id)->delete(); } - #[\Override] + #[Override] public function getAll(): Collection { return $this->userGroup->currencyExchangeRates()->orderBy('date', 'ASC')->get(); } - #[\Override] + #[Override] public function getRates(TransactionCurrency $from, TransactionCurrency $to): Collection { // orderBy('date', 'DESC')->toRawSql(); @@ -75,7 +76,7 @@ class ExchangeRateRepository implements ExchangeRateRepositoryInterface } - #[\Override] + #[Override] public function getSpecificRateOnDate(TransactionCurrency $from, TransactionCurrency $to, Carbon $date): ?CurrencyExchangeRate { /** @var null|CurrencyExchangeRate */ @@ -88,7 +89,7 @@ class ExchangeRateRepository implements ExchangeRateRepositoryInterface ; } - #[\Override] + #[Override] public function storeExchangeRate(TransactionCurrency $from, TransactionCurrency $to, string $rate, Carbon $date): CurrencyExchangeRate { $object = new CurrencyExchangeRate(); @@ -104,7 +105,7 @@ class ExchangeRateRepository implements ExchangeRateRepositoryInterface return $object; } - #[\Override] + #[Override] public function updateExchangeRate(CurrencyExchangeRate $object, string $rate, ?Carbon $date = null): CurrencyExchangeRate { $object->rate = $rate; diff --git a/app/Rules/Account/IsValidAccountType.php b/app/Rules/Account/IsValidAccountType.php index 7987b5385c..52042572f1 100644 --- a/app/Rules/Account/IsValidAccountType.php +++ b/app/Rules/Account/IsValidAccountType.php @@ -26,13 +26,15 @@ namespace FireflyIII\Rules\Account; use FireflyIII\Support\Http\Api\AccountFilter; use Illuminate\Contracts\Validation\ValidationRule; +use Closure; +use Override; class IsValidAccountType implements ValidationRule { use AccountFilter; - #[\Override] - public function validate(string $attribute, mixed $value, \Closure $fail): void + #[Override] + public function validate(string $attribute, mixed $value, Closure $fail): void { // only check the type. if (array_key_exists('type', $value)) { diff --git a/app/Rules/Admin/IsValidDiscordUrl.php b/app/Rules/Admin/IsValidDiscordUrl.php index 9d328612d5..ccb4800935 100644 --- a/app/Rules/Admin/IsValidDiscordUrl.php +++ b/app/Rules/Admin/IsValidDiscordUrl.php @@ -28,6 +28,7 @@ namespace FireflyIII\Rules\Admin; use FireflyIII\Support\Validation\ValidatesAmountsTrait; use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Support\Facades\Log; +use Closure; class IsValidDiscordUrl implements ValidationRule { @@ -36,7 +37,7 @@ class IsValidDiscordUrl implements ValidationRule /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { $value = (string) $value; if ('' === $value) { diff --git a/app/Rules/Admin/IsValidSlackOrDiscordUrl.php b/app/Rules/Admin/IsValidSlackOrDiscordUrl.php index 866127f988..5b9f6063da 100644 --- a/app/Rules/Admin/IsValidSlackOrDiscordUrl.php +++ b/app/Rules/Admin/IsValidSlackOrDiscordUrl.php @@ -28,6 +28,7 @@ namespace FireflyIII\Rules\Admin; use FireflyIII\Support\Validation\ValidatesAmountsTrait; use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Support\Facades\Log; +use Closure; class IsValidSlackOrDiscordUrl implements ValidationRule { @@ -36,7 +37,7 @@ class IsValidSlackOrDiscordUrl implements ValidationRule /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { $value = (string) $value; if ('' === $value) { diff --git a/app/Rules/Admin/IsValidSlackUrl.php b/app/Rules/Admin/IsValidSlackUrl.php index e7e12fd464..90fc1dafcd 100644 --- a/app/Rules/Admin/IsValidSlackUrl.php +++ b/app/Rules/Admin/IsValidSlackUrl.php @@ -28,6 +28,7 @@ namespace FireflyIII\Rules\Admin; use FireflyIII\Support\Validation\ValidatesAmountsTrait; use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Support\Facades\Log; +use Closure; class IsValidSlackUrl implements ValidationRule { @@ -36,7 +37,7 @@ class IsValidSlackUrl implements ValidationRule /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { $value = (string) $value; if ('' === $value) { diff --git a/app/Rules/BelongsUser.php b/app/Rules/BelongsUser.php index 564b030443..2e1fa3a9c2 100644 --- a/app/Rules/BelongsUser.php +++ b/app/Rules/BelongsUser.php @@ -32,13 +32,14 @@ use FireflyIII\Models\Category; use FireflyIII\Models\PiggyBank; use FireflyIII\Models\TransactionJournal; use Illuminate\Contracts\Validation\ValidationRule; +use Closure; /** * Class BelongsUser */ class BelongsUser implements ValidationRule { - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { $attribute = $this->parseAttribute($attribute); if (!auth()->check()) { diff --git a/app/Rules/BelongsUserGroup.php b/app/Rules/BelongsUserGroup.php index 8a4f1519c5..fe29b1fbef 100644 --- a/app/Rules/BelongsUserGroup.php +++ b/app/Rules/BelongsUserGroup.php @@ -33,6 +33,7 @@ use FireflyIII\Models\PiggyBank; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\UserGroup; use Illuminate\Contracts\Validation\ValidationRule; +use Closure; /** * Class BelongsUserGroup @@ -47,7 +48,7 @@ class BelongsUserGroup implements ValidationRule */ public function __construct(private readonly UserGroup $userGroup) {} - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { $attribute = $this->parseAttribute($attribute); if (!auth()->check()) { diff --git a/app/Rules/IsAllowedGroupAction.php b/app/Rules/IsAllowedGroupAction.php index 46c717ef44..f3a197f113 100644 --- a/app/Rules/IsAllowedGroupAction.php +++ b/app/Rules/IsAllowedGroupAction.php @@ -31,6 +31,8 @@ use FireflyIII\User; use Illuminate\Auth\Access\AuthorizationException; use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Support\Facades\Log; +use Closure; +use Override; class IsAllowedGroupAction implements ValidationRule { @@ -47,8 +49,8 @@ class IsAllowedGroupAction implements ValidationRule /** * @throws AuthorizationException */ - #[\Override] - public function validate(string $attribute, mixed $value, \Closure $fail): void + #[Override] + public function validate(string $attribute, mixed $value, Closure $fail): void { if ('GET' === $this->methodName) { // need at least "read only rights". @@ -69,7 +71,7 @@ class IsAllowedGroupAction implements ValidationRule $this->validateUserGroup((int) $value, $fail); } - private function validateUserGroup(int $userGroupId, \Closure $fail): void + private function validateUserGroup(int $userGroupId, Closure $fail): void { Log::debug(sprintf('validateUserGroup: %s', static::class)); if (!auth()->check()) { diff --git a/app/Rules/IsAssetAccountId.php b/app/Rules/IsAssetAccountId.php index 7eb128dbaf..e8d26937fd 100644 --- a/app/Rules/IsAssetAccountId.php +++ b/app/Rules/IsAssetAccountId.php @@ -26,6 +26,7 @@ namespace FireflyIII\Rules; use FireflyIII\Enums\AccountTypeEnum; use FireflyIII\Models\Account; use Illuminate\Contracts\Validation\ValidationRule; +use Closure; /** * Class IsAssetAccountId @@ -35,7 +36,7 @@ class IsAssetAccountId implements ValidationRule /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { $accountId = (int) $value; diff --git a/app/Rules/IsBoolean.php b/app/Rules/IsBoolean.php index 9ffd5a7366..28c1ca3781 100644 --- a/app/Rules/IsBoolean.php +++ b/app/Rules/IsBoolean.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace FireflyIII\Rules; use Illuminate\Contracts\Validation\ValidationRule; +use Closure; /** * Class IsBoolean @@ -34,7 +35,7 @@ class IsBoolean implements ValidationRule /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { if (is_bool($value)) { return; diff --git a/app/Rules/IsDateOrTime.php b/app/Rules/IsDateOrTime.php index 209d64ce12..64d711ec99 100644 --- a/app/Rules/IsDateOrTime.php +++ b/app/Rules/IsDateOrTime.php @@ -28,6 +28,7 @@ use Carbon\Carbon; use Carbon\Exceptions\InvalidDateException; use Carbon\Exceptions\InvalidFormatException; use Illuminate\Contracts\Validation\ValidationRule; +use Closure; /** * Class IsDateOrTime @@ -37,7 +38,7 @@ class IsDateOrTime implements ValidationRule /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { $value = (string) $value; if ('' === $value) { diff --git a/app/Rules/IsDefaultUserGroupName.php b/app/Rules/IsDefaultUserGroupName.php index 6f314e8dff..81b366a2e6 100644 --- a/app/Rules/IsDefaultUserGroupName.php +++ b/app/Rules/IsDefaultUserGroupName.php @@ -28,6 +28,7 @@ use FireflyIII\Models\UserGroup; use FireflyIII\Repositories\User\UserRepositoryInterface; use FireflyIII\User; use Illuminate\Contracts\Validation\ValidationRule; +use Closure; /** * Class IsDefaultUserGroupName @@ -39,7 +40,7 @@ class IsDefaultUserGroupName implements ValidationRule /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { app('log')->debug(sprintf('Now in %s(%s)', __METHOD__, $value)); diff --git a/app/Rules/IsDuplicateTransaction.php b/app/Rules/IsDuplicateTransaction.php index b8076b20f6..e0f6d4ac23 100644 --- a/app/Rules/IsDuplicateTransaction.php +++ b/app/Rules/IsDuplicateTransaction.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace FireflyIII\Rules; use Illuminate\Contracts\Validation\ValidationRule; +use Closure; /** * TODO not sure where this is used. @@ -38,7 +39,7 @@ class IsDuplicateTransaction implements ValidationRule /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { $this->value = $value; diff --git a/app/Rules/IsFilterValueIn.php b/app/Rules/IsFilterValueIn.php index dddd247fa9..e167bdb79c 100644 --- a/app/Rules/IsFilterValueIn.php +++ b/app/Rules/IsFilterValueIn.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace FireflyIII\Rules; use Illuminate\Contracts\Validation\ValidationRule; +use Closure; class IsFilterValueIn implements ValidationRule { @@ -33,7 +34,7 @@ class IsFilterValueIn implements ValidationRule /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { if (!is_array($value)) { return; diff --git a/app/Rules/IsTransferAccount.php b/app/Rules/IsTransferAccount.php index ef78af6d98..22f1fc5d8c 100644 --- a/app/Rules/IsTransferAccount.php +++ b/app/Rules/IsTransferAccount.php @@ -27,6 +27,7 @@ namespace FireflyIII\Rules; use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Validation\AccountValidator; use Illuminate\Contracts\Validation\ValidationRule; +use Closure; /** * Class IsTransferAccount @@ -36,7 +37,7 @@ class IsTransferAccount implements ValidationRule /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { app('log')->debug(sprintf('Now in %s(%s)', __METHOD__, $value)); diff --git a/app/Rules/IsValidActionExpression.php b/app/Rules/IsValidActionExpression.php index 48fcb02efc..d12b507bd3 100644 --- a/app/Rules/IsValidActionExpression.php +++ b/app/Rules/IsValidActionExpression.php @@ -28,17 +28,18 @@ namespace FireflyIII\Rules; use FireflyIII\TransactionRules\Expressions\ActionExpression; use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Translation\PotentiallyTranslatedString; +use Closure; class IsValidActionExpression implements ValidationRule { /** * Check that the given action expression is syntactically valid. * - * @param \Closure(string): PotentiallyTranslatedString $fail + * @param Closure(string): PotentiallyTranslatedString $fail * * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { if (false === config('firefly.feature_flags.expression_engine')) { return; diff --git a/app/Rules/IsValidAmount.php b/app/Rules/IsValidAmount.php index b39dfa13ab..208d60c696 100644 --- a/app/Rules/IsValidAmount.php +++ b/app/Rules/IsValidAmount.php @@ -28,6 +28,7 @@ namespace FireflyIII\Rules; use FireflyIII\Support\Validation\ValidatesAmountsTrait; use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Support\Facades\Log; +use Closure; class IsValidAmount implements ValidationRule { @@ -36,7 +37,7 @@ class IsValidAmount implements ValidationRule /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { $value = (string) $value; diff --git a/app/Rules/IsValidAttachmentModel.php b/app/Rules/IsValidAttachmentModel.php index 16388e6242..093e650cf2 100644 --- a/app/Rules/IsValidAttachmentModel.php +++ b/app/Rules/IsValidAttachmentModel.php @@ -41,6 +41,7 @@ use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use FireflyIII\Repositories\Tag\TagRepositoryInterface; use Illuminate\Contracts\Validation\ValidationRule; +use Closure; /** * Class IsValidAttachmentModel @@ -70,7 +71,7 @@ class IsValidAttachmentModel implements ValidationRule /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { if (!auth()->check()) { $fail('validation.model_id_invalid')->translate(); diff --git a/app/Rules/IsValidBulkClause.php b/app/Rules/IsValidBulkClause.php index 148d5600b1..10ce75cf86 100644 --- a/app/Rules/IsValidBulkClause.php +++ b/app/Rules/IsValidBulkClause.php @@ -26,6 +26,8 @@ namespace FireflyIII\Rules; use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Support\Facades\Validator; +use Closure; +use JsonException; /** * Class IsValidBulkClause @@ -49,7 +51,7 @@ class IsValidBulkClause implements ValidationRule /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { $result = $this->basicValidation((string) $value); if (false === $result) { @@ -64,7 +66,7 @@ class IsValidBulkClause implements ValidationRule { try { $array = \Safe\json_decode($value, true, 8, JSON_THROW_ON_ERROR); - } catch (\JsonException) { + } catch (JsonException) { $this->error = (string) trans('validation.json'); return false; diff --git a/app/Rules/IsValidDateRange.php b/app/Rules/IsValidDateRange.php index 3d35f011be..faf4b4343e 100644 --- a/app/Rules/IsValidDateRange.php +++ b/app/Rules/IsValidDateRange.php @@ -28,13 +28,14 @@ use Carbon\Carbon; use Carbon\Exceptions\InvalidDateException; use Carbon\Exceptions\InvalidFormatException; use Illuminate\Contracts\Validation\ValidationRule; +use Closure; class IsValidDateRange implements ValidationRule { /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { $value = (string) $value; if ('' === $value) { diff --git a/app/Rules/IsValidPositiveAmount.php b/app/Rules/IsValidPositiveAmount.php index 5f3cc94f66..c232bb02ef 100644 --- a/app/Rules/IsValidPositiveAmount.php +++ b/app/Rules/IsValidPositiveAmount.php @@ -28,6 +28,7 @@ namespace FireflyIII\Rules; use FireflyIII\Support\Validation\ValidatesAmountsTrait; use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Support\Facades\Log; +use Closure; class IsValidPositiveAmount implements ValidationRule { @@ -36,7 +37,7 @@ class IsValidPositiveAmount implements ValidationRule /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { if (is_array($value)) { $fail('validation.numeric')->translate(); diff --git a/app/Rules/IsValidZeroOrMoreAmount.php b/app/Rules/IsValidZeroOrMoreAmount.php index 263691ff8a..3c93762333 100644 --- a/app/Rules/IsValidZeroOrMoreAmount.php +++ b/app/Rules/IsValidZeroOrMoreAmount.php @@ -28,6 +28,7 @@ namespace FireflyIII\Rules; use FireflyIII\Support\Validation\ValidatesAmountsTrait; use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Support\Facades\Log; +use Closure; class IsValidZeroOrMoreAmount implements ValidationRule { @@ -38,7 +39,7 @@ class IsValidZeroOrMoreAmount implements ValidationRule /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { if (true === $this->nullable && null === $value) { return; diff --git a/app/Rules/LessThanPiggyTarget.php b/app/Rules/LessThanPiggyTarget.php index 2fa6a729eb..78df186875 100644 --- a/app/Rules/LessThanPiggyTarget.php +++ b/app/Rules/LessThanPiggyTarget.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace FireflyIII\Rules; use Illuminate\Contracts\Validation\ValidationRule; +use Closure; /** * Class LessThanPiggyTarget @@ -42,7 +43,7 @@ class LessThanPiggyTarget implements ValidationRule /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { // TODO not sure if this is still used. } diff --git a/app/Rules/UniqueAccountNumber.php b/app/Rules/UniqueAccountNumber.php index 3e02e2c7e9..554bb2bbd0 100644 --- a/app/Rules/UniqueAccountNumber.php +++ b/app/Rules/UniqueAccountNumber.php @@ -28,6 +28,7 @@ use FireflyIII\Enums\AccountTypeEnum; use FireflyIII\Models\Account; use FireflyIII\Models\AccountMeta; use Illuminate\Contracts\Validation\ValidationRule; +use Closure; /** * Class UniqueAccountNumber @@ -66,7 +67,7 @@ class UniqueAccountNumber implements ValidationRule /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { if (!auth()->check()) { return; diff --git a/app/Rules/UniqueIban.php b/app/Rules/UniqueIban.php index b6aca57927..aaff70fb49 100644 --- a/app/Rules/UniqueIban.php +++ b/app/Rules/UniqueIban.php @@ -28,6 +28,7 @@ use FireflyIII\Enums\AccountTypeEnum; use FireflyIII\Models\Account; use FireflyIII\Support\Facades\Steam; use Illuminate\Contracts\Validation\ValidationRule; +use Closure; /** * Class UniqueIban @@ -69,7 +70,7 @@ class UniqueIban implements ValidationRule return (string) trans('validation.unique_iban_for_user'); } - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { if (!$this->passes($attribute, $value)) { $fail((string) trans('validation.unique_iban_for_user')); diff --git a/app/Rules/ValidJournals.php b/app/Rules/ValidJournals.php index 68368d21fd..2e2b6c6230 100644 --- a/app/Rules/ValidJournals.php +++ b/app/Rules/ValidJournals.php @@ -26,6 +26,7 @@ namespace FireflyIII\Rules; use FireflyIII\Models\TransactionJournal; use Illuminate\Contracts\Validation\ValidationRule; +use Closure; /** * Class ValidJournals @@ -35,7 +36,7 @@ class ValidJournals implements ValidationRule /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { app('log')->debug('In ValidJournals::passes'); if (!is_array($value)) { diff --git a/app/Rules/ValidRecurrenceRepetitionType.php b/app/Rules/ValidRecurrenceRepetitionType.php index d11eded70c..f8e0fe3606 100644 --- a/app/Rules/ValidRecurrenceRepetitionType.php +++ b/app/Rules/ValidRecurrenceRepetitionType.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace FireflyIII\Rules; use Illuminate\Contracts\Validation\ValidationRule; +use Closure; /** * Class ValidRecurrenceRepetitionType @@ -36,7 +37,7 @@ class ValidRecurrenceRepetitionType implements ValidationRule * * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { $value = (string) $value; if ('daily' === $value) { diff --git a/app/Rules/ValidRecurrenceRepetitionValue.php b/app/Rules/ValidRecurrenceRepetitionValue.php index 71576e9cf1..5a1a4b9031 100644 --- a/app/Rules/ValidRecurrenceRepetitionValue.php +++ b/app/Rules/ValidRecurrenceRepetitionValue.php @@ -26,6 +26,8 @@ namespace FireflyIII\Rules; use Carbon\Carbon; use Illuminate\Contracts\Validation\ValidationRule; +use Closure; +use InvalidArgumentException; /** * Class ValidRecurrenceRepetitionValue @@ -35,7 +37,7 @@ class ValidRecurrenceRepetitionValue implements ValidationRule /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function validate(string $attribute, mixed $value, \Closure $fail): void + public function validate(string $attribute, mixed $value, Closure $fail): void { $value = (string) $value; @@ -102,7 +104,7 @@ class ValidRecurrenceRepetitionValue implements ValidationRule try { Carbon::createFromFormat('Y-m-d', $dateString); - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { app('log')->debug(sprintf('Could not parse date %s: %s', $dateString, $e->getMessage())); return false; diff --git a/app/Services/FireflyIIIOrg/Update/UpdateRequest.php b/app/Services/FireflyIIIOrg/Update/UpdateRequest.php index 29499570bc..f526efcb1e 100644 --- a/app/Services/FireflyIIIOrg/Update/UpdateRequest.php +++ b/app/Services/FireflyIIIOrg/Update/UpdateRequest.php @@ -29,6 +29,7 @@ use FireflyIII\Events\NewVersionAvailable; use GuzzleHttp\Client; use GuzzleHttp\Exception\GuzzleException; use Illuminate\Support\Facades\Log; +use JsonException; /** * Class UpdateRequest @@ -100,7 +101,7 @@ class UpdateRequest implements UpdateRequestInterface try { $json = \Safe\json_decode($body, true, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException) { + } catch (JsonException) { Log::error('Body is not valid JSON'); Log::error($body); $return['message'] = 'Invalid JSON :('; diff --git a/app/Services/Internal/Destroy/AccountDestroyService.php b/app/Services/Internal/Destroy/AccountDestroyService.php index 44fbaea069..ecfaddb147 100644 --- a/app/Services/Internal/Destroy/AccountDestroyService.php +++ b/app/Services/Internal/Destroy/AccountDestroyService.php @@ -32,6 +32,7 @@ use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Facades\DB; +use stdClass; /** * Class AccountDestroyService @@ -119,7 +120,7 @@ class AccountDestroyService $service = app(JournalDestroyService::class); $user = $account->user; - /** @var \stdClass $row */ + /** @var stdClass $row */ foreach ($collection as $row) { if ((int) $row->the_count > 1) { $journalId = $row->transaction_journal_id; diff --git a/app/Services/Internal/Update/CategoryUpdateService.php b/app/Services/Internal/Update/CategoryUpdateService.php index aff42c2d05..28b5f36f00 100644 --- a/app/Services/Internal/Update/CategoryUpdateService.php +++ b/app/Services/Internal/Update/CategoryUpdateService.php @@ -30,6 +30,7 @@ use FireflyIII\Models\RecurrenceTransactionMeta; use FireflyIII\Models\RuleAction; use FireflyIII\Models\RuleTrigger; use FireflyIII\User; +use Exception; /** * Class CategoryUpdateService @@ -59,7 +60,7 @@ class CategoryUpdateService } /** - * @throws \Exception + * @throws Exception */ public function update(Category $category, array $data): Category { @@ -128,7 +129,7 @@ class CategoryUpdateService } /** - * @throws \Exception + * @throws Exception */ private function updateNotes(Category $category, array $data): void { diff --git a/app/Services/Webhook/StandardWebhookSender.php b/app/Services/Webhook/StandardWebhookSender.php index 264e754bc8..1e312ed408 100644 --- a/app/Services/Webhook/StandardWebhookSender.php +++ b/app/Services/Webhook/StandardWebhookSender.php @@ -32,6 +32,7 @@ use GuzzleHttp\Client; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\RequestException; +use JsonException; /** * Class StandardWebhookSender @@ -81,7 +82,7 @@ class StandardWebhookSender implements WebhookSenderInterface try { $json = \Safe\json_encode($this->message->message, JSON_THROW_ON_ERROR); - } catch (\JsonException $e) { + } catch (JsonException $e) { app('log')->error('Did not send message because of a JSON error.'); app('log')->error($e->getMessage()); app('log')->error($e->getTraceAsString()); diff --git a/app/Support/Amount.php b/app/Support/Amount.php index 7fc77c0229..0b419769ff 100644 --- a/app/Support/Amount.php +++ b/app/Support/Amount.php @@ -31,6 +31,7 @@ use FireflyIII\Models\UserGroup; use FireflyIII\Support\Facades\Preferences; use FireflyIII\User; use Illuminate\Support\Collection; +use NumberFormatter; /** * Class Amount. @@ -60,10 +61,10 @@ class Amount $rounded = app('steam')->bcround($amount, $decimalPlaces); $coloured ??= true; - $fmt = new \NumberFormatter($locale, \NumberFormatter::CURRENCY); - $fmt->setSymbol(\NumberFormatter::CURRENCY_SYMBOL, $symbol); - $fmt->setAttribute(\NumberFormatter::MIN_FRACTION_DIGITS, $decimalPlaces); - $fmt->setAttribute(\NumberFormatter::MAX_FRACTION_DIGITS, $decimalPlaces); + $fmt = new NumberFormatter($locale, NumberFormatter::CURRENCY); + $fmt->setSymbol(NumberFormatter::CURRENCY_SYMBOL, $symbol); + $fmt->setAttribute(NumberFormatter::MIN_FRACTION_DIGITS, $decimalPlaces); + $fmt->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, $decimalPlaces); $result = (string) $fmt->format((float) $rounded); // intentional float if (true === $coloured) { @@ -262,10 +263,10 @@ class Amount $info['n_sep_by_space'] = $this->getLocaleField($info, 'n_sep_by_space'); $info['p_sep_by_space'] = $this->getLocaleField($info, 'p_sep_by_space'); - $fmt = new \NumberFormatter($locale, \NumberFormatter::CURRENCY); + $fmt = new NumberFormatter($locale, NumberFormatter::CURRENCY); - $info['mon_decimal_point'] = $fmt->getSymbol(\NumberFormatter::MONETARY_SEPARATOR_SYMBOL); - $info['mon_thousands_sep'] = $fmt->getSymbol(\NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL); + $info['mon_decimal_point'] = $fmt->getSymbol(NumberFormatter::MONETARY_SEPARATOR_SYMBOL); + $info['mon_thousands_sep'] = $fmt->getSymbol(NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL); return $info; } diff --git a/app/Support/Authentication/RemoteUserProvider.php b/app/Support/Authentication/RemoteUserProvider.php index 2fc06cd450..629ea7d5be 100644 --- a/app/Support/Authentication/RemoteUserProvider.php +++ b/app/Support/Authentication/RemoteUserProvider.php @@ -31,13 +31,14 @@ use FireflyIII\User; use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Contracts\Auth\UserProvider; use Illuminate\Support\Str; +use Override; /** * Class RemoteUserProvider */ class RemoteUserProvider implements UserProvider { - #[\Override] + #[Override] public function rehashPasswordIfRequired(Authenticatable $user, array $credentials, bool $force = false): void { app('log')->debug(sprintf('Now at %s', __METHOD__)); diff --git a/app/Support/CacheProperties.php b/app/Support/CacheProperties.php index 2a95210a8c..a025795044 100644 --- a/app/Support/CacheProperties.php +++ b/app/Support/CacheProperties.php @@ -25,6 +25,7 @@ namespace FireflyIII\Support; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Cache; +use JsonException; /** * Class CacheProperties. @@ -80,7 +81,7 @@ class CacheProperties foreach ($this->properties as $property) { try { $content = sprintf('%s%s', $content, \Safe\json_encode($property, JSON_THROW_ON_ERROR)); - } catch (\JsonException) { + } catch (JsonException) { // @ignoreException $content = sprintf('%s%s', $content, hash('sha256', (string) time())); } diff --git a/app/Support/Calendar/Calculator.php b/app/Support/Calendar/Calculator.php index a2941a5400..f9fa6ffe67 100644 --- a/app/Support/Calendar/Calculator.php +++ b/app/Support/Calendar/Calculator.php @@ -26,15 +26,16 @@ namespace FireflyIII\Support\Calendar; use Carbon\Carbon; use FireflyIII\Exceptions\IntervalException; +use SplObjectStorage; /** * Class Calculator */ class Calculator { - public const int DEFAULT_INTERVAL = 1; - private static ?\SplObjectStorage $intervalMap = null; // @phpstan-ignore-line - private static array $intervals = []; + public const int DEFAULT_INTERVAL = 1; + private static ?SplObjectStorage $intervalMap = null; // @phpstan-ignore-line + private static array $intervals = []; /** * @throws IntervalException @@ -62,12 +63,12 @@ class Calculator return self::loadIntervalMap()->contains($periodicity); } - private static function loadIntervalMap(): \SplObjectStorage + private static function loadIntervalMap(): SplObjectStorage { if (null !== self::$intervalMap) { return self::$intervalMap; } - self::$intervalMap = new \SplObjectStorage(); + self::$intervalMap = new SplObjectStorage(); foreach (Periodicity::cases() as $interval) { $periodicityClass = __NAMESPACE__."\\Periodicity\\{$interval->name}"; self::$intervals[] = $interval->name; diff --git a/app/Support/Cronjobs/UpdateCheckCronjob.php b/app/Support/Cronjobs/UpdateCheckCronjob.php index 0cfb0a0967..dd1f603797 100644 --- a/app/Support/Cronjobs/UpdateCheckCronjob.php +++ b/app/Support/Cronjobs/UpdateCheckCronjob.php @@ -28,12 +28,13 @@ use FireflyIII\Helpers\Update\UpdateTrait; use FireflyIII\Models\Configuration; use FireflyIII\Support\Facades\FireflyConfig; use Illuminate\Support\Facades\Log; +use Override; class UpdateCheckCronjob extends AbstractCronjob { use UpdateTrait; - #[\Override] + #[Override] public function fire(): void { Log::debug('Now in checkForUpdates()'); diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.php index 68e2c07064..e460353ac2 100644 --- a/app/Support/ExpandedForm.php +++ b/app/Support/ExpandedForm.php @@ -27,6 +27,7 @@ use Illuminate\Database\Eloquent\Model; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Support\Form\FormSupport; use Illuminate\Support\Collection; +use Throwable; /** * Class ExpandedForm. @@ -56,7 +57,7 @@ class ExpandedForm // } try { $html = view('form.amount-no-currency', compact('classes', 'name', 'label', 'value', 'options'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->error(sprintf('Could not render amountNoCurrency(): %s', $e->getMessage())); $html = 'Could not render amountNoCurrency.'; @@ -91,7 +92,7 @@ class ExpandedForm try { $html = view('form.checkbox', compact('classes', 'name', 'label', 'value', 'options'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->debug(sprintf('Could not render checkbox(): %s', $e->getMessage())); $html = 'Could not render checkbox.'; @@ -116,7 +117,7 @@ class ExpandedForm try { $html = view('form.date', compact('classes', 'name', 'label', 'value', 'options'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->debug(sprintf('Could not render date(): %s', $e->getMessage())); $html = 'Could not render date.'; @@ -138,7 +139,7 @@ class ExpandedForm try { $html = view('form.file', compact('classes', 'name', 'label', 'options'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->debug(sprintf('Could not render file(): %s', $e->getMessage())); $html = 'Could not render file.'; @@ -164,7 +165,7 @@ class ExpandedForm try { $html = view('form.integer', compact('classes', 'name', 'label', 'value', 'options'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->debug(sprintf('Could not render integer(): %s', $e->getMessage())); $html = 'Could not render integer.'; @@ -189,7 +190,7 @@ class ExpandedForm try { $html = view('form.location', compact('classes', 'name', 'label', 'value', 'options'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->debug(sprintf('Could not render location(): %s', $e->getMessage())); $html = 'Could not render location.'; @@ -242,7 +243,7 @@ class ExpandedForm try { $html = view('form.object_group', compact('classes', 'name', 'label', 'value', 'options'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->debug(sprintf('Could not render objectGroup(): %s', $e->getMessage())); $html = 'Could not render objectGroup.'; @@ -259,7 +260,7 @@ class ExpandedForm { try { $html = view('form.options', compact('type', 'name'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->debug(sprintf('Could not render select(): %s', $e->getMessage())); $html = 'Could not render optionsList.'; @@ -280,7 +281,7 @@ class ExpandedForm try { $html = view('form.password', compact('classes', 'name', 'label', 'options'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->debug(sprintf('Could not render password(): %s', $e->getMessage())); $html = 'Could not render password.'; @@ -301,7 +302,7 @@ class ExpandedForm try { $html = view('form.password', compact('classes', 'value', 'name', 'label', 'options'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->debug(sprintf('Could not render passwordWithValue(): %s', $e->getMessage())); $html = 'Could not render passwordWithValue.'; @@ -329,7 +330,7 @@ class ExpandedForm try { $html = view('form.percentage', compact('classes', 'name', 'label', 'value', 'options'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->debug(sprintf('Could not render percentage(): %s', $e->getMessage())); $html = 'Could not render percentage.'; @@ -352,7 +353,7 @@ class ExpandedForm try { $html = view('form.static', compact('classes', 'name', 'label', 'value', 'options'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->debug(sprintf('Could not render staticText(): %s', $e->getMessage())); $html = 'Could not render staticText.'; @@ -376,7 +377,7 @@ class ExpandedForm try { $html = view('form.text', compact('classes', 'name', 'label', 'value', 'options'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->debug(sprintf('Could not render text(): %s', $e->getMessage())); $html = 'Could not render text.'; @@ -405,7 +406,7 @@ class ExpandedForm try { $html = view('form.textarea', compact('classes', 'name', 'label', 'value', 'options'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->debug(sprintf('Could not render textarea(): %s', $e->getMessage())); $html = 'Could not render textarea.'; diff --git a/app/Support/FireflyConfig.php b/app/Support/FireflyConfig.php index 009fc71390..eab22d84d8 100644 --- a/app/Support/FireflyConfig.php +++ b/app/Support/FireflyConfig.php @@ -30,6 +30,7 @@ use Illuminate\Contracts\Encryption\EncryptException; use Illuminate\Database\QueryException; use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Log; +use Exception; /** * Class FireflyConfig. @@ -88,7 +89,7 @@ class FireflyConfig try { /** @var null|Configuration $config */ $config = Configuration::where('name', $name)->first(['id', 'name', 'data']); - } catch (\Exception|QueryException $e) { + } catch (Exception|QueryException $e) { throw new FireflyException(sprintf('Could not poll the database: %s', $e->getMessage()), 0, $e); } diff --git a/app/Support/Form/AccountForm.php b/app/Support/Form/AccountForm.php index 348983ed23..7dfc257bfa 100644 --- a/app/Support/Form/AccountForm.php +++ b/app/Support/Form/AccountForm.php @@ -28,6 +28,7 @@ use FireflyIII\Enums\AccountTypeEnum; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Account; use FireflyIII\Repositories\Account\AccountRepositoryInterface; +use Throwable; /** * Class AccountForm @@ -124,7 +125,7 @@ class AccountForm try { $html = view('form.assetAccountCheckList', compact('classes', 'selected', 'name', 'label', 'options', 'grouped'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->debug(sprintf('Could not render assetAccountCheckList(): %s', $e->getMessage())); $html = 'Could not render assetAccountCheckList.'; diff --git a/app/Support/Form/CurrencyForm.php b/app/Support/Form/CurrencyForm.php index ad0997025a..378375a351 100644 --- a/app/Support/Form/CurrencyForm.php +++ b/app/Support/Form/CurrencyForm.php @@ -28,6 +28,7 @@ use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use Illuminate\Support\Collection; +use Throwable; /** * Class CurrencyForm @@ -92,7 +93,7 @@ class CurrencyForm try { $html = view('form.'.$view, compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->debug(sprintf('Could not render currencyField(): %s', $e->getMessage())); $html = 'Could not render currencyField.'; @@ -161,7 +162,7 @@ class CurrencyForm try { $html = view('form.'.$view, compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->debug(sprintf('Could not render currencyField(): %s', $e->getMessage())); $html = 'Could not render currencyField.'; diff --git a/app/Support/Form/FormSupport.php b/app/Support/Form/FormSupport.php index 4b0417f2be..13f5eede8e 100644 --- a/app/Support/Form/FormSupport.php +++ b/app/Support/Form/FormSupport.php @@ -28,6 +28,7 @@ use Carbon\Carbon; use Carbon\Exceptions\InvalidDateException; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use Illuminate\Support\MessageBag; +use Throwable; /** * Trait FormSupport @@ -46,7 +47,7 @@ trait FormSupport try { $html = view('form.multi-select', compact('classes', 'name', 'label', 'selected', 'options', 'list'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->debug(sprintf('Could not render multi-select(): %s', $e->getMessage())); $html = 'Could not render multi-select.'; } @@ -131,7 +132,7 @@ trait FormSupport try { $html = view('form.select', compact('classes', 'name', 'label', 'selected', 'options', 'list'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->debug(sprintf('Could not render select(): %s', $e->getMessage())); $html = 'Could not render select.'; } diff --git a/app/Support/Http/Controllers/ModelInformation.php b/app/Support/Http/Controllers/ModelInformation.php index 0d995753e2..65fd660211 100644 --- a/app/Support/Http/Controllers/ModelInformation.php +++ b/app/Support/Http/Controllers/ModelInformation.php @@ -32,6 +32,7 @@ use FireflyIII\Models\Tag; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Account\AccountRepositoryInterface; +use Throwable; /** * Trait ModelInformation @@ -55,7 +56,7 @@ trait ModelInformation 'count' => 1, ] )->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->error(sprintf('Throwable was thrown in getActionsForBill(): %s', $e->getMessage())); app('log')->error($e->getTraceAsString()); $result = 'Could not render view. See log files.'; @@ -142,7 +143,7 @@ trait ModelInformation 'triggers' => $triggers, ] )->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->debug(sprintf('Throwable was thrown in getTriggersForBill(): %s', $e->getMessage())); app('log')->debug($e->getTraceAsString()); @@ -258,7 +259,7 @@ trait ModelInformation 'triggers' => $triggers, ]; $string = view('rules.partials.trigger', $renderInfo)->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->debug(sprintf('Throwable was thrown in getTriggersForJournal(): %s', $e->getMessage())); app('log')->debug($e->getTraceAsString()); diff --git a/app/Support/Http/Controllers/RenderPartialViews.php b/app/Support/Http/Controllers/RenderPartialViews.php index 4bb800469f..4c5f8348c6 100644 --- a/app/Support/Http/Controllers/RenderPartialViews.php +++ b/app/Support/Http/Controllers/RenderPartialViews.php @@ -37,6 +37,7 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Category\CategoryRepositoryInterface; use FireflyIII\Repositories\Tag\TagRepositoryInterface; use FireflyIII\Support\Search\OperatorQuerySearch; +use Throwable; /** * Trait RenderPartialViews @@ -68,7 +69,7 @@ trait RenderPartialViews try { $view = view('popup.report.balance-amount', compact('journals', 'budget', 'account'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->error(sprintf('Could not render: %s', $e->getMessage())); $view = 'Firefly III could not render the view. Please see the log files.'; @@ -91,7 +92,7 @@ trait RenderPartialViews try { $result = view('reports.options.budget', compact('budgets'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage())); $result = 'Could not render view.'; @@ -123,7 +124,7 @@ trait RenderPartialViews try { $view = view('popup.report.budget-spent-amount', compact('journals', 'budget'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->error(sprintf('Could not render: %s', $e->getMessage())); $view = 'Firefly III could not render the view. Please see the log files.'; @@ -150,7 +151,7 @@ trait RenderPartialViews try { $view = view('popup.report.category-entry', compact('journals', 'category'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->error(sprintf('Could not render: %s', $e->getMessage())); $view = 'Firefly III could not render the view. Please see the log files.'; @@ -173,7 +174,7 @@ trait RenderPartialViews try { $result = view('reports.options.category', compact('categories'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->error(sprintf('Cannot render reports.options.category: %s', $e->getMessage())); $result = 'Could not render view.'; @@ -215,7 +216,7 @@ trait RenderPartialViews try { $result = view('reports.options.double', compact('set'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage())); $result = 'Could not render view.'; @@ -248,7 +249,7 @@ trait RenderPartialViews try { $view = view('popup.report.expense-entry', compact('journals', 'account'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->error(sprintf('Could not render: %s', $e->getMessage())); $view = 'Firefly III could not render the view. Please see the log files.'; @@ -284,7 +285,7 @@ trait RenderPartialViews 'count' => $count, ] )->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->debug(sprintf('Throwable was thrown in getCurrentActions(): %s', $e->getMessage())); app('log')->error($e->getTraceAsString()); @@ -339,7 +340,7 @@ trait RenderPartialViews 'triggers' => $triggers, ] )->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->debug(sprintf('Throwable was thrown in getCurrentTriggers(): %s', $e->getMessage())); app('log')->error($e->getTraceAsString()); @@ -375,7 +376,7 @@ trait RenderPartialViews try { $view = view('popup.report.income-entry', compact('journals', 'account'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->error(sprintf('Could not render: %s', $e->getMessage())); $view = 'Firefly III could not render the view. Please see the log files.'; @@ -394,7 +395,7 @@ trait RenderPartialViews { try { $result = view('reports.options.no-options')->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->error(sprintf('Cannot render reports.options.no-options: %s', $e->getMessage())); $result = 'Could not render view.'; @@ -417,7 +418,7 @@ trait RenderPartialViews try { $result = view('reports.options.tag', compact('tags'))->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage())); $result = 'Could not render view.'; diff --git a/app/Support/Http/Controllers/RequestInformation.php b/app/Support/Http/Controllers/RequestInformation.php index 96e6edcfac..84f87d580b 100644 --- a/app/Support/Http/Controllers/RequestInformation.php +++ b/app/Support/Http/Controllers/RequestInformation.php @@ -34,6 +34,7 @@ use Illuminate\Contracts\Validation\Validator as ValidatorContract; use Illuminate\Routing\Route; use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Route as RouteFacade; +use Hash; /** * Trait RequestInformation @@ -169,7 +170,7 @@ trait RequestInformation */ final protected function validatePassword(User $user, string $current, string $new): bool // get request info { - if (!\Hash::check($current, $user->password)) { + if (!Hash::check($current, $user->password)) { throw new ValidationException((string) trans('firefly.invalid_current_password')); } diff --git a/app/Support/Http/Controllers/RuleManagement.php b/app/Support/Http/Controllers/RuleManagement.php index a334161ee0..6b88c3524c 100644 --- a/app/Support/Http/Controllers/RuleManagement.php +++ b/app/Support/Http/Controllers/RuleManagement.php @@ -28,6 +28,7 @@ use FireflyIII\Exceptions\FireflyException; use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface; use FireflyIII\Support\Search\OperatorQuerySearch; use Illuminate\Http\Request; +use Throwable; /** * Trait RuleManagement @@ -54,7 +55,7 @@ trait RuleManagement 'count' => $index + 1, ] )->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->error(sprintf('Throwable was thrown in getPreviousActions(): %s', $e->getMessage())); app('log')->error($e->getTraceAsString()); @@ -99,7 +100,7 @@ trait RuleManagement 'triggers' => $triggers, ] )->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->debug(sprintf('Throwable was thrown in getPreviousTriggers(): %s', $e->getMessage())); app('log')->error($e->getTraceAsString()); @@ -145,7 +146,7 @@ trait RuleManagement 'triggers' => $triggers, ] )->render(); - } catch (\Throwable $e) { + } catch (Throwable $e) { app('log')->debug(sprintf('Throwable was thrown in getPreviousTriggers(): %s', $e->getMessage())); app('log')->error($e->getTraceAsString()); diff --git a/app/Support/JsonApi/Enrichments/AccountEnrichment.php b/app/Support/JsonApi/Enrichments/AccountEnrichment.php index 2de881736e..9318a27293 100644 --- a/app/Support/JsonApi/Enrichments/AccountEnrichment.php +++ b/app/Support/JsonApi/Enrichments/AccountEnrichment.php @@ -39,6 +39,7 @@ use FireflyIII\User; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; +use Override; /** * Class AccountEnrichment @@ -78,7 +79,7 @@ class AccountEnrichment implements EnrichmentInterface // $this->end = null; } - #[\Override] + #[Override] public function enrichSingle(array|Model $model): Account|array { Log::debug(__METHOD__); @@ -88,7 +89,7 @@ class AccountEnrichment implements EnrichmentInterface return $collection->first(); } - #[\Override] + #[Override] /** * Do the actual enrichment. */ diff --git a/app/Support/JsonApi/Enrichments/TransactionGroupEnrichment.php b/app/Support/JsonApi/Enrichments/TransactionGroupEnrichment.php index 6e9b516235..9bac754a7c 100644 --- a/app/Support/JsonApi/Enrichments/TransactionGroupEnrichment.php +++ b/app/Support/JsonApi/Enrichments/TransactionGroupEnrichment.php @@ -39,6 +39,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; +use Override; class TransactionGroupEnrichment implements EnrichmentInterface { @@ -64,7 +65,7 @@ class TransactionGroupEnrichment implements EnrichmentInterface $this->dateFields = ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date', 'invoice_date']; } - #[\Override] + #[Override] public function enrichSingle(array|Model $model): array|TransactionGroup { Log::debug(__METHOD__); @@ -78,7 +79,7 @@ class TransactionGroupEnrichment implements EnrichmentInterface throw new FireflyException('Cannot enrich single model.'); } - #[\Override] + #[Override] public function enrich(Collection $collection): Collection { Log::debug(sprintf('Now doing account enrichment for %d transaction group(s)', $collection->count())); diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php index c17d7c5193..ae604a0e6e 100644 --- a/app/Support/Navigation.php +++ b/app/Support/Navigation.php @@ -30,6 +30,7 @@ use FireflyIII\Helpers\Fiscal\FiscalHelperInterface; use FireflyIII\Support\Calendar\Calculator; use FireflyIII\Support\Calendar\Periodicity; use Illuminate\Support\Facades\Log; +use Throwable; /** * Class Navigation. @@ -93,7 +94,7 @@ class Navigation return $this->calculator->nextDateByInterval($epoch, $periodicity, $skipInterval); } catch (IntervalException $exception) { Log::warning($exception->getMessage(), ['exception' => $exception]); - } catch (\Throwable $exception) { + } catch (Throwable $exception) { Log::error($exception->getMessage(), ['exception' => $exception]); } diff --git a/app/Support/NullArrayObject.php b/app/Support/NullArrayObject.php index f4a0c7f4fa..a1b6b190de 100644 --- a/app/Support/NullArrayObject.php +++ b/app/Support/NullArrayObject.php @@ -24,10 +24,12 @@ declare(strict_types=1); namespace FireflyIII\Support; +use ArrayObject; + /** * Class NullArrayObject */ -class NullArrayObject extends \ArrayObject +class NullArrayObject extends ArrayObject { /** * NullArrayObject constructor. diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php index 519258c1fa..db289a99fc 100644 --- a/app/Support/Search/OperatorQuerySearch.php +++ b/app/Support/Search/OperatorQuerySearch.php @@ -48,6 +48,8 @@ use FireflyIII\Support\Search\QueryParser\StringNode; use FireflyIII\User; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; +use LogicException; +use TypeError; /** * Class OperatorQuerySearch @@ -143,7 +145,7 @@ class OperatorQuerySearch implements SearchInterface try { $parsedQuery = $parser->parse($query); - } catch (\LogicException|\TypeError $e) { + } catch (LogicException|TypeError $e) { app('log')->error($e->getMessage()); app('log')->error(sprintf('Could not parse search: "%s".', $query)); diff --git a/app/Support/Search/QueryParser/GdbotsQueryParser.php b/app/Support/Search/QueryParser/GdbotsQueryParser.php index aa802e0df0..7c610cf4b5 100644 --- a/app/Support/Search/QueryParser/GdbotsQueryParser.php +++ b/app/Support/Search/QueryParser/GdbotsQueryParser.php @@ -30,6 +30,8 @@ use Gdbots\QueryParser\Enum\BoolOperator; use Gdbots\QueryParser\Node as GdbotsNode; use Gdbots\QueryParser\QueryParser as BaseQueryParser; use Illuminate\Support\Facades\Log; +use LogicException; +use TypeError; class GdbotsQueryParser implements QueryParserInterface { @@ -53,7 +55,7 @@ class GdbotsQueryParser implements QueryParserInterface ); return new NodeGroup($nodes); - } catch (\LogicException|\TypeError $e) { + } catch (LogicException|TypeError $e) { \Safe\fwrite(STDERR, "Setting up GdbotsQueryParserTest\n"); app('log')->error($e->getMessage()); app('log')->error(sprintf('Could not parse search: "%s".', $query)); diff --git a/app/Support/Search/QueryParser/QueryParserInterface.php b/app/Support/Search/QueryParser/QueryParserInterface.php index 158452ff98..809f7b02c1 100644 --- a/app/Support/Search/QueryParser/QueryParserInterface.php +++ b/app/Support/Search/QueryParser/QueryParserInterface.php @@ -25,11 +25,14 @@ declare(strict_types=1); namespace FireflyIII\Support\Search\QueryParser; +use LogicException; +use TypeError; + interface QueryParserInterface { /** - * @throws \LogicException - * @throws \TypeError + * @throws LogicException + * @throws TypeError */ public function parse(string $query): NodeGroup; } diff --git a/app/Support/Steam.php b/app/Support/Steam.php index b6da6a44dd..ff01d83474 100644 --- a/app/Support/Steam.php +++ b/app/Support/Steam.php @@ -34,6 +34,8 @@ use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use Illuminate\Support\Str; +use Exception; +use ValueError; /** * Class Steam. @@ -466,7 +468,7 @@ class Steam try { $hostName = gethostbyaddr($ipAddress); - } catch (\Exception $e) { + } catch (Exception $e) { app('log')->error($e->getMessage()); $hostName = $ipAddress; } @@ -673,7 +675,7 @@ class Steam if (-1 === bccomp($amount, '0')) { $amount = bcmul($amount, '-1'); } - } catch (\ValueError $e) { + } catch (ValueError $e) { Log::error(sprintf('ValueError in Steam::positive("%s"): %s', $amount, $e->getMessage())); Log::error($e->getTraceAsString()); diff --git a/app/Support/Twig/AmountFormat.php b/app/Support/Twig/AmountFormat.php index 4cf3ac7b07..70581d32a9 100644 --- a/app/Support/Twig/AmountFormat.php +++ b/app/Support/Twig/AmountFormat.php @@ -31,13 +31,14 @@ use Illuminate\Support\Facades\Log; use Twig\Extension\AbstractExtension; use Twig\TwigFilter; use Twig\TwigFunction; +use Override; /** * Contains all amount formatting routines. */ class AmountFormat extends AbstractExtension { - #[\Override] + #[Override] public function getFilters(): array { return [ @@ -72,7 +73,7 @@ class AmountFormat extends AbstractExtension ); } - #[\Override] + #[Override] public function getFunctions(): array { return [ diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php index 6e369e4086..4841e03245 100644 --- a/app/Support/Twig/General.php +++ b/app/Support/Twig/General.php @@ -37,13 +37,14 @@ use Illuminate\Support\Facades\Route; use Twig\Extension\AbstractExtension; use Twig\TwigFilter; use Twig\TwigFunction; +use Override; /** * Class TwigSupport. */ class General extends AbstractExtension { - #[\Override] + #[Override] public function getFilters(): array { return [ @@ -187,7 +188,7 @@ class General extends AbstractExtension ); } - #[\Override] + #[Override] public function getFunctions(): array { return [ diff --git a/app/Support/Twig/Rule.php b/app/Support/Twig/Rule.php index 45e763da1b..c833745d40 100644 --- a/app/Support/Twig/Rule.php +++ b/app/Support/Twig/Rule.php @@ -25,13 +25,15 @@ namespace FireflyIII\Support\Twig; use Twig\Extension\AbstractExtension; use Twig\TwigFunction; +use Config; +use Override; /** * Class Rule. */ class Rule extends AbstractExtension { - #[\Override] + #[Override] public function getFunctions(): array { return [ @@ -79,7 +81,7 @@ class Rule extends AbstractExtension 'allRuleActions', static function () { // array of valid values for actions - $ruleActions = array_keys(\Config::get('firefly.rule-actions')); + $ruleActions = array_keys(Config::get('firefly.rule-actions')); $possibleActions = []; foreach ($ruleActions as $key) { $possibleActions[$key] = (string) trans('firefly.rule_action_'.$key.'_choice'); diff --git a/app/Support/Twig/TransactionGroupTwig.php b/app/Support/Twig/TransactionGroupTwig.php index bc338d4b22..f495721334 100644 --- a/app/Support/Twig/TransactionGroupTwig.php +++ b/app/Support/Twig/TransactionGroupTwig.php @@ -33,13 +33,14 @@ use FireflyIII\Models\TransactionJournalMeta; use Illuminate\Support\Facades\DB; use Twig\Extension\AbstractExtension; use Twig\TwigFunction; +use Override; /** * Class TransactionGroupTwig */ class TransactionGroupTwig extends AbstractExtension { - #[\Override] + #[Override] public function getFunctions(): array { return [ diff --git a/app/Support/Twig/Translation.php b/app/Support/Twig/Translation.php index 7167ebb3a4..bb19890ff9 100644 --- a/app/Support/Twig/Translation.php +++ b/app/Support/Twig/Translation.php @@ -26,13 +26,14 @@ namespace FireflyIII\Support\Twig; use Twig\Extension\AbstractExtension; use Twig\TwigFilter; use Twig\TwigFunction; +use Override; /** * Class Budget. */ class Translation extends AbstractExtension { - #[\Override] + #[Override] public function getFilters(): array { return [ @@ -44,7 +45,7 @@ class Translation extends AbstractExtension ]; } - #[\Override] + #[Override] public function getFunctions(): array { return [ diff --git a/app/Transformers/V2/TransactionGroupTransformer.php b/app/Transformers/V2/TransactionGroupTransformer.php index e23bd8506b..f6ec77c816 100644 --- a/app/Transformers/V2/TransactionGroupTransformer.php +++ b/app/Transformers/V2/TransactionGroupTransformer.php @@ -40,6 +40,7 @@ use FireflyIII\Support\Http\Api\ExchangeRateConverter; use FireflyIII\Support\NullArrayObject; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; +use stdClass; /** * Class TransactionGroupTransformer @@ -169,7 +170,7 @@ class TransactionGroupTransformer extends AbstractTransformer ->get(['tag_transaction_journal.transaction_journal_id', 'tags.tag']) ; - /** @var \stdClass $tag */ + /** @var stdClass $tag */ foreach ($tags as $tag) { $id = (int) $tag->transaction_journal_id; $this->journals[$id]['tags'][] = $tag->tag; diff --git a/app/Transformers/WebhookMessageTransformer.php b/app/Transformers/WebhookMessageTransformer.php index 5271582bbb..8d758ca9a9 100644 --- a/app/Transformers/WebhookMessageTransformer.php +++ b/app/Transformers/WebhookMessageTransformer.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace FireflyIII\Transformers; use FireflyIII\Models\WebhookMessage; +use JsonException; /** * Class WebhookMessageTransformer @@ -40,7 +41,7 @@ class WebhookMessageTransformer extends AbstractTransformer try { $json = \Safe\json_encode($message->message, JSON_THROW_ON_ERROR); - } catch (\JsonException $e) { + } catch (JsonException $e) { app('log')->error(sprintf('Could not encode webhook message #%d: %s', $message->id, $e->getMessage())); } diff --git a/app/User.php b/app/User.php index f6bc724e5f..46a0041ec3 100644 --- a/app/User.php +++ b/app/User.php @@ -66,6 +66,7 @@ use Illuminate\Support\Str; use Laravel\Passport\HasApiTokens; use NotificationChannels\Pushover\PushoverReceiver; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Exception; class User extends Authenticatable { @@ -166,7 +167,7 @@ class User extends Authenticatable /** * Generates access token. * - * @throws \Exception + * @throws Exception */ public function generateAccessToken(): string { diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php index 0ea1c687fd..f3ca6a4dbc 100644 --- a/app/Validation/FireflyValidator.php +++ b/app/Validation/FireflyValidator.php @@ -45,6 +45,8 @@ use PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException; use PragmaRX\Google2FA\Exceptions\InvalidCharactersException; use PragmaRX\Google2FA\Exceptions\SecretKeyTooShortException; use PragmaRX\Google2FALaravel\Facade; +use Config; +use ValueError; /** * Class FireflyValidator. @@ -216,7 +218,7 @@ class FireflyValidator extends Validator try { $checksum = bcmod($iban, '97'); - } catch (\ValueError $e) { // @phpstan-ignore-line + } catch (ValueError $e) { // @phpstan-ignore-line $message = sprintf('Could not validate IBAN check value "%s" (IBAN "%s")', $iban, $value); Log::error($message); Log::error($e->getTraceAsString()); @@ -537,7 +539,7 @@ class FireflyValidator extends Validator private function validateByAccountTypeString(string $value, array $parameters, string $type): bool { /** @var null|array $search */ - $search = \Config::get('firefly.accountTypeByIdentifier.'.$type); + $search = Config::get('firefly.accountTypeByIdentifier.'.$type); if (null === $search) { return false; diff --git a/app/Validation/RecurrenceValidation.php b/app/Validation/RecurrenceValidation.php index 7c87c20b32..547049b37d 100644 --- a/app/Validation/RecurrenceValidation.php +++ b/app/Validation/RecurrenceValidation.php @@ -28,6 +28,7 @@ use Carbon\Carbon; use FireflyIII\Models\Recurrence; use FireflyIII\Models\RecurrenceTransaction; use Illuminate\Validation\Validator; +use InvalidArgumentException; /** * Trait RecurrenceValidation @@ -294,7 +295,7 @@ trait RecurrenceValidation { try { Carbon::createFromFormat('Y-m-d', $moment); - } catch (\InvalidArgumentException $e) { // @phpstan-ignore-line + } catch (InvalidArgumentException $e) { // @phpstan-ignore-line app('log')->debug(sprintf('Invalid argument for Carbon: %s', $e->getMessage())); $validator->errors()->add(sprintf('repetitions.%d.moment', $index), (string) trans('validation.valid_recurrence_rep_moment')); } diff --git a/database/seeders/AccountTypeSeeder.php b/database/seeders/AccountTypeSeeder.php index e52e06136c..0b9dda0723 100644 --- a/database/seeders/AccountTypeSeeder.php +++ b/database/seeders/AccountTypeSeeder.php @@ -26,6 +26,7 @@ namespace Database\Seeders; use FireflyIII\Enums\AccountTypeEnum; use FireflyIII\Models\AccountType; use Illuminate\Database\Seeder; +use PDOException; /** * Class AccountTypeSeeder. @@ -53,7 +54,7 @@ class AccountTypeSeeder extends Seeder if (null === AccountType::where('type', $type)->first()) { try { AccountType::create(['type' => $type]); - } catch (\PDOException $e) { + } catch (PDOException $e) { // @ignoreException } } diff --git a/database/seeders/LinkTypeSeeder.php b/database/seeders/LinkTypeSeeder.php index 48fc038cf6..7f2aa36bbd 100644 --- a/database/seeders/LinkTypeSeeder.php +++ b/database/seeders/LinkTypeSeeder.php @@ -25,6 +25,7 @@ namespace Database\Seeders; use FireflyIII\Models\LinkType; use Illuminate\Database\Seeder; +use PDOException; /** * Class LinkTypeSeeder. @@ -63,7 +64,7 @@ class LinkTypeSeeder extends Seeder if (null === LinkType::where('name', $type['name'])->first()) { try { LinkType::create($type); - } catch (\PDOException $e) { + } catch (PDOException $e) { // @ignoreException } } diff --git a/database/seeders/PermissionSeeder.php b/database/seeders/PermissionSeeder.php index 7e3234af11..5c66b3af29 100644 --- a/database/seeders/PermissionSeeder.php +++ b/database/seeders/PermissionSeeder.php @@ -25,6 +25,7 @@ namespace Database\Seeders; use FireflyIII\Models\Role; use Illuminate\Database\Seeder; +use PDOException; /** * Class PermissionSeeder. @@ -49,7 +50,7 @@ class PermissionSeeder extends Seeder if (null === Role::where('name', $role['name'])->first()) { try { Role::create($role); - } catch (\PDOException $e) { + } catch (PDOException $e) { // @ignoreException } } diff --git a/database/seeders/TransactionCurrencySeeder.php b/database/seeders/TransactionCurrencySeeder.php index d21be80335..ea8adf0e78 100644 --- a/database/seeders/TransactionCurrencySeeder.php +++ b/database/seeders/TransactionCurrencySeeder.php @@ -25,6 +25,7 @@ namespace Database\Seeders; use FireflyIII\Models\TransactionCurrency; use Illuminate\Database\Seeder; +use PDOException; /** * Class TransactionCurrencySeeder. @@ -82,7 +83,7 @@ class TransactionCurrencySeeder extends Seeder if (null === TransactionCurrency::where('code', $currency['code'])->first()) { try { TransactionCurrency::create($currency); - } catch (\PDOException $e) { + } catch (PDOException $e) { // @ignoreException } } diff --git a/database/seeders/TransactionTypeSeeder.php b/database/seeders/TransactionTypeSeeder.php index 401f993c2e..2a7d813164 100644 --- a/database/seeders/TransactionTypeSeeder.php +++ b/database/seeders/TransactionTypeSeeder.php @@ -26,6 +26,7 @@ namespace Database\Seeders; use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Models\TransactionType; use Illuminate\Database\Seeder; +use PDOException; /** * Class TransactionTypeSeeder. @@ -48,7 +49,7 @@ class TransactionTypeSeeder extends Seeder if (null === TransactionType::where('type', $type)->first()) { try { TransactionType::create(['type' => $type]); - } catch (\PDOException $e) { + } catch (PDOException $e) { // @ignoreException } } diff --git a/database/seeders/UserRoleSeeder.php b/database/seeders/UserRoleSeeder.php index bc117c9e19..c779b91812 100644 --- a/database/seeders/UserRoleSeeder.php +++ b/database/seeders/UserRoleSeeder.php @@ -27,6 +27,7 @@ namespace Database\Seeders; use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Models\UserRole; use Illuminate\Database\Seeder; +use PDOException; /** * Class UserRoleSeeder @@ -48,7 +49,7 @@ class UserRoleSeeder extends Seeder if (null === UserRole::where('title', $role)->first()) { try { UserRole::create(['title' => $role]); - } catch (\PDOException $e) { + } catch (PDOException $e) { // @ignoreException } } diff --git a/resources/views/list/groups.twig b/resources/views/list/groups.twig index 832b55c6a9..0ef4a4899b 100644 --- a/resources/views/list/groups.twig +++ b/resources/views/list/groups.twig @@ -263,7 +263,7 @@ {% if currency.id == transaction.currency_id %} {{ formatAmountBySymbol(transaction.destination_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }} {% endif %} - {% if currency.id == transaction.foreign_currency_id %} + {% if currency.id == transaction.foreign_currency_id and null != transaction.destination_balance_after %} {{ formatAmountBySymbol(transaction.destination_balance_after, transaction.foreign_currency_symbol, transaction.foreign_currency_decimal_places) }} {% endif %} diff --git a/tests/integration/Api/About/AboutControllerTest.php b/tests/integration/Api/About/AboutControllerTest.php index 77f0402c87..f12179e6a1 100644 --- a/tests/integration/Api/About/AboutControllerTest.php +++ b/tests/integration/Api/About/AboutControllerTest.php @@ -27,6 +27,7 @@ namespace Tests\integration\Api\About; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Testing\Fluent\AssertableJson; use Tests\integration\TestCase; +use Override; /** * Class AboutControllerTest @@ -40,7 +41,7 @@ final class AboutControllerTest extends TestCase use RefreshDatabase; private $user; - #[\Override] + #[Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/integration/Api/Autocomplete/BillControllerTest.php b/tests/integration/Api/Autocomplete/BillControllerTest.php index 41ca56d6ef..f94daa714a 100644 --- a/tests/integration/Api/Autocomplete/BillControllerTest.php +++ b/tests/integration/Api/Autocomplete/BillControllerTest.php @@ -29,6 +29,7 @@ use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\integration\TestCase; use FireflyIII\User; use FireflyIII\Models\UserGroup; +use Override; /** * Class BillControllerTest @@ -44,7 +45,7 @@ final class BillControllerTest extends TestCase */ use RefreshDatabase; - #[\Override] + #[Override] protected function createAuthenticatedUser(): User { $userGroup = UserGroup::create(['title' => 'Test Group']); diff --git a/tests/integration/Api/Autocomplete/BudgetControllerTest.php b/tests/integration/Api/Autocomplete/BudgetControllerTest.php index fe247ddd5b..8e27714807 100644 --- a/tests/integration/Api/Autocomplete/BudgetControllerTest.php +++ b/tests/integration/Api/Autocomplete/BudgetControllerTest.php @@ -29,6 +29,7 @@ use FireflyIII\Models\UserGroup; use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\integration\TestCase; use FireflyIII\User; +use Override; /** * Class BudgetControllerTest @@ -44,7 +45,7 @@ final class BudgetControllerTest extends TestCase */ use RefreshDatabase; - #[\Override] + #[Override] protected function createAuthenticatedUser(): User { $userGroup = UserGroup::create(['title' => 'Test Group']); diff --git a/tests/integration/Api/Autocomplete/CategoryControllerTest.php b/tests/integration/Api/Autocomplete/CategoryControllerTest.php index 66eccc7bf7..492b103669 100644 --- a/tests/integration/Api/Autocomplete/CategoryControllerTest.php +++ b/tests/integration/Api/Autocomplete/CategoryControllerTest.php @@ -29,6 +29,7 @@ use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\integration\TestCase; use FireflyIII\User; use FireflyIII\Models\UserGroup; +use Override; /** * Class CategoryControllerTest @@ -44,7 +45,7 @@ final class CategoryControllerTest extends TestCase */ use RefreshDatabase; - #[\Override] + #[Override] protected function createAuthenticatedUser(): User { $userGroup = UserGroup::create(['title' => 'Test Group']); diff --git a/tests/integration/Api/Autocomplete/CurrencyControllerTest.php b/tests/integration/Api/Autocomplete/CurrencyControllerTest.php index 1122503bb9..80f92f7079 100644 --- a/tests/integration/Api/Autocomplete/CurrencyControllerTest.php +++ b/tests/integration/Api/Autocomplete/CurrencyControllerTest.php @@ -29,6 +29,7 @@ use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\integration\TestCase; use FireflyIII\User; use FireflyIII\Models\UserGroup; +use Override; /** * Class CurrencyControllerTest @@ -44,7 +45,7 @@ final class CurrencyControllerTest extends TestCase */ use RefreshDatabase; - #[\Override] + #[Override] protected function createAuthenticatedUser(): User { $userGroup = UserGroup::create(['title' => 'Test Group']); diff --git a/tests/integration/Api/Autocomplete/ObjectGroupControllerTest.php b/tests/integration/Api/Autocomplete/ObjectGroupControllerTest.php index 74ad04420f..051492f6bc 100644 --- a/tests/integration/Api/Autocomplete/ObjectGroupControllerTest.php +++ b/tests/integration/Api/Autocomplete/ObjectGroupControllerTest.php @@ -29,6 +29,7 @@ use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\integration\TestCase; use FireflyIII\User; use FireflyIII\Models\UserGroup; +use Override; /** * Class ObjectGroupControllerTest @@ -44,7 +45,7 @@ final class ObjectGroupControllerTest extends TestCase */ use RefreshDatabase; - #[\Override] + #[Override] protected function createAuthenticatedUser(): User { $userGroup = UserGroup::create(['title' => 'Test Group']); diff --git a/tests/unit/Support/Calendar/CalculatorProvider.php b/tests/unit/Support/Calendar/CalculatorProvider.php index 839f422957..4133f435ed 100644 --- a/tests/unit/Support/Calendar/CalculatorProvider.php +++ b/tests/unit/Support/Calendar/CalculatorProvider.php @@ -27,6 +27,7 @@ namespace Tests\unit\Support\Calendar; use Carbon\Carbon; use FireflyIII\Support\Calendar\Periodicity; use Tests\unit\Support\Calendar\Periodicity\IntervalProvider; +use Generator; readonly class CalculatorProvider { @@ -37,7 +38,7 @@ readonly class CalculatorProvider $this->label = "{$this->periodicity->name} {$this->intervalProvider->label}"; } - public static function providePeriodicityWithSkippedIntervals(): \Generator + public static function providePeriodicityWithSkippedIntervals(): Generator { $intervals = [ self::from(Periodicity::Daily, new IntervalProvider(Carbon::now(), Carbon::now()->addDays(2)), 1),