Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
remove old inspections
James Cole914dc8596b45
diff --git a/.ci/phpstan.neon b/.ci/phpstan.neonindex 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/Reportpaths:- ../app- ../database- ../routes+ - ../tests- ../bootstrap/app.php# The level 8 is the highest level. original was 5diff --git a/app/Console/Commands/Upgrade/BackToJournals.php b/app/Console/Commands/Upgrade/BackToJournals.phpindex 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.phpindex 2fa68c8a78..e7e8a09bde 100644--- a/app/Exceptions/Handler.php+++ b/app/Exceptions/Handler.php@@ -20,8 +20,6 @@* along with this program. If not, see <https://www.gnu.org/licenses/>.*/-/** @noinspection MultipleReturnStatementsInspection */-declare(strict_types=1);namespace FireflyIII\Exceptions;diff --git a/app/Factory/BudgetFactory.php b/app/Factory/BudgetFactory.phpindex 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 <https://www.gnu.org/licenses/>.*/-/** @noinspection MultipleReturnStatementsInspection */declare(strict_types=1);namespace FireflyIII\Factory;diff --git a/app/Factory/CategoryFactory.php b/app/Factory/CategoryFactory.phpindex 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 <https://www.gnu.org/licenses/>.*/-/** @noinspection MultipleReturnStatementsInspection */declare(strict_types=1);namespace FireflyIII\Factory;diff --git a/app/Factory/PiggyBankEventFactory.php b/app/Factory/PiggyBankEventFactory.phpindex 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 <https://www.gnu.org/licenses/>.*/-/** @noinspection MultipleReturnStatementsInspection */declare(strict_types=1);namespace FireflyIII\Factory;diff --git a/app/Factory/PiggyBankFactory.php b/app/Factory/PiggyBankFactory.phpindex 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 <https://www.gnu.org/licenses/>.*/-/** @noinspection MultipleReturnStatementsInspection */declare(strict_types=1);namespace FireflyIII\Factory;diff --git a/app/Factory/RecurrenceFactory.php b/app/Factory/RecurrenceFactory.phpindex 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 <https://www.gnu.org/licenses/>.*/-/** @noinspection MultipleReturnStatementsInspection */declare(strict_types=1);diff --git a/app/Factory/TagFactory.php b/app/Factory/TagFactory.phpindex 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 <https://www.gnu.org/licenses/>.*/-/** @noinspection MultipleReturnStatementsInspection */declare(strict_types=1);diff --git a/app/Factory/TransactionCurrencyFactory.php b/app/Factory/TransactionCurrencyFactory.phpindex d29e963fb4..30c87b92fd 100644--- a/app/Factory/TransactionCurrencyFactory.php+++ b/app/Factory/TransactionCurrencyFactory.php@@ -19,8 +19,6 @@* along with this program. If not, see <https://www.gnu.org/licenses/>.*/-/** @noinspection MultipleReturnStatementsInspection */-declare(strict_types=1);namespace FireflyIII\Factory;diff --git a/app/Factory/TransactionJournalMetaFactory.php b/app/Factory/TransactionJournalMetaFactory.phpindex 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 <https://www.gnu.org/licenses/>.*/-/** @noinspection MultipleReturnStatementsInspection */declare(strict_types=1);diff --git a/app/Generator/Report/Budget/MonthReportGenerator.php b/app/Generator/Report/Budget/MonthReportGenerator.phpindex 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 <https://www.gnu.org/licenses/>.*/-/** @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.phpindex 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 <https://www.gnu.org/licenses/>.*/-/** @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.phpindex 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 <https://www.gnu.org/licenses/>.*/-/** @noinspection MultipleReturnStatementsInspection */declare(strict_types=1);namespace FireflyIII\Generator\Report\Tag;diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.phpindex 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 <https://www.gnu.org/licenses/>.*/-/** @noinspection NullPointerExceptionInspection */declare(strict_types=1);namespace FireflyIII\Handlers\Events;diff --git a/app/Handlers/Events/VersionCheckEventHandler.php b/app/Handlers/Events/VersionCheckEventHandler.phpindex 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 <https://www.gnu.org/licenses/>.*/-/** @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.phpindex 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 <https://www.gnu.org/licenses/>.*/-/** @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.phpindex 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 <https://www.gnu.org/licenses/>.*/-/** @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.phpindex 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.phpindex 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 <https://www.gnu.org/licenses/>.*/-/** @noinspection MoreThanThreeArgumentsInspection */declare(strict_types=1);namespace FireflyIII\Http\Controllers\Chart;diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.phpindex 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.phpindex 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 Controllerforeach ($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.phpindex 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 <https://www.gnu.org/licenses/>.*/-/** @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.phpindex 33dea5ca5d..652667857c 100644--- a/app/Http/Controllers/System/InstallController.php+++ b/app/Http/Controllers/System/InstallController.php@@ -52,8 +52,6 @@ class InstallController extends Controllerpublic 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.phpindex 341c605609..67e3539bba 100644--- a/app/Http/Middleware/Authenticate.php+++ b/app/Http/Middleware/Authenticate.php@@ -91,11 +91,9 @@ class Authenticateif (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.phpindex c7180525fe..57ad34144c 100644--- a/app/Repositories/Budget/NoBudgetRepository.php+++ b/app/Repositories/Budget/NoBudgetRepository.php@@ -145,7 +145,6 @@ class NoBudgetRepository implements NoBudgetRepositoryInterfacereturn $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.phpindex 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 $enddiff --git a/app/Repositories/Budget/OperationsRepository.php b/app/Repositories/Budget/OperationsRepository.phpindex fc91bee765..fe2b50955f 100644--- a/app/Repositories/Budget/OperationsRepository.php+++ b/app/Repositories/Budget/OperationsRepository.php@@ -211,7 +211,6 @@ class OperationsRepository implements OperationsRepositoryInterfacereturn $repos->getActiveBudgets();}- /** @noinspection MoreThanThreeArgumentsInspection *//*** @param User $userdiff --git a/app/Repositories/Budget/OperationsRepositoryInterface.php b/app/Repositories/Budget/OperationsRepositoryInterface.phpindex 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.phpindex 28aa64bff2..9bf777b7f9 100644--- a/app/Repositories/Journal/JournalCLIRepository.php+++ b/app/Repositories/Journal/JournalCLIRepository.php@@ -70,7 +70,6 @@ class JournalCLIRepository implements JournalCLIRepositoryInterfaceif (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 JournalCLIRepositoryInterfaceif (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.phpindex 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.phpindex 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.phpindex 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.phpindex 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';