Various phpstan fixes

This commit is contained in:
James Cole
2023-11-28 04:45:07 +01:00
parent 8604b05d07
commit 14e9d73768
24 changed files with 133 additions and 58 deletions

View File

@@ -99,9 +99,9 @@ class DeleteController extends Controller
*
* @param TransactionGroup $group
*
* @return RedirectResponse
* @return RedirectResponse|Redirector
*/
public function destroy(TransactionGroup $group): RedirectResponse
public function destroy(TransactionGroup $group): RedirectResponse|Redirector
{
app('log')->debug(sprintf('Now in %s(#%d).', __METHOD__, $group->id));
if (!$this->isEditableGroup($group)) {

View File

@@ -163,9 +163,9 @@ class ShowController extends Controller
$amounts[$symbol]['amount'] = bcadd($amounts[$symbol]['amount'], $transaction['amount']);
if (null !== $transaction['foreign_amount'] && '' !== $transaction['foreign_amount']
&& bccomp(
'0',
$transaction['foreign_amount']
) !== 0) {
'0',
$transaction['foreign_amount']
) !== 0) {
// same for foreign currency:
$foreignSymbol = $transaction['foreign_currency_symbol'];
if (!array_key_exists($foreignSymbol, $amounts)) {
@@ -192,7 +192,10 @@ class ShowController extends Controller
*/
private function getAccounts(array $group): array
{
$accounts = [];
$accounts = [
'source' => [],
'destination' => [],
];
foreach ($group['transactions'] as $transaction) {
$accounts['source'][] = [