Fix all level 2 issues.

This commit is contained in:
James Cole
2023-11-05 09:40:45 +01:00
parent 9002365e6d
commit 1b978d41e0
32 changed files with 53 additions and 56 deletions

View File

@@ -4,10 +4,8 @@ parameters:
reportUnmatchedIgnoredErrors: false reportUnmatchedIgnoredErrors: false
checkGenericClassInNonGenericObjectType: false # remove this rule when all other issues are solved. checkGenericClassInNonGenericObjectType: false # remove this rule when all other issues are solved.
ignoreErrors: ignoreErrors:
- '#Dynamic call to static method#' # all the Laravel ORM things depend on this.
- '#Control structures using switch should not be used.#' # switch is fine insome cases. - '#Control structures using switch should not be used.#' # switch is fine insome cases.
- '#Use unique name to make classes easy to recognize#'
- '#Do not name "e", shorter than 2 chars#'
- '#Do not name "q", shorter than 2 chars#'
- '#with no value type specified in iterable type array#' # remove this rule when all other issues are solved. - '#with no value type specified in iterable type array#' # remove this rule when all other issues are solved.
- '#has no value type specified in iterable type array#' # remove this rule when all other issues are solved. - '#has no value type specified in iterable type array#' # remove this rule when all other issues are solved.
- '#is not allowed to extend#' - '#is not allowed to extend#'
@@ -16,7 +14,6 @@ parameters:
- '#has a nullable return type declaration#' - '#has a nullable return type declaration#'
- '#with a nullable type declaration#' - '#with a nullable type declaration#'
- '#with null as default value#' - '#with null as default value#'
- '#is not covariant with PHPDoc type array#'
- -
message: '#Constructor in [a-zA-Z0-9\\_]+ has parameter \$[a-zA-Z0-9\\_]+ with default value#' message: '#Constructor in [a-zA-Z0-9\\_]+ has parameter \$[a-zA-Z0-9\\_]+ with default value#'
paths: paths:
@@ -56,5 +53,5 @@ parameters:
- ../bootstrap/app.php - ../bootstrap/app.php
# The level 8 is the highest level. original was 5 # The level 8 is the highest level. original was 5
level: 1 level: 2

View File

