From 914dc8596b45bf938b04a48ac62ffc25e6c7a1ff Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 30 Oct 2022 12:12:35 +0100 Subject: [PATCH] remove old inspections --- .ci/phpstan.neon | 18 +----------------- .../Commands/Upgrade/BackToJournals.php | 1 - app/Exceptions/Handler.php | 2 -- app/Factory/BudgetFactory.php | 1 - app/Factory/CategoryFactory.php | 1 - app/Factory/PiggyBankEventFactory.php | 1 - app/Factory/PiggyBankFactory.php | 1 - app/Factory/RecurrenceFactory.php | 1 - app/Factory/TagFactory.php | 1 - app/Factory/TransactionCurrencyFactory.php | 2 -- app/Factory/TransactionJournalMetaFactory.php | 1 - .../Report/Budget/MonthReportGenerator.php | 1 - .../Report/Category/MonthReportGenerator.php | 1 - .../Report/Tag/MonthReportGenerator.php | 1 - app/Handlers/Events/UserEventHandler.php | 1 - .../Events/VersionCheckEventHandler.php | 2 -- .../Controllers/Account/IndexController.php | 1 - .../Account/ReconcileController.php | 1 - .../Auth/ResetPasswordController.php | 1 - .../Chart/BudgetReportController.php | 1 - app/Http/Controllers/HomeController.php | 1 - app/Http/Controllers/JavascriptController.php | 3 --- app/Http/Controllers/ReportController.php | 1 - .../Controllers/System/InstallController.php | 2 -- app/Http/Middleware/Authenticate.php | 5 ----- app/Repositories/Budget/NoBudgetRepository.php | 1 - .../Budget/NoBudgetRepositoryInterface.php | 1 - .../Budget/OperationsRepository.php | 1 - .../Budget/OperationsRepositoryInterface.php | 1 - .../Journal/JournalCLIRepository.php | 2 -- app/Support/Amount.php | 1 - .../Http/Controllers/ModelInformation.php | 1 - app/Support/Twig/TransactionGroupTwig.php | 1 - public/index.php | 1 - 34 files changed, 1 insertion(+), 61 deletions(-) diff --git a/.ci/phpstan.neon b/.ci/phpstan.neon index 12c4a66b9d..58d2a4cd6b 100644 --- a/.ci/phpstan.neon +++ b/.ci/phpstan.neon @@ -6,27 +6,11 @@ includes: parameters: ignoreErrors: - - '#is not allowed to extend#' - - '#is neither abstract nor final#' - - '#Control structures using switch should not be used\.#' - - '#has a nullable return type declaration#' - - '#with a nullable type declaration#' - - '#with null as default value#' - - '#Constructor in [a-zA-Z0-9\\_]+ has parameter \$[a-zA-Z0-9\\_]+ with default value#' - - - message: '#Function compact\(\) should not be used.#' - paths: - - ../app/Http/Controllers - - ../app/Support/Http/Controllers/RenderPartialViews.php - - ../app/Support/Form/FormSupport.php - - ../app/Support/Form/CurrencyForm.php - - ../app/Support/Form/AccountForm.php - - ../app/Support/ExpandedForm.php - - ../app/Generator/Report paths: - ../app - ../database - ../routes + - ../tests - ../bootstrap/app.php # The level 8 is the highest level. original was 5 diff --git a/app/Console/Commands/Upgrade/BackToJournals.php b/app/Console/Commands/Upgrade/BackToJournals.php index f3b3c61b11..bd55811b05 100644 --- a/app/Console/Commands/Upgrade/BackToJournals.php +++ b/app/Console/Commands/Upgrade/BackToJournals.php @@ -232,7 +232,6 @@ class BackToJournals extends Command $set = DB::table('transactions') // @phpstan-ignore-line ->whereIn('transactions.id', $chunk) ->get(['transaction_journal_id'])->pluck('transaction_journal_id')->toArray(); - /** @noinspection SlowArrayOperationsInLoopInspection */ $array = array_merge($array, $set); } diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 2fa68c8a78..e7e8a09bde 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -20,8 +20,6 @@ * along with this program. If not, see . */ -/** @noinspection MultipleReturnStatementsInspection */ - declare(strict_types=1); namespace FireflyIII\Exceptions; diff --git a/app/Factory/BudgetFactory.php b/app/Factory/BudgetFactory.php index 69a25e6b92..c052619988 100644 --- a/app/Factory/BudgetFactory.php +++ b/app/Factory/BudgetFactory.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -/** @noinspection MultipleReturnStatementsInspection */ declare(strict_types=1); namespace FireflyIII\Factory; diff --git a/app/Factory/CategoryFactory.php b/app/Factory/CategoryFactory.php index 8979d5068b..5b5b41c97c 100644 --- a/app/Factory/CategoryFactory.php +++ b/app/Factory/CategoryFactory.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -/** @noinspection MultipleReturnStatementsInspection */ declare(strict_types=1); namespace FireflyIII\Factory; diff --git a/app/Factory/PiggyBankEventFactory.php b/app/Factory/PiggyBankEventFactory.php index 727be78405..58495df09e 100644 --- a/app/Factory/PiggyBankEventFactory.php +++ b/app/Factory/PiggyBankEventFactory.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -/** @noinspection MultipleReturnStatementsInspection */ declare(strict_types=1); namespace FireflyIII\Factory; diff --git a/app/Factory/PiggyBankFactory.php b/app/Factory/PiggyBankFactory.php index 6709c3fa64..2b7301dbe5 100644 --- a/app/Factory/PiggyBankFactory.php +++ b/app/Factory/PiggyBankFactory.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -/** @noinspection MultipleReturnStatementsInspection */ declare(strict_types=1); namespace FireflyIII\Factory; diff --git a/app/Factory/RecurrenceFactory.php b/app/Factory/RecurrenceFactory.php index 3c02765372..8849ee7ec4 100644 --- a/app/Factory/RecurrenceFactory.php +++ b/app/Factory/RecurrenceFactory.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -/** @noinspection MultipleReturnStatementsInspection */ declare(strict_types=1); diff --git a/app/Factory/TagFactory.php b/app/Factory/TagFactory.php index 66fa91707d..de028db2f6 100644 --- a/app/Factory/TagFactory.php +++ b/app/Factory/TagFactory.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -/** @noinspection MultipleReturnStatementsInspection */ declare(strict_types=1); diff --git a/app/Factory/TransactionCurrencyFactory.php b/app/Factory/TransactionCurrencyFactory.php index d29e963fb4..30c87b92fd 100644 --- a/app/Factory/TransactionCurrencyFactory.php +++ b/app/Factory/TransactionCurrencyFactory.php @@ -19,8 +19,6 @@ * along with this program. If not, see . */ -/** @noinspection MultipleReturnStatementsInspection */ - declare(strict_types=1); namespace FireflyIII\Factory; diff --git a/app/Factory/TransactionJournalMetaFactory.php b/app/Factory/TransactionJournalMetaFactory.php index 99dc2c746c..6bc1f23878 100644 --- a/app/Factory/TransactionJournalMetaFactory.php +++ b/app/Factory/TransactionJournalMetaFactory.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -/** @noinspection MultipleReturnStatementsInspection */ declare(strict_types=1); diff --git a/app/Generator/Report/Budget/MonthReportGenerator.php b/app/Generator/Report/Budget/MonthReportGenerator.php index 7d16209785..07d8f96dbf 100644 --- a/app/Generator/Report/Budget/MonthReportGenerator.php +++ b/app/Generator/Report/Budget/MonthReportGenerator.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -/** @noinspection MultipleReturnStatementsInspection */ declare(strict_types=1); namespace FireflyIII\Generator\Report\Budget; diff --git a/app/Generator/Report/Category/MonthReportGenerator.php b/app/Generator/Report/Category/MonthReportGenerator.php index 89f7ee92a7..81e8273cbf 100644 --- a/app/Generator/Report/Category/MonthReportGenerator.php +++ b/app/Generator/Report/Category/MonthReportGenerator.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -/** @noinspection MultipleReturnStatementsInspection */ declare(strict_types=1); namespace FireflyIII\Generator\Report\Category; diff --git a/app/Generator/Report/Tag/MonthReportGenerator.php b/app/Generator/Report/Tag/MonthReportGenerator.php index 87feaf83a9..57f5b83675 100644 --- a/app/Generator/Report/Tag/MonthReportGenerator.php +++ b/app/Generator/Report/Tag/MonthReportGenerator.php @@ -19,7 +19,6 @@ * along with this program. If not, see . */ -/** @noinspection MultipleReturnStatementsInspection */ declare(strict_types=1); namespace FireflyIII\Generator\Report\Tag; diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.php index bad99b16fd..cc96479cdf 100644 --- a/app/Handlers/Events/UserEventHandler.php +++ b/app/Handlers/Events/UserEventHandler.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -/** @noinspection NullPointerExceptionInspection */ declare(strict_types=1); namespace FireflyIII\Handlers\Events; diff --git a/app/Handlers/Events/VersionCheckEventHandler.php b/app/Handlers/Events/VersionCheckEventHandler.php index c247f007f8..2feb2ac916 100644 --- a/app/Handlers/Events/VersionCheckEventHandler.php +++ b/app/Handlers/Events/VersionCheckEventHandler.php @@ -18,8 +18,6 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -/** @noinspection MultipleReturnStatementsInspection */ -/** @noinspection NullPointerExceptionInspection */ declare(strict_types=1); namespace FireflyIII\Handlers\Events; diff --git a/app/Http/Controllers/Account/IndexController.php b/app/Http/Controllers/Account/IndexController.php index b482200a51..f0a5779e2c 100644 --- a/app/Http/Controllers/Account/IndexController.php +++ b/app/Http/Controllers/Account/IndexController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -/** @noinspection CallableParameterUseCaseInTypeContextInspection */ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Account; diff --git a/app/Http/Controllers/Account/ReconcileController.php b/app/Http/Controllers/Account/ReconcileController.php index 63d804caf1..7c4b7d18b9 100644 --- a/app/Http/Controllers/Account/ReconcileController.php +++ b/app/Http/Controllers/Account/ReconcileController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -/** @noinspection CallableParameterUseCaseInTypeContextInspection */ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Account; diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php index 7b28f677c2..062b7e973a 100644 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Auth/ResetPasswordController.php @@ -144,7 +144,6 @@ class ResetPasswordController extends Controller $allowRegistration = false; } - /** @noinspection PhpUndefinedFieldInspection */ return view('auth.passwords.reset')->with( ['token' => $token, 'email' => $request->email, 'allowRegistration' => $allowRegistration, 'pageTitle' => $pageTitle] ); diff --git a/app/Http/Controllers/Chart/BudgetReportController.php b/app/Http/Controllers/Chart/BudgetReportController.php index da0bf7db31..a343594303 100644 --- a/app/Http/Controllers/Chart/BudgetReportController.php +++ b/app/Http/Controllers/Chart/BudgetReportController.php @@ -19,7 +19,6 @@ * along with this program. If not, see . */ -/** @noinspection MoreThanThreeArgumentsInspection */ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Chart; diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 07e635b5d8..f8cdbf68d2 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -120,7 +120,6 @@ class HomeController extends Controller $start = session('start', Carbon::now()->startOfMonth()); /** @var Carbon $end */ $end = session('end', Carbon::now()->endOfMonth()); - /** @noinspection NullPointerExceptionInspection */ $accounts = $repository->getAccountsById($frontPage->data); $today = today(config('app.timezone')); diff --git a/app/Http/Controllers/JavascriptController.php b/app/Http/Controllers/JavascriptController.php index 72d37453bd..48d6e0f007 100644 --- a/app/Http/Controllers/JavascriptController.php +++ b/app/Http/Controllers/JavascriptController.php @@ -57,7 +57,6 @@ class JavascriptController extends Controller [AccountType::DEFAULT, AccountType::ASSET, AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::CREDITCARD] ); $preference = app('preferences')->get('currencyPreference', config('firefly.default_currency', 'EUR')); - /** @noinspection NullPointerExceptionInspection */ $default = $currencyRepository->findByCodeNull((string) $preference->data); $data = ['accounts' => []]; @@ -66,7 +65,6 @@ class JavascriptController extends Controller foreach ($accounts as $account) { $accountId = $account->id; $currency = (int) $repository->getMetaValue($account, 'currency_id'); - /** @noinspection NullPointerExceptionInspection */ $currency = 0 === $currency ? $default->id : $currency; $entry = ['preferredCurrency' => $currency, 'name' => $account->name]; $data['accounts'][$accountId] = $entry; @@ -124,7 +122,6 @@ class JavascriptController extends Controller $accounting = app('amount')->getJsConfig(); $accounting['frac_digits'] = $currency->decimal_places; $pref = app('preferences')->get('language', config('firefly.default_language', 'en_US')); - /** @noinspection NullPointerExceptionInspection */ $lang = $pref->data; $dateRange = $this->getDateRangeConfig(); $uid = substr(hash('sha256', sprintf('%s-%s-%s', (string) config('app.key'), auth()->user()->id, auth()->user()->email)), 0, 12); diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index f964375e52..8251d633f4 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -/** @noinspection CallableParameterUseCaseInTypeContextInspection */ declare(strict_types=1); namespace FireflyIII\Http\Controllers; diff --git a/app/Http/Controllers/System/InstallController.php b/app/Http/Controllers/System/InstallController.php index 33dea5ca5d..652667857c 100644 --- a/app/Http/Controllers/System/InstallController.php +++ b/app/Http/Controllers/System/InstallController.php @@ -52,8 +52,6 @@ class InstallController extends Controller public const OTHER_ERROR = 'An unknown error prevented Firefly III from executing the upgrade commands. Sorry.'; private string $lastError; private array $upgradeCommands; - /** @noinspection MagicMethodsValidityInspection */ - /** @noinspection PhpMissingParentConstructorInspection */ /** * InstallController constructor. diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index 341c605609..67e3539bba 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -91,11 +91,9 @@ class Authenticate if (empty($guards)) { try { // go for default guard: - /** @noinspection PhpUndefinedMethodInspection */ if ($this->auth->check()) { // do an extra check on user object. - /** @noinspection PhpUndefinedMethodInspection */ /** @var User $user */ $user = $this->auth->authenticate(); if (1 === (int) $user->blocked) { @@ -104,7 +102,6 @@ class Authenticate $message = (string) trans('firefly.email_changed_logout'); } app('session')->flash('logoutMessage', $message); - /** @noinspection PhpUndefinedMethodInspection */ $this->auth->logout(); throw new AuthenticationException('Blocked account.', $guards); @@ -121,14 +118,12 @@ class Authenticate } - /** @noinspection PhpUndefinedMethodInspection */ return $this->auth->authenticate(); } foreach ($guards as $guard) { if ($this->auth->guard($guard)->check()) { - /** @noinspection PhpVoidFunctionResultUsedInspection */ return $this->auth->shouldUse($guard); // @phpstan-ignore-line } } diff --git a/app/Repositories/Budget/NoBudgetRepository.php b/app/Repositories/Budget/NoBudgetRepository.php index c7180525fe..57ad34144c 100644 --- a/app/Repositories/Budget/NoBudgetRepository.php +++ b/app/Repositories/Budget/NoBudgetRepository.php @@ -145,7 +145,6 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface return $return; } - /** @noinspection MoreThanThreeArgumentsInspection */ /** * TODO this method does not include multi currency. It just counts. * TODO this probably also applies to the other "sumExpenses" methods. diff --git a/app/Repositories/Budget/NoBudgetRepositoryInterface.php b/app/Repositories/Budget/NoBudgetRepositoryInterface.php index 0f6da40270..a75dd56378 100644 --- a/app/Repositories/Budget/NoBudgetRepositoryInterface.php +++ b/app/Repositories/Budget/NoBudgetRepositoryInterface.php @@ -58,7 +58,6 @@ interface NoBudgetRepositoryInterface */ public function spentInPeriodWoBudgetMc(Collection $accounts, Carbon $start, Carbon $end): array; - /** @noinspection MoreThanThreeArgumentsInspection */ /** * @param Carbon $start * @param Carbon $end diff --git a/app/Repositories/Budget/OperationsRepository.php b/app/Repositories/Budget/OperationsRepository.php index fc91bee765..fe2b50955f 100644 --- a/app/Repositories/Budget/OperationsRepository.php +++ b/app/Repositories/Budget/OperationsRepository.php @@ -211,7 +211,6 @@ class OperationsRepository implements OperationsRepositoryInterface return $repos->getActiveBudgets(); } - /** @noinspection MoreThanThreeArgumentsInspection */ /** * @param User $user diff --git a/app/Repositories/Budget/OperationsRepositoryInterface.php b/app/Repositories/Budget/OperationsRepositoryInterface.php index 016e287445..140d01ada3 100644 --- a/app/Repositories/Budget/OperationsRepositoryInterface.php +++ b/app/Repositories/Budget/OperationsRepositoryInterface.php @@ -74,7 +74,6 @@ interface OperationsRepositoryInterface */ public function setUser(User $user): void; - /** @noinspection MoreThanThreeArgumentsInspection */ /** * Return multi-currency spent information. diff --git a/app/Repositories/Journal/JournalCLIRepository.php b/app/Repositories/Journal/JournalCLIRepository.php index 28aa64bff2..9bf777b7f9 100644 --- a/app/Repositories/Journal/JournalCLIRepository.php +++ b/app/Repositories/Journal/JournalCLIRepository.php @@ -70,7 +70,6 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface if (null !== $budget) { return $budget->id; } - /** @noinspection NullPointerExceptionInspection */ $budget = $journal->transactions()->first()->budgets()->first(); if (null !== $budget) { return $budget->id; @@ -92,7 +91,6 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface if (null !== $category) { return $category->id; } - /** @noinspection NullPointerExceptionInspection */ $category = $journal->transactions()->first()->categories()->first(); if (null !== $category) { return $category->id; diff --git a/app/Support/Amount.php b/app/Support/Amount.php index b6a7bb9485..a6e16091ed 100644 --- a/app/Support/Amount.php +++ b/app/Support/Amount.php @@ -66,7 +66,6 @@ class Amount * @return string * * @throws FireflyException - * @noinspection MoreThanThreeArgumentsInspection */ public function formatFlat(string $symbol, int $decimalPlaces, string $amount, bool $coloured = null): string { diff --git a/app/Support/Http/Controllers/ModelInformation.php b/app/Support/Http/Controllers/ModelInformation.php index 9209c57667..b8073fa88b 100644 --- a/app/Support/Http/Controllers/ModelInformation.php +++ b/app/Support/Http/Controllers/ModelInformation.php @@ -81,7 +81,6 @@ trait ModelInformation $debt = $repository->getAccountTypeByType(AccountType::DEBT); $loan = $repository->getAccountTypeByType(AccountType::LOAN); $mortgage = $repository->getAccountTypeByType(AccountType::MORTGAGE); - /** @noinspection NullPointerExceptionInspection */ $liabilityTypes = [ $debt->id => (string) trans(sprintf('firefly.account_type_%s', AccountType::DEBT)), $loan->id => (string) trans(sprintf('firefly.account_type_%s', AccountType::LOAN)), diff --git a/app/Support/Twig/TransactionGroupTwig.php b/app/Support/Twig/TransactionGroupTwig.php index 2c0a38fbb4..935a75107b 100644 --- a/app/Support/Twig/TransactionGroupTwig.php +++ b/app/Support/Twig/TransactionGroupTwig.php @@ -37,7 +37,6 @@ use Twig\TwigFunction; */ class TransactionGroupTwig extends AbstractExtension { - /** @noinspection PhpMissingParentCallCommonInspection */ /** * @return array * diff --git a/public/index.php b/public/index.php index b664bbeb79..22c05fd592 100644 --- a/public/index.php +++ b/public/index.php @@ -54,7 +54,6 @@ require __DIR__ . '/../vendor/autoload.php'; | */ -/** @noinspection UsingInclusionOnceReturnValueInspection */ $app = require_once __DIR__ . '/../bootstrap/app.php';