Skip to content

Firefly III: a personal finances manager

Fix some nullable methods.

James Cole021906976601
diff --git a/app/Api/V1/Controllers/Controller.php b/app/Api/V1/Controllers/Controller.php
index 1101011c9e..4d3247506d 100644
--- a/app/Api/V1/Controllers/Controller.php
+++ b/app/Api/V1/Controllers/Controller.php
@@ -61,7 +61,7 @@ abstract class Controller extends BaseController
*
* @return string
*/
- protected function buildParams(): string
+ final protected function buildParams(): string
{
$return = '?';
$params = [];
@@ -83,7 +83,7 @@ abstract class Controller extends BaseController
/**
* @return Manager
*/
- protected function getManager(): Manager
+ final protected function getManager(): Manager
{
// create some objects:
$manager = new Manager;
diff --git a/app/Api/V1/Controllers/RecurrenceController.php b/app/Api/V1/Controllers/RecurrenceController.php
index c0caccca4c..6878712c67 100644
--- a/app/Api/V1/Controllers/RecurrenceController.php
+++ b/app/Api/V1/Controllers/RecurrenceController.php
@@ -238,7 +238,7 @@ class RecurrenceController extends Controller
$result = $recurring->fire();
} catch (FireflyException $e) {
Log::error($e->getMessage());
- throw new FireflyException('200022: Error in cron job.');
+ throw new FireflyException('200022: Error in cron job.',0, $e);
}
if (false === $result) {
return response()->json([], 204);
diff --git a/app/Api/V1/Requests/RecurrenceUpdateRequest.php b/app/Api/V1/Requests/RecurrenceUpdateRequest.php
index 44f7571d8d..b39f9718fe 100644
--- a/app/Api/V1/Requests/RecurrenceUpdateRequest.php
+++ b/app/Api/V1/Requests/RecurrenceUpdateRequest.php
@@ -157,16 +157,16 @@ class RecurrenceUpdateRequest extends FormRequest
/**
* Returns the repetition data as it is found in the submitted data.
*
- * @return array|null
+ * @return array
*/
- private function getRepetitionData(): ?array
+ private function getRepetitionData(): array
{
$return = [];
// repetition data:
/** @var array $repetitions */
$repetitions = $this->get('repetitions');
if (null === $repetitions) {
- return null;
+ return [];
}
/** @var array $repetition */
foreach ($repetitions as $repetition) {
@@ -185,16 +185,16 @@ class RecurrenceUpdateRequest extends FormRequest
* Returns the transaction data as it is found in the submitted data. It's a complex method according to code
* standards but it just has a lot of ??-statements because of the fields that may or may not exist.
*
- * @return array|null
+ * @return array
*/
- private function getTransactionData(): ?array
+ private function getTransactionData(): array
{
$return = [];
// transaction data:
/** @var array $transactions */
$transactions = $this->get('transactions');
if (null === $transactions) {
- return null;
+ return [];
}
/** @var array $transaction */
foreach ($transactions as $transaction) {