@@ -145,7 +145,7 @@ class DeleteOrphanedTransactions extends Command
foreach ($set as $transaction) { foreach ($set as $transaction) {
// delete journals // delete journals
$journal = TransactionJournal::find((int)$transaction->transaction_journal_id); $journal = TransactionJournal::find((int)$transaction->transaction_journal_id);
if ($journal) { if (null !== $journal) {
$journal->delete(); $journal->delete();
} }
Transaction::where('transaction_journal_id', (int)$transaction->transaction_journal_id)->delete(); Transaction::where('transaction_journal_id', (int)$transaction->transaction_journal_id)->delete();

View File

@@ -95,7 +95,7 @@ class FixUnevenAmount extends Command
{ {
// one of the transactions is bad. // one of the transactions is bad.
$journal = TransactionJournal::find($param); $journal = TransactionJournal::find($param);
if (!$journal) { if (null === $journal) {
return; return;
} }
/** @var Transaction|null $source */ /** @var Transaction|null $source */

View File

@@ -205,7 +205,7 @@ class UpgradeLiabilitiesEight extends Command
$source = $openingJournal->transactions()->where('amount', '<', 0)->first(); $source = $openingJournal->transactions()->where('amount', '<', 0)->first();
/** @var Transaction|null $dest */ /** @var Transaction|null $dest */
$dest = $openingJournal->transactions()->where('amount', '>', 0)->first(); $dest = $openingJournal->transactions()->where('amount', '>', 0)->first();
if ($source && $dest) { if (null !== $source && null !== $dest) {
$sourceId = $source->account_id; $sourceId = $source->account_id;
$destId = $dest->account_id; $destId = $dest->account_id;
$dest->account_id = $sourceId; $dest->account_id = $sourceId;

View File

@@ -48,7 +48,7 @@ trait UpdateTrait
/** @var UpdateRequestInterface $checker */ /** @var UpdateRequestInterface $checker */
$checker = app(UpdateRequestInterface::class); $checker = app(UpdateRequestInterface::class);
$channelConfig = app('fireflyconfig')->get('update_channel', 'stable'); $channelConfig = app('fireflyconfig')->get('update_channel', 'stable');
$channel = $channelConfig ? $channelConfig->data : 'stable'; $channel = (string)$channelConfig->data;
return $checker->getUpdateInformation($channel); return $checker->getUpdateInformation($channel);
} }

View File

@@ -88,15 +88,15 @@ class EditController extends Controller
$roles = $this->getRoles(); $roles = $this->getRoles();
$liabilityTypes = $this->getLiabilityTypes(); $liabilityTypes = $this->getLiabilityTypes();
$location = $repository->getLocation($account); $location = $repository->getLocation($account);
$latitude = $location ? $location->latitude : config('firefly.default_location.latitude'); $latitude = null !== $location ? $location->latitude : config('firefly.default_location.latitude');
$longitude = $location ? $location->longitude : config('firefly.default_location.longitude'); $longitude = null !== $location ? $location->longitude : config('firefly.default_location.longitude');
$zoomLevel = $location ? $location->zoom_level : config('firefly.default_location.zoom_level'); $zoomLevel = null !== $location ? $location->zoom_level : config('firefly.default_location.zoom_level');
$hasLocation = null !== $location; $hasLocation = null !== $location;
$locations = [ $locations = [
'location' => [ 'location' => [
'latitude' => old('location_latitude') ?? $latitude, 'latitude' => null !== old('location_latitude') ? old('location_latitude'): $latitude,
'longitude' => old('location_longitude') ?? $longitude, 'longitude' => null !== old('location_longitude') ? old('location_longitude') : $longitude,
'zoom_level' => old('location_zoom_level') ?? $zoomLevel, 'zoom_level' => null !== old('location_zoom_level') ? old('location_zoom_level') : $zoomLevel,
'has_location' => $hasLocation || 'true' === old('location_has_location'), 'has_location' => $hasLocation || 'true' === old('location_has_location'),
], ],
]; ];

View File

@@ -103,7 +103,7 @@ class EditController extends Controller
'notes' => $this->repository->getNoteText($bill), 'notes' => $this->repository->getNoteText($bill),
'transaction_currency_id' => $bill->transaction_currency_id, 'transaction_currency_id' => $bill->transaction_currency_id,
'active' => $hasOldInput ? (bool)$request->old('active') : $bill->active, 'active' => $hasOldInput ? (bool)$request->old('active') : $bill->active,
'object_group' => $bill->objectGroups->first() ? $bill->objectGroups->first()->title : '', 'object_group' => null !== $bill->objectGroups->first() ? $bill->objectGroups->first()->title : '',
]; ];
$request->session()->flash('preFilled', $preFilled); $request->session()->flash('preFilled', $preFilled);

View File

@@ -100,7 +100,7 @@ class EditController extends Controller
'active' => $hasOldInput ? (bool)$request->old('active') : $budget->active, 'active' => $hasOldInput ? (bool)$request->old('active') : $budget->active,
'auto_budget_currency_id' => $hasOldInput ? (int)$request->old('auto_budget_currency_id') : $currency->id, 'auto_budget_currency_id' => $hasOldInput ? (int)$request->old('auto_budget_currency_id') : $currency->id,
]; ];
if ($autoBudget) { if (null !== $autoBudget) {
$amount = $hasOldInput ? $request->old('auto_budget_amount') : $autoBudget->amount; $amount = $hasOldInput ? $request->old('auto_budget_amount') : $autoBudget->amount;
$preFilled['auto_budget_amount'] = app('steam')->bcround($amount, $autoBudget->transactionCurrency->decimal_places); $preFilled['auto_budget_amount'] = app('steam')->bcround($amount, $autoBudget->transactionCurrency->decimal_places);
} }

View File

@@ -57,7 +57,7 @@ abstract class Controller extends BaseController
{ {
// is site a demo site? // is site a demo site?
$isDemoSiteConfig = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site', false)); $isDemoSiteConfig = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site', false));
$isDemoSite = $isDemoSiteConfig ? $isDemoSiteConfig->data : false; $isDemoSite = (bool) $isDemoSiteConfig->data;
app('view')->share('IS_DEMO_SITE', $isDemoSite); app('view')->share('IS_DEMO_SITE', $isDemoSite);
app('view')->share('DEMO_USERNAME', config('firefly.demo_username')); app('view')->share('DEMO_USERNAME', config('firefly.demo_username'));
app('view')->share('DEMO_PASSWORD', config('firefly.demo_password')); app('view')->share('DEMO_PASSWORD', config('firefly.demo_password'));

View File

