mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-20 00:20:03 +00:00
Various bug fixes and code cleanup.
This commit is contained in:
@@ -93,7 +93,7 @@ class ReconcileController extends Controller
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function reconcile(Account $account, Carbon $start = null, Carbon $end = null) // @phpstan-ignore-line
|
||||
public function reconcile(Account $account, Carbon $start = null, Carbon $end = null)
|
||||
{
|
||||
if (!$this->isEditableAccount($account)) {
|
||||
return $this->redirectAccountToAccount($account);
|
||||
|
||||
@@ -91,7 +91,7 @@ class ShowController extends Controller
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function show(Request $request, Account $account, Carbon $start = null, Carbon $end = null) // @phpstan-ignore-line
|
||||
public function show(Request $request, Account $account, Carbon $start = null, Carbon $end = null)
|
||||
{
|
||||
$objectType = config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type));
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ class ResetPasswordController extends Controller
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function showResetForm(Request $request, $token = null) // @phpstan-ignore-line
|
||||
public function showResetForm(Request $request, $token = null)
|
||||
{
|
||||
$loginProvider = config('firefly.login_provider');
|
||||
if ('eloquent' !== $loginProvider) {
|
||||
|
||||
@@ -99,7 +99,7 @@ class IndexController extends Controller
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function index(Request $request, Carbon $start = null, Carbon $end = null) // @phpstan-ignore-line
|
||||
public function index(Request $request, Carbon $start = null, Carbon $end = null)
|
||||
{
|
||||
Log::debug('Start of IndexController::index()');
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ class ShowController extends Controller
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function noBudget(Request $request, Carbon $start = null, Carbon $end = null)// @phpstan-ignore-line
|
||||
public function noBudget(Request $request, Carbon $start = null, Carbon $end = null)
|
||||
{
|
||||
/** @var Carbon $start */
|
||||
$start = $start ?? session('start');
|
||||
|
||||
@@ -83,7 +83,7 @@ class NoCategoryController extends Controller
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function show(Request $request, Carbon $start = null, Carbon $end = null)// @phpstan-ignore-line
|
||||
public function show(Request $request, Carbon $start = null, Carbon $end = null)
|
||||
{
|
||||
Log::debug('Start of noCategory()');
|
||||
/** @var Carbon $start */
|
||||
|
||||
@@ -85,7 +85,7 @@ class ShowController extends Controller
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function show(Request $request, Category $category, Carbon $start = null, Carbon $end = null) // @phpstan-ignore-line
|
||||
public function show(Request $request, Category $category, Carbon $start = null, Carbon $end = null)
|
||||
{
|
||||
/** @var Carbon $start */
|
||||
$start = $start ?? session('start', Carbon::now()->startOfMonth());
|
||||
|
||||
@@ -205,7 +205,7 @@ class BudgetController extends Controller
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function expenseAsset(Budget $budget, ?BudgetLimit $budgetLimit = null): JsonResponse // @phpstan-ignore-line
|
||||
public function expenseAsset(Budget $budget, ?BudgetLimit $budgetLimit = null): JsonResponse
|
||||
{
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
@@ -273,7 +273,7 @@ class BudgetController extends Controller
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function expenseCategory(Budget $budget, ?BudgetLimit $budgetLimit = null): JsonResponse // @phpstan-ignore-line
|
||||
public function expenseCategory(Budget $budget, ?BudgetLimit $budgetLimit = null): JsonResponse
|
||||
{
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
@@ -337,7 +337,7 @@ class BudgetController extends Controller
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function expenseExpense(Budget $budget, ?BudgetLimit $budgetLimit = null): JsonResponse // @phpstan-ignore-line
|
||||
public function expenseExpense(Budget $budget, ?BudgetLimit $budgetLimit = null): JsonResponse
|
||||
{
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
|
||||
@@ -300,7 +300,7 @@ class CurrencyController extends Controller
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return RedirectResponse|Redirector
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function enableCurrency(Request $request): JsonResponse
|
||||
{
|
||||
|
||||
@@ -180,7 +180,8 @@ class DebugController extends Controller
|
||||
|
||||
// get latest log file:
|
||||
$logger = Log::driver();
|
||||
$handlers = $logger->getHandlers();
|
||||
// PHPstan doesn't recognize the method because of its polymorphic nature.
|
||||
$handlers = $logger->getHandlers(); // @phpstan-ignore-line
|
||||
$logContent = '';
|
||||
foreach ($handlers as $handler) {
|
||||
if ($handler instanceof RotatingFileHandler) {
|
||||
|
||||
@@ -54,7 +54,7 @@ class FrontpageController extends Controller
|
||||
// percentage!
|
||||
$pct = 0;
|
||||
if (0 !== bccomp($piggyBank->targetamount, '0')) {
|
||||
$pct = round(($amount / $piggyBank->targetamount) * 100);
|
||||
$pct = (int)bcmul(bcdiv($amount, $piggyBank->targetamount), '100');
|
||||
}
|
||||
|
||||
$entry = [
|
||||
|
||||
@@ -44,7 +44,7 @@ class IntroController extends Controller
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function getIntroSteps(string $route, string $specificPage = null): JsonResponse // @phpstan-ignore-line
|
||||
public function getIntroSteps(string $route, string $specificPage = null): JsonResponse
|
||||
{
|
||||
Log::debug(sprintf('getIntroSteps for route "%s" and page "%s"', $route, $specificPage));
|
||||
$specificPage = $specificPage ?? '';
|
||||
@@ -105,7 +105,7 @@ class IntroController extends Controller
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function postEnable(string $route, string $specialPage = null): JsonResponse // @phpstan-ignore-line
|
||||
public function postEnable(string $route, string $specialPage = null): JsonResponse
|
||||
{
|
||||
$specialPage = $specialPage ?? '';
|
||||
$route = str_replace('.', '_', $route);
|
||||
@@ -129,7 +129,7 @@ class IntroController extends Controller
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function postFinished(string $route, string $specialPage = null): JsonResponse // @phpstan-ignore-line
|
||||
public function postFinished(string $route, string $specialPage = null): JsonResponse
|
||||
{
|
||||
$specialPage = $specialPage ?? '';
|
||||
$key = 'shown_demo_'.$route;
|
||||
|
||||
@@ -85,7 +85,7 @@ class ReconcileController extends Controller
|
||||
* @throws FireflyException
|
||||
* @throws JsonException
|
||||
*/
|
||||
public function overview(Request $request, Account $account = null, Carbon $start = null, Carbon $end = null): JsonResponse // @phpstan-ignore-line
|
||||
public function overview(Request $request, Account $account = null, Carbon $start = null, Carbon $end = null): JsonResponse
|
||||
{
|
||||
$startBalance = $request->get('startBalance');
|
||||
$endBalance = $request->get('endBalance');
|
||||
@@ -226,7 +226,7 @@ class ReconcileController extends Controller
|
||||
* @throws FireflyException
|
||||
* @throws JsonException
|
||||
*/
|
||||
public function transactions(Account $account, Carbon $start = null, Carbon $end = null) // @phpstan-ignore-line
|
||||
public function transactions(Account $account, Carbon $start = null, Carbon $end = null)
|
||||
{
|
||||
if (null === $start || null === $end) {
|
||||
throw new FireflyException('Invalid dates submitted.');
|
||||
|
||||
@@ -87,7 +87,7 @@ class DeleteController extends Controller
|
||||
}
|
||||
$objectType = strtolower($journal->transaction_type_type ?? $journal->transactionType->type);
|
||||
$subTitle = (string)trans('firefly.delete_'.$objectType, ['description' => $group->title ?? $journal->description]);
|
||||
$previous = app('steam')->getSafePreviousUrl(route('index'));
|
||||
$previous = app('steam')->getSafePreviousUrl();
|
||||
// put previous url in session
|
||||
Log::debug('Will try to remember previous URL');
|
||||
$this->rememberPreviousUrl('transactions.delete.url');
|
||||
|
||||
@@ -66,7 +66,7 @@ class DeleteController extends Controller
|
||||
*/
|
||||
public function index(Webhook $webhook)
|
||||
{
|
||||
$subTitle = (string)trans('firefly.delete_webhook', ['title' => $webhook->name]);
|
||||
$subTitle = (string)trans('firefly.delete_webhook', ['title' => $webhook->title]);
|
||||
$this->rememberPreviousUrl('webhooks.delete.url');
|
||||
|
||||
return view('webhooks.delete', compact('webhook', 'subTitle'));
|
||||
|
||||
Reference in New Issue
Block a user