Fix calls to isset

This commit is contained in:
James Cole
2026-03-04 06:52:20 +01:00
parent b07b0dc69a
commit 63ab0fba8d
3 changed files with 10 additions and 10 deletions
@@ -85,8 +85,8 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn
'currency_code' => (string) $journal['currency_code'],
'currency_decimal_places' => (int) $journal['currency_decimal_places'],
'foreign_currency_id' => (int) ($journal['foreign_currency_id'] ?? 0),
'foreign_amount' => isset($journal['foreign_amount']) ? Steam::negative((string) $journal['foreign_amount']) : null,
'pc_amount' => isset($journal['pc_amount']) ? Steam::negative((string) $journal['pc_amount']) : null,
'foreign_amount' => array_key_exists('foreign_amount', $journal) && null !== $journal['foreign_amount'] ? Steam::negative((string) $journal['foreign_amount']) : null,
'pc_amount' => array_key_exists('pc_amount', $journal) && null !== $journal['pc_amount'] ? Steam::negative((string) $journal['pc_amount']) : null,
'date' => $journal['date'],
];
}
@@ -139,8 +139,8 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn
'currency_code' => (string) $journal['currency_code'],
'currency_decimal_places' => (int) $journal['currency_decimal_places'],
'foreign_currency_id' => (int) ($journal['foreign_currency_id'] ?? 0),
'foreign_amount' => isset($journal['foreign_amount']) ? Steam::positive((string) $journal['foreign_amount']) : null,
'pc_amount' => isset($journal['pc_amount']) ? Steam::positive((string) $journal['pc_amount']) : null,
'foreign_amount' => array_key_exists('foreign_amount', $journal) && null !== $journal['foreign_amount'] ? Steam::positive((string) $journal['foreign_amount']) : null,
'pc_amount' => array_key_exists('pc_amount', $journal) && null !== $journal['pc_amount'] ? Steam::positive((string) $journal['pc_amount']) : null,
'date' => $journal['date'],
];
}
@@ -159,8 +159,8 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
'currency_code' => (string) $journal['currency_code'],
'currency_decimal_places' => (int) $journal['currency_decimal_places'],
'foreign_currency_id' => (int) ($journal['foreign_currency_id'] ?? 0),
'foreign_amount' => isset($journal['foreign_amount']) ? Steam::negative((string) $journal['foreign_amount']) : null,
'pc_amount' => isset($journal['pc_amount']) ? Steam::negative((string) $journal['pc_amount']) : null,
'foreign_amount' => array_key_exists('foreign_amount', $journal) && null !== $journal['foreign_amount'] ? Steam::negative((string) $journal['foreign_amount']) : null,
'pc_amount' => array_key_exists('pc_amount', $journal) && null !== $journal['pc_amount'] ? Steam::negative((string) $journal['pc_amount']) : null,
'date' => $journal['date'],
'source_account_id' => (string) $journal['source_account_id'],
'budget_name' => $journal['budget_name'],
@@ -237,8 +237,8 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
'currency_code' => (string) $journal['currency_code'],
'currency_decimal_places' => (int) $journal['currency_decimal_places'],
'foreign_currency_id' => (int) ($journal['foreign_currency_id'] ?? 0),
'foreign_amount' => isset($journal['foreign_amount']) ? Steam::positive((string) $journal['foreign_amount']) : null,
'pc_amount' => isset($journal['pc_amount']) ? Steam::positive((string) $journal['pc_amount']) : null,
'foreign_amount' => array_key_exists('foreign_amount', $journal) && null !== $journal['foreign_amount'] ? Steam::positive((string) $journal['foreign_amount']) : null,
'pc_amount' => array_key_exists('pc_amount', $journal) && null !== $journal['pc_amount'] ? Steam::positive((string) $journal['pc_amount']) : null,
'date' => $journal['date'],
'source_account_id' => (string) $journal['source_account_id'],
'destination_account_id' => (string) $journal['destination_account_id'],
+2 -2
View File
@@ -357,7 +357,7 @@ class Steam
$primary = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup);
}
// account balance thing.
$currencyPresent = isset($account->meta) && array_key_exists('currency', $account->meta) && null !== $account->meta['currency'];
$currencyPresent = property_exists($account, 'meta') && array_key_exists('currency', $account->meta) && null !== $account->meta['currency'];
if ($currencyPresent) {
$accountCurrency = $account->meta['currency'];
}
@@ -846,7 +846,7 @@ class Steam
/** @var Account $account */
foreach ($accounts as $account) {
$accountId = $account->id;
$currencyPresent = isset($account->meta) && array_key_exists('currency', $account->meta) && null !== $account->meta['currency'];
$currencyPresent = property_exists($account, 'meta') && array_key_exists('currency', $account->meta) && null !== $account->meta['currency'];
if ($currencyPresent) {
$currencyId = $account->meta['currency']->id;
$currencies[$currencyId] ??= $account->meta['currency'];