@@ -314,7 +314,7 @@ class DebugController extends Controller
// has stored reconciliations // has stored reconciliations
$type = TransactionType::whereType(TransactionType::RECONCILIATION)->first(); $type = TransactionType::whereType(TransactionType::RECONCILIATION)->first();
if ($user->transactionJournals()->where('transaction_type_id', $type->id)->count()) { if ($user->transactionJournals()->where('transaction_type_id', $type->id)->count() > 0) {
$flags[] = '<span title="Has reconciled">:ledger:</span>'; $flags[] = '<span title="Has reconciled">:ledger:</span>';
} }

View File

@@ -93,7 +93,7 @@ class EditController extends Controller
'targetamount' => app('steam')->bcround($piggyBank->targetamount, $currency->decimal_places), 'targetamount' => app('steam')->bcround($piggyBank->targetamount, $currency->decimal_places),
'targetdate' => $targetDate, 'targetdate' => $targetDate,
'startdate' => $startDate, 'startdate' => $startDate,
'object_group' => $piggyBank->objectGroups->first() ? $piggyBank->objectGroups->first()->title : '', 'object_group' => null !== $piggyBank->objectGroups->first() ? $piggyBank->objectGroups->first()->title : '',
'notes' => null === $note ? '' : $note->text, 'notes' => null === $note ? '' : $note->text,
]; ];
if (0 === bccomp($piggyBank->targetamount, '0')) { if (0 === bccomp($piggyBank->targetamount, '0')) {

View File

@@ -163,9 +163,9 @@ class CreateController extends Controller
$source = $journal->transactions()->where('amount', '<', 0)->first(); $source = $journal->transactions()->where('amount', '<', 0)->first();
/** @var Transaction $dest */ /** @var Transaction $dest */
$dest = $journal->transactions()->where('amount', '>', 0)->first(); $dest = $journal->transactions()->where('amount', '>', 0)->first();
$category = $journal->categories()->first() ? $journal->categories()->first()->name : ''; $category = null !== $journal->categories()->first() ? $journal->categories()->first()->name : '';
$budget = $journal->budgets()->first() ? $journal->budgets()->first()->id : 0; $budget = null !== $journal->budgets()->first() ? $journal->budgets()->first()->id : 0;
$bill = $journal->bill ? $journal->bill->id : 0; $bill = null !== $journal->bill ? $journal->bill->id : 0;
$hasOldInput = null !== $request->old('_token'); // flash some data $hasOldInput = null !== $request->old('_token'); // flash some data
$preFilled = []; $preFilled = [];
if (true === $hasOldInput) { if (true === $hasOldInput) {

View File

@@ -106,7 +106,7 @@ class CreateController extends Controller
} }
// restore actions and triggers from old input: // restore actions and triggers from old input:
if ($request->old()) { if (null !== $request->old()) {
$oldTriggers = $this->getPreviousTriggers($request); $oldTriggers = $this->getPreviousTriggers($request);
$oldActions = $this->getPreviousActions($request); $oldActions = $this->getPreviousActions($request);
} }
@@ -163,7 +163,7 @@ class CreateController extends Controller
$oldActions = $this->getActionsForBill($bill); $oldActions = $this->getActionsForBill($bill);
// restore actions and triggers from old input: // restore actions and triggers from old input:
if ($request->old()) { if (null !== $request->old()) {
$oldTriggers = $this->getPreviousTriggers($request); $oldTriggers = $this->getPreviousTriggers($request);
$oldActions = $this->getPreviousActions($request); $oldActions = $this->getPreviousActions($request);
} }
@@ -172,7 +172,7 @@ class CreateController extends Controller
$actionCount = count($oldActions); $actionCount = count($oldActions);
$subTitleIcon = 'fa-clone'; $subTitleIcon = 'fa-clone';
// title depends on whether or not there is a rule group: // title depends on whether there is a rule group:
$subTitle = (string)trans('firefly.make_new_rule_no_group'); $subTitle = (string)trans('firefly.make_new_rule_no_group');
// flash old data // flash old data
@@ -218,7 +218,7 @@ class CreateController extends Controller
]; ];
// restore actions and triggers from old input: // restore actions and triggers from old input:
if ($request->old()) { if (null !== $request->old()) {
$oldTriggers = $this->getPreviousTriggers($request); $oldTriggers = $this->getPreviousTriggers($request);
$oldActions = $this->getPreviousActions($request); $oldActions = $this->getPreviousActions($request);
} }

View File

