Skip to content

Firefly III: a personal finances manager

Some PHP 7.1 compatible code.

James Cole7b03b0c5fc8f
diff --git a/app/Helpers/Attachments/AttachmentHelper.php b/app/Helpers/Attachments/AttachmentHelper.php
index af83f729a7..62d2e1c0d6 100644
--- a/app/Helpers/Attachments/AttachmentHelper.php
+++ b/app/Helpers/Attachments/AttachmentHelper.php
@@ -99,7 +99,7 @@ class AttachmentHelper implements AttachmentHelperInterface
*
* @return bool
*/
- public function saveAttachmentsForModel(Model $model, array $files = null): bool
+ public function saveAttachmentsForModel(Model $model, ?array $files): bool
{
if (is_array($files)) {
foreach ($files as $entry) {
diff --git a/app/Helpers/Attachments/AttachmentHelperInterface.php b/app/Helpers/Attachments/AttachmentHelperInterface.php
index ad1c80fd1b..55dd2e2a3f 100644
--- a/app/Helpers/Attachments/AttachmentHelperInterface.php
+++ b/app/Helpers/Attachments/AttachmentHelperInterface.php
@@ -55,6 +55,6 @@ interface AttachmentHelperInterface
*
* @return bool
*/
- public function saveAttachmentsForModel(Model $model, array $files = null): bool;
+ public function saveAttachmentsForModel(Model $model, ?array $files): bool;
}
diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.php
index b223c477dc..713bf8e714 100644
--- a/app/Http/Controllers/BudgetController.php
+++ b/app/Http/Controllers/BudgetController.php
@@ -171,7 +171,7 @@ class BudgetController extends Controller
*
* @return View
*/
- public function index(string $moment = null)
+ public function index(?string $moment)
{
$range = Preferences::get('viewRange', '1M')->data;
$start = session('start', new Carbon);
diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php
index 4b74cfbf38..e3f137717a 100644
--- a/app/Http/Controllers/Chart/BudgetController.php
+++ b/app/Http/Controllers/Chart/BudgetController.php
@@ -163,7 +163,7 @@ class BudgetController extends Controller
*
* @return \Illuminate\Http\JsonResponse
*/
- public function expenseAsset(Budget $budget, BudgetLimit $budgetLimit = null)
+ public function expenseAsset(Budget $budget, ?BudgetLimit $budgetLimit)
{
$cache = new CacheProperties;
$cache->addProperty($budget->id);
@@ -208,7 +208,7 @@ class BudgetController extends Controller
*
* @return \Illuminate\Http\JsonResponse
*/
- public function expenseCategory(Budget $budget, BudgetLimit $budgetLimit = null)
+ public function expenseCategory(Budget $budget, ?BudgetLimit $budgetLimit)
{
$cache = new CacheProperties;
$cache->addProperty($budget->id);
@@ -255,7 +255,7 @@ class BudgetController extends Controller
*
* @return \Illuminate\Http\JsonResponse
*/
- public function expenseExpense(Budget $budget, BudgetLimit $budgetLimit = null)
+ public function expenseExpense(Budget $budget, ?BudgetLimit $budgetLimit)
{
$cache = new CacheProperties;
$cache->addProperty($budget->id);
diff --git a/app/Http/breadcrumbs.php b/app/Http/breadcrumbs.php
index a9db6ca7c4..d878473760 100644
--- a/app/Http/breadcrumbs.php
+++ b/app/Http/breadcrumbs.php
@@ -805,7 +805,7 @@ Breadcrumbs::register(
* MASS TRANSACTION EDIT / DELETE
*/
Breadcrumbs::register(
- 'transactions.mass.edit', function (BreadCrumbGenerator $breadcrumbs, Collection $journals) {
+ 'transactions.mass.edit', function (BreadCrumbGenerator $breadcrumbs, Collection $journals): void {
if ($journals->count() > 0) {
$journalIds = $journals->pluck('id')->toArray();
@@ -817,6 +817,7 @@ Breadcrumbs::register(
}
$breadcrumbs->parent('index');
+ return;
}
);
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index b529d8c625..94ba80baf9 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -500,7 +500,7 @@ class AccountRepository implements AccountRepositoryInterface
*
* @return null|string
*/
- private function filterIban(string $iban = null)
+ private function filterIban(?string $iban)
{
if (is_null($iban)) {
return null;
diff --git a/app/Repositories/RuleGroup/RuleGroupRepository.php b/app/Repositories/RuleGroup/RuleGroupRepository.php
index cee3e353ef..3293d67bfc 100644
--- a/app/Repositories/RuleGroup/RuleGroupRepository.php
+++ b/app/Repositories/RuleGroup/RuleGroupRepository.php
@@ -44,7 +44,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
*
* @return bool
*/
- public function destroy(RuleGroup $ruleGroup, RuleGroup $moveTo = null): bool
+ public function destroy(RuleGroup $ruleGroup, ?RuleGroup $moveTo): bool
{
/** @var Rule $rule */
foreach ($ruleGroup->rules as $rule) {
diff --git a/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php b/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php
index bb8bb8217d..4296d90be5 100644
--- a/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php
+++ b/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php
@@ -39,7 +39,7 @@ interface RuleGroupRepositoryInterface
*
* @return bool
*/
- public function destroy(RuleGroup $ruleGroup, RuleGroup $moveTo = null): bool;
+ public function destroy(RuleGroup $ruleGroup, ?RuleGroup $moveTo): bool;
/**
* @param int $ruleGroupId
diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php
index 581fb72ebf..559eefcdbf 100644
--- a/app/Repositories/Tag/TagRepository.php
+++ b/app/Repositories/Tag/TagRepository.php
@@ -253,7 +253,7 @@ class TagRepository implements TagRepositoryInterface
*
* @return string
*/
- public function sumOfTag(Tag $tag, Carbon $start = null, Carbon $end = null): string
+ public function sumOfTag(Tag $tag, ?Carbon $start, ?Carbon $end): string
{
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
diff --git a/app/Repositories/Tag/TagRepositoryInterface.php b/app/Repositories/Tag/TagRepositoryInterface.php
index a97ff00c98..c23875c588 100644
--- a/app/Repositories/Tag/TagRepositoryInterface.php
+++ b/app/Repositories/Tag/TagRepositoryInterface.php
@@ -133,7 +133,7 @@ interface TagRepositoryInterface
*
* @return string
*/
- public function sumOfTag(Tag $tag, Carbon $start = null, Carbon $end = null): string;
+ public function sumOfTag(Tag $tag, ?Carbon $start, ?Carbon $end): string;
/**
* @param Tag $tag
diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php
index 464fbed037..c73f4ab9ec 100644
--- a/app/Support/Navigation.php
+++ b/app/Support/Navigation.php
@@ -135,7 +135,7 @@ class Navigation
*
* @return Carbon
*/
- public function endOfX(Carbon $theCurrentEnd, string $repeatFreq, Carbon $maxDate = null): Carbon
+ public function endOfX(Carbon $theCurrentEnd, string $repeatFreq, ?Carbon $maxDate): Carbon
{
$functionMap = [
'1D' => 'endOfDay',
diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php
index 09183c84e5..c027514019 100644
--- a/app/Support/Twig/General.php
+++ b/app/Support/Twig/General.php
@@ -147,7 +147,7 @@ class General extends Twig_Extension
protected function balance(): Twig_SimpleFilter
{
return new Twig_SimpleFilter(
- 'balance', function (Account $account = null): string {
+ 'balance', function (?Account $account): string {
if (is_null($account)) {
return 'NULL';
}