Various code cleanup and phpstan suggestions

This commit is contained in:
James Cole
2022-11-02 06:25:37 +01:00
parent 74610a5d55
commit 8d8f81c27d
45 changed files with 147 additions and 27 deletions

View File

@@ -24,6 +24,7 @@ namespace FireflyIII\Support;
use Amount as Amt;
use Eloquent;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Support\Form\FormSupport;
use Illuminate\Support\Collection;
use Log;
@@ -66,6 +67,7 @@ class ExpandedForm
} catch (Throwable $e) {
Log::error(sprintf('Could not render amountNoCurrency(): %s', $e->getMessage()));
$html = 'Could not render amountNoCurrency.';
throw new FireflyException($html, 0, $e);
}
return $html;
@@ -101,6 +103,7 @@ class ExpandedForm
} catch (Throwable $e) {
Log::debug(sprintf('Could not render checkbox(): %s', $e->getMessage()));
$html = 'Could not render checkbox.';
throw new FireflyException($html, 0, $e);
}
return $html;
@@ -125,6 +128,7 @@ class ExpandedForm
} catch (Throwable $e) {
Log::debug(sprintf('Could not render date(): %s', $e->getMessage()));
$html = 'Could not render date.';
throw new FireflyException($html, 0, $e);
}
return $html;
@@ -147,6 +151,7 @@ class ExpandedForm
} catch (Throwable $e) {
Log::debug(sprintf('Could not render file(): %s', $e->getMessage()));
$html = 'Could not render file.';
throw new FireflyException($html, 0, $e);
}
return $html;
@@ -172,6 +177,7 @@ class ExpandedForm
} catch (Throwable $e) {
Log::debug(sprintf('Could not render integer(): %s', $e->getMessage()));
$html = 'Could not render integer.';
throw new FireflyException($html, 0, $e);
}
return $html;
@@ -196,6 +202,7 @@ class ExpandedForm
} catch (Throwable $e) {
Log::debug(sprintf('Could not render location(): %s', $e->getMessage()));
$html = 'Could not render location.';
throw new FireflyException($html, 0, $e);
}
return $html;
@@ -254,6 +261,7 @@ class ExpandedForm
} catch (Throwable $e) {
Log::debug(sprintf('Could not render nonSelectableAmount(): %s', $e->getMessage()));
$html = 'Could not render nonSelectableAmount.';
throw new FireflyException($html, 0, $e);
}
return $html;
@@ -279,6 +287,7 @@ class ExpandedForm
} catch (Throwable $e) {
Log::debug(sprintf('Could not render number(): %s', $e->getMessage()));
$html = 'Could not render number.';
throw new FireflyException($html, 0, $e);
}
return $html;
@@ -308,6 +317,7 @@ class ExpandedForm
} catch (Throwable $e) {
Log::debug(sprintf('Could not render objectGroup(): %s', $e->getMessage()));
$html = 'Could not render objectGroup.';
throw new FireflyException($html, 0, $e);
}
return $html;
@@ -327,6 +337,7 @@ class ExpandedForm
} catch (Throwable $e) {
Log::debug(sprintf('Could not render select(): %s', $e->getMessage()));
$html = 'Could not render optionsList.';
throw new FireflyException($html, 0, $e);
}
return $html;
@@ -348,6 +359,7 @@ class ExpandedForm
} catch (Throwable $e) {
Log::debug(sprintf('Could not render password(): %s', $e->getMessage()));
$html = 'Could not render password.';
throw new FireflyException($html, 0, $e);
}
return $html;
@@ -375,6 +387,7 @@ class ExpandedForm
} catch (Throwable $e) {
Log::debug(sprintf('Could not render percentage(): %s', $e->getMessage()));
$html = 'Could not render percentage.';
throw new FireflyException($html, 0, $e);
}
return $html;
@@ -397,6 +410,7 @@ class ExpandedForm
} catch (Throwable $e) {
Log::debug(sprintf('Could not render staticText(): %s', $e->getMessage()));
$html = 'Could not render staticText.';
throw new FireflyException($html, 0, $e);
}
return $html;
@@ -420,6 +434,7 @@ class ExpandedForm
} catch (Throwable $e) {
Log::debug(sprintf('Could not render text(): %s', $e->getMessage()));
$html = 'Could not render text.';
throw new FireflyException($html, 0, $e);
}
return $html;
@@ -449,6 +464,7 @@ class ExpandedForm
} catch (Throwable $e) {
Log::debug(sprintf('Could not render textarea(): %s', $e->getMessage()));
$html = 'Could not render textarea.';
throw new FireflyException($html, 0, $e);
}
return $html;

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Support\Form;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
@@ -140,6 +141,7 @@ class AccountForm
} catch (Throwable $e) {
Log::debug(sprintf('Could not render assetAccountCheckList(): %s', $e->getMessage()));
$html = 'Could not render assetAccountCheckList.';
throw new FireflyException($html, 0, $e);
}
return $html;

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Support\Form;
use Amount as Amt;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use Illuminate\Support\Collection;
@@ -99,6 +100,7 @@ class CurrencyForm
} catch (Throwable $e) {
Log::debug(sprintf('Could not render currencyField(): %s', $e->getMessage()));
$html = 'Could not render currencyField.';
throw new FireflyException($html, 0, $e);
}
return $html;
@@ -168,6 +170,7 @@ class CurrencyForm
} catch (Throwable $e) {
Log::debug(sprintf('Could not render currencyField(): %s', $e->getMessage()));
$html = 'Could not render currencyField.';
throw new FireflyException($html, 0, $e);
}
return $html;

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Support\Http\Controllers;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Bill;
use FireflyIII\Models\Tag;
@@ -61,6 +62,7 @@ trait ModelInformation
Log::error(sprintf('Throwable was thrown in getActionsForBill(): %s', $e->getMessage()));
Log::error($e->getTraceAsString());
$result = 'Could not render view. See log files.';
throw new FireflyException($result, 0, $e);
}
return [$result];
@@ -148,6 +150,7 @@ trait ModelInformation
Log::debug(sprintf('Throwable was thrown in getTriggersForBill(): %s', $e->getMessage()));
Log::debug($e->getTraceAsString());
$string = '';
throw new FireflyException('Could not render trigger', 0, $e);
}
if ('' !== $string) {
$result[] = $string;
@@ -262,6 +265,7 @@ trait ModelInformation
Log::debug(sprintf('Throwable was thrown in getTriggersForJournal(): %s', $e->getMessage()));
Log::debug($e->getTraceAsString());
$string = '';
throw new FireflyException('Could not render trigger', 0, $e);
}
if ('' !== $string) {
$result[] = $string;

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Support\Http\Controllers;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Report\PopupReportInterface;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
@@ -70,6 +71,7 @@ trait RenderPartialViews
} catch (Throwable $e) {
Log::error(sprintf('Could not render: %s', $e->getMessage()));
$view = 'Firefly III could not render the view. Please see the log files.';
throw new FireflyException($view, 0, $e);
}
return $view;
@@ -91,6 +93,7 @@ trait RenderPartialViews
} catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage()));
$result = 'Could not render view.';
throw new FireflyException($result, 0, $e);
}
return $result;
@@ -122,6 +125,7 @@ trait RenderPartialViews
} catch (Throwable $e) {
Log::error(sprintf('Could not render: %s', $e->getMessage()));
$view = 'Firefly III could not render the view. Please see the log files.';
throw new FireflyException($view, 0, $e);
}
return $view;
@@ -149,6 +153,7 @@ trait RenderPartialViews
} catch (Throwable $e) {
Log::error(sprintf('Could not render: %s', $e->getMessage()));
$view = 'Firefly III could not render the view. Please see the log files.';
throw new FireflyException($view, 0, $e);
}
return $view;
@@ -170,6 +175,7 @@ trait RenderPartialViews
} catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.options.category: %s', $e->getMessage()));
$result = 'Could not render view.';
throw new FireflyException($result, 0, $e);
}
return $result;
@@ -211,6 +217,7 @@ trait RenderPartialViews
} catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage()));
$result = 'Could not render view.';
throw new FireflyException($result, 0, $e);
}
return $result;
@@ -244,6 +251,7 @@ trait RenderPartialViews
} catch (Throwable $e) {
Log::error(sprintf('Could not render: %s', $e->getMessage()));
$view = 'Firefly III could not render the view. Please see the log files.';
throw new FireflyException($view, 0, $e);
}
return $view;
@@ -278,6 +286,7 @@ trait RenderPartialViews
} catch (Throwable $e) {
Log::debug(sprintf('Throwable was thrown in getCurrentActions(): %s', $e->getMessage()));
Log::error($e->getTraceAsString());
throw new FireflyException('Could not render', 0, $e);
}
++$index;
@@ -332,6 +341,7 @@ trait RenderPartialViews
} catch (Throwable $e) {
Log::debug(sprintf('Throwable was thrown in getCurrentTriggers(): %s', $e->getMessage()));
Log::error($e->getTraceAsString());
throw new FireflyException('Could not render', 0, $e);
}
++$index;
@@ -368,6 +378,7 @@ trait RenderPartialViews
} catch (Throwable $e) {
Log::error(sprintf('Could not render: %s', $e->getMessage()));
$view = 'Firefly III could not render the view. Please see the log files.';
throw new FireflyException($view, 0, $e);
}
return $view;
@@ -385,6 +396,7 @@ trait RenderPartialViews
} catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.options.no-options: %s', $e->getMessage()));
$result = 'Could not render view.';
throw new FireflyException($result, 0, $e);
}
return $result;
@@ -407,6 +419,7 @@ trait RenderPartialViews
} catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage()));
$result = 'Could not render view.';
throw new FireflyException($result, 0, $e);
}
return $result;

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Support\Http\Controllers;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;
use FireflyIII\Support\Search\OperatorQuerySearch;
use Illuminate\Http\Request;
@@ -61,6 +62,7 @@ trait RuleManagement
} catch (Throwable $e) {
Log::debug(sprintf('Throwable was thrown in getPreviousActions(): %s', $e->getMessage()));
Log::error($e->getTraceAsString());
throw new FireflyException('Could not render', 0, $e);
}
$index++;
}
@@ -107,6 +109,7 @@ trait RuleManagement
} catch (Throwable $e) {
Log::debug(sprintf('Throwable was thrown in getPreviousTriggers(): %s', $e->getMessage()));
Log::error($e->getTraceAsString());
throw new FireflyException('Could not render', 0, $e);
}
$index++;
}
@@ -149,6 +152,7 @@ trait RuleManagement
} catch (Throwable $e) {
Log::debug(sprintf('Throwable was thrown in getPreviousTriggers(): %s', $e->getMessage()));
Log::error($e->getTraceAsString());
throw new FireflyException('Could not render', 0, $e);
}
$index++;
}