@@ -129,9 +129,9 @@ class TagController extends Controller
$subTitleIcon = 'fa-tag'; $subTitleIcon = 'fa-tag';
$location = $this->repository->getLocation($tag); $location = $this->repository->getLocation($tag);
$latitude = $location ? $location->latitude : config('firefly.default_location.latitude'); $latitude = null !== $location ? $location->latitude : config('firefly.default_location.latitude');
$longitude = $location ? $location->longitude : config('firefly.default_location.longitude'); $longitude = null !== $location ? $location->longitude : config('firefly.default_location.longitude');
$zoomLevel = $location ? $location->zoom_level : config('firefly.default_location.zoom_level'); $zoomLevel = null !== $location ? $location->zoom_level : config('firefly.default_location.zoom_level');
$hasLocation = null !== $location; $hasLocation = null !== $location;
$locations = [ $locations = [
'location' => [ 'location' => [

View File

@@ -96,7 +96,7 @@ class IndexController extends Controller
if (null === $end) { if (null === $end) {
// get last transaction ever? // get last transaction ever?
$last = $this->repository->getLast(); $last = $this->repository->getLast();
$end = $last ? $last->date : session('end'); $end = null !== $last ? $last->date : session('end');
} }
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end]; [$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
@@ -147,7 +147,7 @@ class IndexController extends Controller
$first = $this->repository->firstNull(); $first = $this->repository->firstNull();
$start = null === $first ? new Carbon() : $first->date; $start = null === $first ? new Carbon() : $first->date;
$last = $this->repository->getLast(); $last = $this->repository->getLast();
$end = $last ? $last->date : today(config('app.timezone')); $end = null !== $last ? $last->date : today(config('app.timezone'));
$subTitle = (string)trans('firefly.all_' . $objectType); $subTitle = (string)trans('firefly.all_' . $objectType);
/** @var GroupCollectorInterface $collector */ /** @var GroupCollectorInterface $collector */

View File

@@ -47,7 +47,7 @@ class Range
*/ */
public function handle(Request $request, Closure $next) public function handle(Request $request, Closure $next)
{ {
if ($request->user()) { if (null !== $request->user()) {
// set start, end and finish: // set start, end and finish:
$this->setRange(); $this->setRange();

View File

@@ -190,7 +190,7 @@ class Account extends Model
->where('name', 'account_number') ->where('name', 'account_number')
->first(); ->first();
return $metaValue ? $metaValue->data : ''; return null !== $metaValue ? $metaValue->data : '';
} }
/** /**

View File

@@ -23,22 +23,22 @@ declare(strict_types=1);
namespace FireflyIII\Models; namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent; use Eloquent;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphMany; use Illuminate\Database\Eloquent\Relations\MorphMany;
use Carbon\Carbon;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/** /**
* FireflyIII\Models\TransactionJournalLink * FireflyIII\Models\TransactionJournalLink
* *
* @property int|string $id * @property int|string $id
* @property Carbon|null $created_at * @property Carbon|null $created_at
* @property Carbon|null $updated_at * @property Carbon|null $updated_at
* @property |stringint $link_type_id * @property string|int $link_type_id
* @property int $source_id * @property int $source_id
* @property int $destination_id * @property int $destination_id
* @property string|null $comment * @property string|null $comment

View File

@@ -250,7 +250,7 @@ class AccountRepository implements AccountRepositoryInterface
static function (Attachment $attachment) use ($disk) { static function (Attachment $attachment) use ($disk) {
$notes = $attachment->notes()->first(); $notes = $attachment->notes()->first();
$attachment->file_exists = $disk->exists($attachment->fileName()); $attachment->file_exists = $disk->exists($attachment->fileName());
$attachment->notes_text = $notes ? $notes->text : ''; $attachment->notes_text = null !== $notes ? $notes->text : '';
return $attachment; return $attachment;
} }

View File

@@ -199,7 +199,7 @@ class BillRepository implements BillRepositoryInterface
static function (Attachment $attachment) use ($disk) { static function (Attachment $attachment) use ($disk) {
$notes = $attachment->notes()->first(); $notes = $attachment->notes()->first();
$attachment->file_exists = $disk->exists($attachment->fileName()); $attachment->file_exists = $disk->exists($attachment->fileName());
$attachment->notes_text = $notes ? $notes->text : ''; $attachment->notes_text = null !== $notes ? $notes->text : '';
return $attachment; return $attachment;
} }
@@ -373,12 +373,12 @@ class BillRepository implements BillRepositoryInterface
return $bill->transactionJournals() return $bill->transactionJournals()
->before($end)->after($start)->get( ->before($end)->after($start)->get(
[ [
'transaction_journals.id', 'transaction_journals.id',
'transaction_journals.date', 'transaction_journals.date',
'transaction_journals.transaction_group_id', 'transaction_journals.transaction_group_id',
] ]
); );
} }
/** /**

View File

@@ -589,7 +589,7 @@ class BudgetRepository implements BudgetRepositoryInterface
static function (Attachment $attachment) use ($disk) { static function (Attachment $attachment) use ($disk) {
$notes = $attachment->notes()->first(); $notes = $attachment->notes()->first();
$attachment->file_exists = $disk->exists($attachment->fileName()); $attachment->file_exists = $disk->exists($attachment->fileName());
$attachment->notes_text = $notes ? $notes->text : ''; $attachment->notes_text = null !== $notes ? $notes->text : '';
return $attachment; return $attachment;
} }

View File

@@ -306,7 +306,7 @@ class CategoryRepository implements CategoryRepositoryInterface
static function (Attachment $attachment) use ($disk) { static function (Attachment $attachment) use ($disk) {
$notes = $attachment->notes()->first(); $notes = $attachment->notes()->first();
$attachment->file_exists = $disk->exists($attachment->fileName()); $attachment->file_exists = $disk->exists($attachment->fileName());
$attachment->notes_text = $notes ? $notes->text : ''; $attachment->notes_text = null !== $notes ? $notes->text : '';
return $attachment; return $attachment;
} }

View File

@@ -74,7 +74,7 @@ class JournalAPIRepository implements JournalAPIRepositoryInterface
static function (Attachment $attachment) use ($disk) { static function (Attachment $attachment) use ($disk) {
$notes = $attachment->notes()->first(); $notes = $attachment->notes()->first();
$attachment->file_exists = $disk->exists($attachment->fileName()); $attachment->file_exists = $disk->exists($attachment->fileName());
$attachment->notes_text = $notes ? $notes->text : ''; // TODO should not set notes like this. $attachment->notes_text = null !== $notes ? $notes->text : ''; // TODO should not set notes like this.
return $attachment; return $attachment;
} }

View File

@@ -125,7 +125,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
static function (Attachment $attachment) use ($disk) { static function (Attachment $attachment) use ($disk) {
$notes = $attachment->notes()->first(); $notes = $attachment->notes()->first();
$attachment->file_exists = $disk->exists($attachment->fileName()); $attachment->file_exists = $disk->exists($attachment->fileName());
$attachment->notes_text = $notes ? $notes->text : ''; $attachment->notes_text = null !== $notes ? $notes->text : '';
return $attachment; return $attachment;
} }

View File

@@ -335,7 +335,7 @@ class UserRepository implements UserRepositoryInterface
public function redeemCode(string $code): void public function redeemCode(string $code): void
{ {
$obj = InvitedUser::where('invite_code', $code)->where('redeemed', 0)->first(); $obj = InvitedUser::where('invite_code', $code)->where('redeemed', 0)->first();
if ($obj) { if (null !== $obj) {
$obj->redeemed = true; $obj->redeemed = true;
$obj->save(); $obj->save();
} }

View File

@@ -136,7 +136,7 @@ class FireflyConfig
public function getFresh(string $name, $default = null): ?Configuration public function getFresh(string $name, $default = null): ?Configuration
{ {
$config = Configuration::where('name', $name)->first(['id', 'name', 'data']); $config = Configuration::where('name', $name)->first(['id', 'name', 'data']);
if ($config) { if (null !== $config) {
return $config; return $config;
} }
// no preference found and default is null: // no preference found and default is null:

View File

@@ -134,7 +134,7 @@ trait AppendsLocationData
return true; return true;
} }
// if is POST and route does not contain API, must also have "has_location" = true // if is POST and route does not contain API, must also have "has_location" = true
if ('POST' === $this->method() && $this->routeIs('*.store') && !$this->routeIs('api.v1.*') && $hasLocationKey) { if ('POST' === $this->method() && $this->routeIs('*.store') && !$this->routeIs('api.v1.*') && '' !== $hasLocationKey) {
app('log')->debug('Is POST + store route.'); app('log')->debug('Is POST + store route.');
$hasLocation = $this->boolean($hasLocationKey); $hasLocation = $this->boolean($hasLocationKey);
if (true === $hasLocation) { if (true === $hasLocation) {
@@ -205,7 +205,7 @@ trait AppendsLocationData
} }
// if POST and not API route, must also have "has_location" // if POST and not API route, must also have "has_location"
// if is POST and route does not contain API, must also have "has_location" = true // if is POST and route does not contain API, must also have "has_location" = true
if ('POST' === $this->method() && $this->routeIs('*.update') && !$this->routeIs('api.v1.*') && $hasLocationKey) { if ('POST' === $this->method() && $this->routeIs('*.update') && !$this->routeIs('api.v1.*') && '' !== $hasLocationKey) {
app('log')->debug('Is POST + store route.'); app('log')->debug('Is POST + store route.');
$hasLocation = $this->boolean($hasLocationKey); $hasLocation = $this->boolean($hasLocationKey);
if (true === $hasLocation) { if (true === $hasLocation) {

View File

@@ -117,7 +117,7 @@ class Steam
$cache = new CacheProperties(); $cache = new CacheProperties();
$cache->addProperty($account->id); $cache->addProperty($account->id);
$cache->addProperty('balance-in-range'); $cache->addProperty('balance-in-range');
$cache->addProperty($currency ? $currency->id : 0); $cache->addProperty(null !== $currency ? $currency->id : 0);
$cache->addProperty($start); $cache->addProperty($start);
$cache->addProperty($end); $cache->addProperty($end);
if ($cache->has()) { if ($cache->has()) {
@@ -204,7 +204,7 @@ class Steam
$cache->addProperty($account->id); $cache->addProperty($account->id);
$cache->addProperty('balance'); $cache->addProperty('balance');
$cache->addProperty($date); $cache->addProperty($date);
$cache->addProperty($currency ? $currency->id : 0); $cache->addProperty(null !== $currency ? $currency->id : 0);
if ($cache->has()) { if ($cache->has()) {
return $cache->get(); return $cache->get();
} }

View File

@@ -123,7 +123,7 @@ class BillTransformer extends AbstractTransformer
'active' => $bill->active, 'active' => $bill->active,
'order' => (int)$bill->order, 'order' => (int)$bill->order,
'notes' => $notes, 'notes' => $notes,
'object_group_id' => $objectGroupId ? (string)$objectGroupId : null, 'object_group_id' => null !== $objectGroupId ? (string)$objectGroupId : null,
'object_group_order' => $objectGroupOrder, 'object_group_order' => $objectGroupOrder,
'object_group_title' => $objectGroupTitle, 'object_group_title' => $objectGroupTitle,

View File

@@ -86,8 +86,8 @@ class PiggyBankEventTransformer extends AbstractTransformer
'currency_code' => $currency->code, 'currency_code' => $currency->code,
'currency_symbol' => $currency->symbol, 'currency_symbol' => $currency->symbol,
'currency_decimal_places' => (int)$currency->decimal_places, 'currency_decimal_places' => (int)$currency->decimal_places,
'transaction_journal_id' => $journalId ? (string)$journalId : null, 'transaction_journal_id' => null !== $journalId ? (string)$journalId : null,
'transaction_group_id' => $groupId ? (string)$groupId : null, 'transaction_group_id' => null !== $groupId ? (string)$groupId : null,
'links' => [ 'links' => [
[ [
'rel' => 'self', 'rel' => 'self',

View File

@@ -123,7 +123,7 @@ class PiggyBankTransformer extends AbstractTransformer
'order' => (int)$piggyBank->order, 'order' => (int)$piggyBank->order,
'active' => true, 'active' => true,
'notes' => $notes, 'notes' => $notes,
'object_group_id' => $objectGroupId ? (string)$objectGroupId : null, 'object_group_id' => null !== $objectGroupId ? (string)$objectGroupId : null,
'object_group_order' => $objectGroupOrder, 'object_group_order' => $objectGroupOrder,
'object_group_title' => $objectGroupTitle, 'object_group_title' => $objectGroupTitle,
'links' => [ 'links' => [

View File

@@ -61,7 +61,7 @@ trait RecurrenceValidation
/** @var RecurrenceTransaction|null $first */ /** @var RecurrenceTransaction|null $first */
$first = $recurrence->recurrenceTransactions()->first(); $first = $recurrence->recurrenceTransactions()->first();
if (null !== $first) { if (null !== $first) {
$transactionType = $first->transactionType ? $first->transactionType->type : 'withdrawal'; $transactionType = null !== $first->transactionType ? $first->transactionType->type : 'withdrawal';
app('log')->debug(sprintf('Determined type to be %s.', $transactionType)); app('log')->debug(sprintf('Determined type to be %s.', $transactionType));
} }
if (null === $first) { if (null === $first) {