Compare commits

..

23 Commits

Author SHA1 Message Date
James Cole
0b22b056bc Merge branch 'release/v6.1.0-alpha.1' 2023-12-10 07:05:51 +01:00
James Cole
ce239a5bb1 Update packages. 2023-12-10 07:03:48 +01:00
James Cole
ce023f2580 Always great when using conflicting tools 2023-12-10 06:57:41 +01:00
James Cole
46e130fdfe Clean up code. 2023-12-10 06:51:59 +01:00
James Cole
c2b22a2bac Clean up code. 2023-12-10 06:45:59 +01:00
James Cole
9a807fc215 Merge branch 'main' into develop
# Conflicts:
#	package-lock.json
#	package.json
2023-12-10 06:22:57 +01:00
James Cole
8ef74e9fd2 Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop 2023-12-09 20:15:13 +01:00
James Cole
abd123b1c8 Fix a few null pointers. 2023-12-09 20:12:34 +01:00
James Cole
7e72003984 Merge pull request #8235 from firefly-iii/dependabot/npm_and_yarn/vite-4.5.1 2023-12-06 05:26:37 +01:00
dependabot[bot]
69f653d0c9 chore(deps-dev): bump vite from 4.5.0 to 4.5.1
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.5.0 to 4.5.1.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v4.5.1/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v4.5.1/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-05 23:54:31 +00:00
James Cole
e6e9535509 Update manifest.webmanifest
Signed-off-by: James Cole <james@firefly-iii.org>
2023-12-05 09:25:41 +01:00
James Cole
45787a30de Update manifest.webmanifest
Signed-off-by: James Cole <james@firefly-iii.org>
2023-12-05 09:24:16 +01:00
James Cole
18e4c2ab33 Update manifest.webmanifest
Signed-off-by: James Cole <james@firefly-iii.org>
2023-12-05 09:20:54 +01:00
James Cole
c063bcf80d Merge pull request #8226 from firefly-iii/dependabot/composer/develop/symfony/mailgun-mailer-7.0.0 2023-12-04 06:54:33 +01:00
James Cole
eb8b7af7aa Merge pull request #8227 from firefly-iii/dependabot/composer/develop/guzzlehttp/guzzle-7.8.1 2023-12-04 06:54:21 +01:00
dependabot[bot]
c60fb0c68c chore(deps): bump symfony/mailgun-mailer from 6.4.0 to 7.0.0
Bumps [symfony/mailgun-mailer](https://github.com/symfony/mailgun-mailer) from 6.4.0 to 7.0.0.
- [Release notes](https://github.com/symfony/mailgun-mailer/releases)
- [Changelog](https://github.com/symfony/mailgun-mailer/blob/7.0/CHANGELOG.md)
- [Commits](https://github.com/symfony/mailgun-mailer/compare/v6.4.0...v7.0.0)

---
updated-dependencies:
- dependency-name: symfony/mailgun-mailer
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-04 05:46:13 +00:00
James Cole
84e99a065f Merge pull request #8225 from firefly-iii/dependabot/composer/develop/symfony/http-client-7.0.0 2023-12-04 06:45:39 +01:00
James Cole
369e980466 Merge pull request #8224 from firefly-iii/dependabot/npm_and_yarn/develop/vite-5.0.4 2023-12-04 06:44:11 +01:00
dependabot[bot]
963d4b7345 chore(deps): bump guzzlehttp/guzzle from 7.8.0 to 7.8.1
Bumps [guzzlehttp/guzzle](https://github.com/guzzle/guzzle) from 7.8.0 to 7.8.1.
- [Release notes](https://github.com/guzzle/guzzle/releases)
- [Changelog](https://github.com/guzzle/guzzle/blob/7.8/CHANGELOG.md)
- [Commits](https://github.com/guzzle/guzzle/compare/7.8.0...7.8.1)

---
updated-dependencies:
- dependency-name: guzzlehttp/guzzle
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-04 03:11:07 +00:00
dependabot[bot]
eaf6bd3fa0 chore(deps): bump symfony/http-client from 6.4.0 to 7.0.0
Bumps [symfony/http-client](https://github.com/symfony/http-client) from 6.4.0 to 7.0.0.
- [Release notes](https://github.com/symfony/http-client/releases)
- [Changelog](https://github.com/symfony/http-client/blob/7.0/CHANGELOG.md)
- [Commits](https://github.com/symfony/http-client/compare/v6.4.0...v7.0.0)

---
updated-dependencies:
- dependency-name: symfony/http-client
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-04 03:10:52 +00:00
dependabot[bot]
9b4a30565c chore(deps-dev): bump vite from 4.5.0 to 5.0.4
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.5.0 to 5.0.4.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.0.4/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-04 03:03:14 +00:00
James Cole
c37a877f34 Fix phpstan things 2023-12-03 08:28:50 +01:00
James Cole
d2a895ddda Update to PHP 8.3 2023-12-03 08:18:17 +01:00
299 changed files with 1770 additions and 1710 deletions

View File

@@ -36,10 +36,12 @@ $finder = PhpCsFixer\Finder::create()
$config = new PhpCsFixer\Config();
return $config->setRules([
'@PHP83Migration' => true,
'@PhpCsFixer:risky' => true,
'@PSR12:risky' => true,
'declare_strict_types' => true,
'strict_param' => true,
'comment_to_phpdoc' => false, // breaks phpstan lines in combination with PHPStorm.
'array_syntax' => ['syntax' => 'short'],
'native_function_invocation' => false, // annoying
'php_unit_data_provider_name' => false, // bloody annoying long test names

View File

@@ -226,16 +226,16 @@
},
{
"name": "friendsofphp/php-cs-fixer",
"version": "v3.40.1",
"version": "v3.41.0",
"source": {
"type": "git",
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
"reference": "7002f09c9593f515625a9f9717b10c2ab64dd3d5"
"reference": "7d8d18e19095a939b8a3b8046f57108feaad6134"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/7002f09c9593f515625a9f9717b10c2ab64dd3d5",
"reference": "7002f09c9593f515625a9f9717b10c2ab64dd3d5",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/7d8d18e19095a939b8a3b8046f57108feaad6134",
"reference": "7d8d18e19095a939b8a3b8046f57108feaad6134",
"shasum": ""
},
"require": {
@@ -265,8 +265,6 @@
"php-cs-fixer/accessible-object": "^1.1",
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.4",
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.4",
"phpspec/prophecy": "^1.17",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.6",
"symfony/phpunit-bridge": "^6.3.8 || ^7.0",
"symfony/yaml": "^5.4 || ^6.0 || ^7.0"
@@ -307,7 +305,7 @@
],
"support": {
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.40.1"
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.41.0"
},
"funding": [
{
@@ -315,7 +313,7 @@
"type": "github"
}
],
"time": "2023-12-02T23:18:26+00:00"
"time": "2023-12-08T22:54:33+00:00"
},
{
"name": "psr/container",

View File

@@ -13,6 +13,7 @@ parameters:
- '#is not allowed to extend#'
- '#switch is forbidden to use#'
- '#is neither abstract nor final#'
- '#on left side of \?\?\= always exists and is not nullable#'
- '#has a nullable return type declaration#' # perhaps throw errors instead?
- '#with a nullable type declaration#' # decide what action should be if param is null.
- '#with null as default value#'

View File

@@ -22,7 +22,7 @@ jobs:
- name: Setup PHP with Xdebug
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.3'
coverage: xdebug
extensions: >-
bcmath

View File

@@ -92,7 +92,7 @@ class BillController extends Controller
$foreignKey = sprintf('%d-%d', $billId, $foreignCurrencyId);
if (0 !== $currencyId) {
$response[$key] = $response[$key] ?? [
$response[$key] ??= [
'id' => (string)$billId,
'name' => $journal['bill_name'],
'difference' => '0',
@@ -104,7 +104,7 @@ class BillController extends Controller
$response[$key]['difference_float'] = (float)$response[$key]['difference']; // intentional float
}
if (0 !== $foreignCurrencyId) {
$response[$foreignKey] = $response[$foreignKey] ?? [
$response[$foreignKey] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string)$foreignCurrencyId,
@@ -147,7 +147,7 @@ class BillController extends Controller
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
if (0 !== $currencyId) {
$response[$currencyId] = $response[$currencyId] ?? [
$response[$currencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string)$currencyId,
@@ -157,7 +157,7 @@ class BillController extends Controller
$response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference']; // intentional float
}
if (0 !== $foreignCurrencyId) {
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
$response[$foreignCurrencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string)$foreignCurrencyId,

View File

@@ -58,7 +58,7 @@ class PeriodController extends Controller
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
if (0 !== $currencyId) {
$response[$currencyId] = $response[$currencyId] ?? [
$response[$currencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string)$currencyId,
@@ -68,7 +68,7 @@ class PeriodController extends Controller
$response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference']; // intentional float
}
if (0 !== $foreignCurrencyId) {
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
$response[$foreignCurrencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string)$foreignCurrencyId,

View File

@@ -83,7 +83,7 @@ class TagController extends Controller
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
if (0 !== $currencyId) {
$response[$currencyId] = $response[$currencyId] ?? [
$response[$currencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string)$currencyId,
@@ -93,7 +93,7 @@ class TagController extends Controller
$response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference']; // float but on purpose.
}
if (0 !== $foreignCurrencyId) {
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
$response[$foreignCurrencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string)$foreignCurrencyId,
@@ -148,7 +148,7 @@ class TagController extends Controller
// on currency ID
if (0 !== $currencyId) {
$response[$key] = $response[$key] ?? [
$response[$key] ??= [
'id' => (string)$tagId,
'name' => $tag['name'],
'difference' => '0',

View File

@@ -58,7 +58,7 @@ class PeriodController extends Controller
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
if (0 !== $currencyId) {
$response[$currencyId] = $response[$currencyId] ?? [
$response[$currencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string)$currencyId,
@@ -68,7 +68,7 @@ class PeriodController extends Controller
$response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference']; // float but on purpose.
}
if (0 !== $foreignCurrencyId) {
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
$response[$foreignCurrencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string)$foreignCurrencyId,

View File

@@ -84,7 +84,7 @@ class TagController extends Controller
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
if (0 !== $currencyId) {
$response[$currencyId] = $response[$currencyId] ?? [
$response[$currencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string)$currencyId,
@@ -94,7 +94,7 @@ class TagController extends Controller
$response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference'];
}
if (0 !== $foreignCurrencyId) {
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
$response[$foreignCurrencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string)$foreignCurrencyId,
@@ -152,7 +152,7 @@ class TagController extends Controller
// on currency ID
if (0 !== $currencyId) {
$response[$key] = $response[$key] ?? [
$response[$key] ??= [
'id' => (string)$tagId,
'name' => $tag['name'],
'difference' => '0',

View File

@@ -58,7 +58,7 @@ class PeriodController extends Controller
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
if (0 !== $currencyId) {
$response[$currencyId] = $response[$currencyId] ?? [
$response[$currencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string)$currencyId,
@@ -68,7 +68,7 @@ class PeriodController extends Controller
$response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference'];
}
if (0 !== $foreignCurrencyId) {
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
$response[$foreignCurrencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string)$foreignCurrencyId,

View File

@@ -81,7 +81,7 @@ class TagController extends Controller
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
if (0 !== $currencyId) {
$response[$currencyId] = $response[$currencyId] ?? [
$response[$currencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string)$currencyId,
@@ -91,7 +91,7 @@ class TagController extends Controller
$response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference'];
}
if (0 !== $foreignCurrencyId) {
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
$response[$foreignCurrencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string)$foreignCurrencyId,
@@ -149,7 +149,7 @@ class TagController extends Controller
// on currency ID
if (0 !== $currencyId) {
$response[$key] = $response[$key] ?? [
$response[$key] ??= [
'id' => (string)$tagId,
'name' => $tag['name'],
'difference' => '0',

View File

@@ -33,7 +33,6 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Transformers\BudgetLimitTransformer;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator;
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use League\Fractal\Resource\Collection as FractalCollection;

View File

@@ -24,13 +24,11 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Models\ObjectGroup;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\ObjectGroup;
use FireflyIII\Repositories\ObjectGroup\ObjectGroupRepositoryInterface;
use FireflyIII\Transformers\ObjectGroupTransformer;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator;
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use League\Fractal\Resource\Collection as FractalCollection;

View File

@@ -255,7 +255,7 @@ class ListController extends Controller
$unfiltered = $recurringRepos->getAll();
// filter selection
$collection = $unfiltered->filter(/** @phpstan-ignore-line */
$collection = $unfiltered->filter( // @phpstan-ignore-line
static function (Recurrence $recurrence) use ($currency) { // @phpstan-ignore-line
/** @var RecurrenceTransaction $transaction */
foreach ($recurrence->recurrenceTransactions as $transaction) {
@@ -305,7 +305,7 @@ class ListController extends Controller
$ruleRepos = app(RuleRepositoryInterface::class);
$unfiltered = $ruleRepos->getAll();
$collection = $unfiltered->filter(/** @phpstan-ignore-line */
$collection = $unfiltered->filter( // @phpstan-ignore-line
static function (Rule $rule) use ($currency) { // @phpstan-ignore-line
/** @var RuleTrigger $trigger */
foreach ($rule->ruleTriggers as $trigger) {

View File

@@ -148,12 +148,12 @@ class BasicController extends Controller
/** @var array $transactionJournal */
foreach ($set as $transactionJournal) {
$currencyId = (int)$transactionJournal['currency_id'];
$incomes[$currencyId] = $incomes[$currencyId] ?? '0';
$incomes[$currencyId] ??= '0';
$incomes[$currencyId] = bcadd(
$incomes[$currencyId],
bcmul($transactionJournal['amount'], '-1')
);
$sums[$currencyId] = $sums[$currencyId] ?? '0';
$sums[$currencyId] ??= '0';
$sums[$currencyId] = bcadd($sums[$currencyId], bcmul($transactionJournal['amount'], '-1'));
}
@@ -171,9 +171,9 @@ class BasicController extends Controller
/** @var array $transactionJournal */
foreach ($set as $transactionJournal) {
$currencyId = (int)$transactionJournal['currency_id'];
$expenses[$currencyId] = $expenses[$currencyId] ?? '0';
$expenses[$currencyId] ??= '0';
$expenses[$currencyId] = bcadd($expenses[$currencyId], $transactionJournal['amount']);
$sums[$currencyId] = $sums[$currencyId] ?? '0';
$sums[$currencyId] ??= '0';
$sums[$currencyId] = bcadd($sums[$currencyId], $transactionJournal['amount']);
}

View File

@@ -102,7 +102,7 @@ class AccountController extends Controller
$nameWithBalance = sprintf('%s (%s)', $account->name, app('amount')->formatAnything($currency, $balance, false));
}
$type = (string)trans(sprintf('firefly.%s', $account->accountType->type));
$groupedResult[$type] = $groupedResult[$type] ?? [
$groupedResult[$type] ??= [
'group ' => $type,
'items' => [],
];

View File

@@ -27,7 +27,6 @@ namespace FireflyIII\Api\V2\Controllers\Chart;
use Carbon\Carbon;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Api\V2\Request\Chart\DashboardChartRequest;
use FireflyIII\Api\V2\Request\Generic\DateRequest;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
@@ -99,7 +98,7 @@ class AccountController extends Controller
/** @var TransactionCurrency $default */
$default = app('amount')->getDefaultCurrency();
$params = $request->getAll();
/** @var Collection $preSet */
/** @var Collection $accounts */
$accounts = $params['accounts'];
$chartData = [];

View File

@@ -121,7 +121,7 @@ class BalanceController extends Controller
$currencies[$currencyId] = $currency; // may just re-assign itself, don't mind.
// set the array with monetary info, if it does not exist.
$data[$currencyId] = $data[$currencyId] ?? [
$data[$currencyId] ??= [
'currency_id' => (string)$currencyId,
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
@@ -135,7 +135,7 @@ class BalanceController extends Controller
];
// set the array (in monetary info) with spent/earned in this $period, if it does not exist.
$data[$currencyId][$period] = $data[$currencyId][$period] ?? [
$data[$currencyId][$period] ??= [
'period' => $period,
'spent' => '0',
'earned' => '0',

View File

@@ -198,8 +198,8 @@ class BudgetController extends Controller
* @var array $block
*/
foreach ($array as $currencyId => $block) {
$this->currencies[$currencyId] = $this->currencies[$currencyId] ?? TransactionCurrency::find($currencyId);
$return[$currencyId] = $return[$currencyId] ?? [
$this->currencies[$currencyId] ??= TransactionCurrency::find($currencyId);
$return[$currencyId] ??= [
'currency_id' => (string)$currencyId,
'currency_code' => $block['currency_code'],
'currency_name' => $block['currency_name'],

View File

@@ -109,7 +109,7 @@ class CategoryController extends Controller
$nativeAmount = app('steam')->positive($journal['foreign_amount']);
}
// create arrays
$return[$key] = $return[$key] ?? [
$return[$key] ??= [
'label' => $categoryName,
'currency_id' => (string)$currency->id,
'currency_code' => $currency->code,

View File

@@ -28,7 +28,6 @@ use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Models\Account;
use FireflyIII\Transformers\V2\AccountTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
/**
* Show = show a single account.

View File

@@ -30,7 +30,6 @@ use FireflyIII\Repositories\UserGroups\Bill\BillRepositoryInterface;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use FireflyIII\Transformers\V2\BillTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator;
/**

View File

@@ -31,7 +31,6 @@ use FireflyIII\Repositories\UserGroups\Bill\BillRepositoryInterface;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use FireflyIII\Transformers\V2\BillTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
/**
* Class ShowController

View File

@@ -28,7 +28,6 @@ use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Transformers\V2\BudgetTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator;
/**

View File

@@ -25,8 +25,6 @@ declare(strict_types=1);
namespace FireflyIII\Api\V2\Controllers\Model\BudgetLimit;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Api\V2\Request\Generic\DateRequest;
use FireflyIII\Models\Budget;
use Illuminate\Http\JsonResponse;
/**

View File

@@ -30,7 +30,6 @@ use FireflyIII\Repositories\UserGroups\PiggyBank\PiggyBankRepositoryInterface;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use FireflyIII\Transformers\V2\PiggyBankTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator;
/**

View File

@@ -169,10 +169,10 @@ class BasicController extends Controller
$nativeAmount = $transactionJournal['foreign_amount'];
}
// prep the arrays
$incomes[$currencyId] = $incomes[$currencyId] ?? '0';
$incomes['native'] = $incomes['native'] ?? '0';
$sums[$currencyId] = $sums[$currencyId] ?? '0';
$sums['native'] = $sums['native'] ?? '0';
$incomes[$currencyId] ??= '0';
$incomes['native'] ??= '0';
$sums[$currencyId] ??= '0';
$sums['native'] ??= '0';
// add values:
$incomes[$currencyId] = bcadd($incomes[$currencyId], $amount);
@@ -208,10 +208,10 @@ class BasicController extends Controller
}
// prep arrays
$expenses[$currencyId] = $expenses[$currencyId] ?? '0';
$expenses['native'] = $expenses['native'] ?? '0';
$sums[$currencyId] = $sums[$currencyId] ?? '0';
$sums['native'] = $sums['native'] ?? '0';
$expenses[$currencyId] ??= '0';
$expenses['native'] ??= '0';
$sums[$currencyId] ??= '0';
$sums['native'] ??= '0';
// add values
$expenses[$currencyId] = bcadd($expenses[$currencyId], $amount);

View File

@@ -31,7 +31,6 @@ use FireflyIII\Models\UserGroup;
use FireflyIII\Repositories\UserGroup\UserGroupRepositoryInterface;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**

View File

@@ -30,7 +30,6 @@ use FireflyIII\Models\UserGroup;
use FireflyIII\Repositories\UserGroup\UserGroupRepositoryInterface;
use FireflyIII\Transformers\V2\UserGroupTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;

View File

@@ -27,7 +27,6 @@ use FireflyIII\Enums\UserRoleEnum;
use FireflyIII\Models\AccountType;
use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes;
use FireflyIII\User;
use Illuminate\Foundation\Http\FormRequest;
/**

View File

@@ -55,7 +55,7 @@ class AutoSum
/** @var string $amount */
$amount = $getSum($object);
$return[$currency->id] = $return[$currency->id] ?? [
$return[$currency->id] ??= [
'id' => (string)$currency->id,
'name' => $currency->name,
'symbol' => $currency->symbol,

View File

@@ -61,7 +61,7 @@ class DeleteEmptyJournals extends Command
{
$set = Transaction::whereNull('deleted_at')
->groupBy('transactions.transaction_journal_id')
->get([DB::raw('COUNT(transactions.transaction_journal_id) as the_count'), 'transaction_journal_id']); /** @phpstan-ignore-line */
->get([DB::raw('COUNT(transactions.transaction_journal_id) as the_count'), 'transaction_journal_id']); // @phpstan-ignore-line
$total = 0;
/** @var Transaction $row */
foreach ($set as $row) {

View File

@@ -28,7 +28,6 @@ use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Preference;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\Facades\Preferences;
use FireflyIII\User;
use Illuminate\Console\Command;

View File

@@ -91,7 +91,7 @@ class FixIbans extends Command
/** @var Account $account */
foreach ($accounts as $account) {
$userId = $account->user_id;
$set[$userId] = $set[$userId] ?? [];
$set[$userId] ??= [];
$iban = (string)$account->iban;
if ('' === $iban) {
continue;

View File

@@ -27,9 +27,7 @@ namespace FireflyIII\Console\Commands\System;
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use Illuminate\Console\Command;
use Illuminate\Database\QueryException;
use Illuminate\Filesystem\FilesystemAdapter;
use League\Flysystem\FilesystemException;
use League\Flysystem\FilesystemReader;
use Storage;
/**

View File

@@ -33,7 +33,7 @@ class DestroyedTransactionLink extends Event
{
use SerializesModels;
private TransactionJournalLink $link; /** @phpstan-ignore-line */
private TransactionJournalLink $link; // @phpstan-ignore-line
/**
* DestroyedTransactionLink constructor.

View File

@@ -26,15 +26,12 @@ namespace FireflyIII\Exceptions;
use ErrorException;
use FireflyIII\Jobs\MailError;
use FireflyIII\Models\ObjectGroup;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Database\QueryException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\Session\TokenMismatchException;
use Illuminate\Support\Arr;
use Illuminate\Validation\ValidationException as LaravelValidationException;

View File

@@ -59,7 +59,8 @@ final class IntervalException extends Exception
array $intervals,
int $code = 0,
?Throwable $previous = null
): self {
): self
{
$message = sprintf(
'The periodicity %s is unknown. Choose one of available periodicity: %s',
$periodicity->name,

View File

@@ -29,7 +29,6 @@ use Exception;
use FireflyIII\Exceptions\DuplicateTransactionException;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Models\Preference;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Models\TransactionJournal;
@@ -426,20 +425,20 @@ class TransactionJournalFactory
app('log')->debug('Both accounts exist, simply return them.');
return [$sourceAccount, $destinationAccount];
}
if (null !== $sourceAccount && null === $destinationAccount) {
if (null === $destinationAccount) { // @phpstan-ignore-line
app('log')->debug('Destination account is NULL, source account is not.');
$account = $this->accountRepository->getReconciliation($sourceAccount);
app('log')->debug(sprintf('Will return account #%d ("%s") of type "%s"', $account->id, $account->name, $account->accountType->type));
return [$sourceAccount, $account];
}
if (null === $sourceAccount && null !== $destinationAccount) {
if (null === $sourceAccount) { // @phpstan-ignore-line
app('log')->debug('Source account is NULL, destination account is not.');
$account = $this->accountRepository->getReconciliation($destinationAccount);
app('log')->debug(sprintf('Will return account #%d ("%s") of type "%s"', $account->id, $account->name, $account->accountType->type));
return [$account, $destinationAccount];
}
app('log')->debug('Unused fallback');
app('log')->debug('Unused fallback'); // @phpstan-ignore-line
return [$sourceAccount, $destinationAccount];
}

View File

@@ -50,7 +50,7 @@ class APIEventHandler
if (null !== $user) {
try {
Notification::send($user, new NewAccessToken());
} catch (Exception $e) { /** @phpstan-ignore-line */
} catch (Exception $e) { // @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');

View File

@@ -31,7 +31,6 @@ use FireflyIII\Notifications\Admin\TestNotification;
use FireflyIII\Notifications\Admin\UserInvitation;
use FireflyIII\Notifications\Admin\VersionCheckResult;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\Support\Facades\FireflyConfig;
use Illuminate\Support\Facades\Notification;
/**
@@ -58,7 +57,7 @@ class AdminEventHandler
if ($repository->hasRole($user, 'owner')) {
try {
Notification::send($user, new UserInvitation($event->invitee));
} catch (Exception $e) { /** @phpstan-ignore-line */
} catch (Exception $e) { // @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -96,7 +95,7 @@ class AdminEventHandler
if ($repository->hasRole($user, 'owner')) {
try {
Notification::send($user, new VersionCheckResult($event->message));
} catch (Exception $e) { /** @phpstan-ignore-line */
} catch (Exception $e) {// @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -130,7 +129,7 @@ class AdminEventHandler
}
try {
Notification::send($event->user, new TestNotification($event->user->email));
} catch (Exception $e) { /** @phpstan-ignore-line */
} catch (Exception $e) { // @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');

View File

@@ -75,7 +75,7 @@ class AutomationHandler
}
try {
Notification::send($user, new TransactionCreation($groups));
} catch (Exception $e) { /** @phpstan-ignore-line */
} catch (Exception $e) { // @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');

View File

@@ -51,7 +51,7 @@ class BillEventHandler
app('log')->debug('Bill reminder is true!');
try {
Notification::send($bill->user, new BillReminder($bill, $event->field, $event->diff));
} catch (Exception $e) { /** @phpstan-ignore-line */
} catch (Exception $e) { // @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');

View File

@@ -131,7 +131,7 @@ class UserEventHandler
$group = null;
// create a new group.
while (true === $groupExists) { /** @phpstan-ignore-line */
while (true === $groupExists) { // @phpstan-ignore-line
$groupExists = UserGroup::where('title', $groupTitle)->count() > 0;
if (false === $groupExists) {
$group = UserGroup::create(['title' => $groupTitle]);
@@ -205,7 +205,7 @@ class UserEventHandler
if (false === $entry['notified']) {
try {
Notification::send($user, new UserLogin($ipAddress));
} catch (Exception $e) {/** @phpstan-ignore-line */
} catch (Exception $e) { // @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -239,7 +239,7 @@ class UserEventHandler
if ($repository->hasRole($user, 'owner')) {
try {
Notification::send($user, new AdminRegistrationNotification($event->user));
} catch (Exception $e) { /** @phpstan-ignore-line */
} catch (Exception $e) { // @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -316,7 +316,7 @@ class UserEventHandler
{
try {
Notification::send($event->user, new UserNewPassword(route('password.reset', [$event->token])));
} catch (Exception $e) { /** @phpstan-ignore-line */
} catch (Exception $e) { // @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -364,7 +364,7 @@ class UserEventHandler
if ($sendMail) {
try {
Notification::send($event->user, new UserRegistrationNotification());
} catch (Exception $e) { /** @phpstan-ignore-line */
} catch (Exception $e) { // @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');

View File

@@ -103,6 +103,9 @@ class NetWorth implements NetWorthInterface
foreach ($accounts as $account) {
app('log')->debug(sprintf('Now at account #%d ("%s")', $account->id, $account->name));
$currency = $this->getRepository()->getAccountCurrency($account);
if (null === $currency) {
$currency = app('amount')->getDefaultCurrency();
}
$currencyId = $currency->id;
$balance = '0';
$nativeBalance = '0';
@@ -118,7 +121,7 @@ class NetWorth implements NetWorthInterface
$nativeVirtualBalance = $converter->convert($default, $currency, $account->created_at, $virtualBalance);
$nativeBalance = bcsub($nativeBalance, $nativeVirtualBalance);
}
$netWorth[$currencyId] = $netWorth[$currencyId] ?? [
$netWorth[$currencyId] ??= [
'balance' => '0',
'native_balance' => '0',
'currency_id' => $currencyId,
@@ -205,7 +208,7 @@ class NetWorth implements NetWorthInterface
$balance = bcsub($balance, $virtualBalance);
}
$return[$currency->id] = $return[$currency->id] ?? [
$return[$currency->id] ??= [
'id' => (string)$currency->id,
'name' => $currency->name,
'symbol' => $currency->symbol,

View File

@@ -97,9 +97,9 @@ class ShowController extends Controller
}
/** @var Carbon $start */
$start = $start ?? session('start');
$start ??= session('start');
/** @var Carbon $end */
$end = $end ?? session('end');
$end ??= session('end');
if ($end < $start) {
[$start, $end] = [$end, $start];

View File

@@ -26,7 +26,6 @@ namespace FireflyIII\Http\Controllers\Admin;
use FireflyIII\Events\AdminRequestedTestMessage;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Middleware\IsDemoUser;
use FireflyIII\Support\Facades\FireflyConfig;
use FireflyIII\Support\Notifications\UrlValidator;
use FireflyIII\User;
use Illuminate\Contracts\View\Factory;

View File

@@ -109,7 +109,7 @@ class IndexController extends Controller
$array = $transformer->transform($bill);
$groupOrder = (int)$array['object_group_order'];
// make group array if necessary:
$bills[$groupOrder] = $bills[$groupOrder] ?? [
$bills[$groupOrder] ??= [
'object_group_id' => $array['object_group_id'],
'object_group_title' => $array['object_group_title'],
'bills' => [],
@@ -159,7 +159,7 @@ class IndexController extends Controller
}
$currencyId = $bill['currency_id'];
$sums[$groupOrder][$currencyId] = $sums[$groupOrder][$currencyId] ?? [
$sums[$groupOrder][$currencyId] ??= [
'currency_id' => $currencyId,
'currency_code' => $bill['currency_code'],
'currency_name' => $bill['currency_name'],
@@ -249,7 +249,7 @@ class IndexController extends Controller
* @var array $entry
*/
foreach ($array as $currencyId => $entry) {
$totals[$currencyId] = $totals[$currencyId] ?? [
$totals[$currencyId] ??= [
'currency_id' => $currencyId,
'currency_code' => $entry['currency_code'],
'currency_name' => $entry['currency_name'],

View File

@@ -105,14 +105,14 @@ class IndexController extends Controller
$range = app('navigation')->getViewRange(true);
$isCustomRange = session('is_custom_range', false);
if (false === $isCustomRange) {
$start = $start ?? session('start', today(config('app.timezone'))->startOfMonth());
$end = $end ?? app('navigation')->endOfPeriod($start, $range);
$start ??= session('start', today(config('app.timezone'))->startOfMonth());
$end ??= app('navigation')->endOfPeriod($start, $range);
}
// overrule start and end if necessary:
if (true === $isCustomRange) {
$start = $start ?? session('start', today(config('app.timezone'))->startOfMonth());
$end = $end ?? session('end', today(config('app.timezone'))->endOfMonth());
$start ??= session('start', today(config('app.timezone'))->startOfMonth());
$end ??= session('end', today(config('app.timezone'))->endOfMonth());
}
@@ -283,8 +283,7 @@ class IndexController extends Controller
foreach ($budget['spent'] as $spent) {
$currencyId = $spent['currency_id'];
$sums['spent'][$currencyId]
= $sums['spent'][$currencyId]
?? [
??= [
'amount' => '0',
'currency_id' => $spent['currency_id'],
'currency_symbol' => $spent['currency_symbol'],
@@ -297,8 +296,7 @@ class IndexController extends Controller
foreach ($budget['budgeted'] as $budgeted) {
$currencyId = $budgeted['currency_id'];
$sums['budgeted'][$currencyId]
= $sums['budgeted'][$currencyId]
?? [
??= [
'amount' => '0',
'currency_id' => $budgeted['currency_id'],
'currency_symbol' => $budgeted['currency_symbol'],
@@ -307,8 +305,8 @@ class IndexController extends Controller
$sums['budgeted'][$currencyId]['amount'] = bcadd($sums['budgeted'][$currencyId]['amount'], $budgeted['amount']);
// also calculate how much left from budgeted:
$sums['left'][$currencyId] = $sums['left'][$currencyId]
?? [
$sums['left'][$currencyId]
??= [
'amount' => '0',
'currency_id' => $budgeted['currency_id'],
'currency_symbol' => $budgeted['currency_symbol'],

View File

@@ -88,9 +88,9 @@ class ShowController extends Controller
public function noBudget(Request $request, Carbon $start = null, Carbon $end = null)
{
/** @var Carbon $start */
$start = $start ?? session('start');
$start ??= session('start');
/** @var Carbon $end */
$end = $end ?? session('end');
$end ??= session('end');
$subTitle = trans(
'firefly.without_budget_between',
['start' => $start->isoFormat($this->monthAndDayFormat), 'end' => $end->isoFormat($this->monthAndDayFormat)]

View File

@@ -84,9 +84,9 @@ class NoCategoryController extends Controller
{
app('log')->debug('Start of noCategory()');
/** @var Carbon $start */
$start = $start ?? session('start');
$start ??= session('start');
/** @var Carbon $end */
$end = $end ?? session('end');
$end ??= session('end');
$page = (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
$subTitle = trans(

View File

@@ -86,9 +86,9 @@ class ShowController extends Controller
public function show(Request $request, Category $category, Carbon $start = null, Carbon $end = null)
{
/** @var Carbon $start */
$start = $start ?? session('start', today(config('app.timezone'))->startOfMonth());
$start ??= session('start', today(config('app.timezone'))->startOfMonth());
/** @var Carbon $end */
$end = $end ?? session('end', today(config('app.timezone'))->endOfMonth());
$end ??= session('end', today(config('app.timezone'))->endOfMonth());
$subTitleIcon = 'fa-bookmark';
$page = (int)$request->get('page');
$attachments = $this->repository->getAttachments($category);

View File

@@ -125,7 +125,7 @@ class AccountController extends Controller
// grab the difference and find the currency.
$startAmount = (string)($startBalances[$accountId][$currencyId] ?? '0');
$diff = bcsub((string)$endAmount, $startAmount);
$currencies[$currencyId] = $currencies[$currencyId] ?? $this->currencyRepository->find($currencyId);
$currencies[$currencyId] ??= $this->currencyRepository->find($currencyId);
if (0 !== bccomp($diff, '0')) {
// store the values in a temporary array.
$tempData[] = [
@@ -585,7 +585,7 @@ class AccountController extends Controller
// grab the difference and find the currency.
$startAmount = (string)($startBalances[$accountId][$currencyId] ?? '0');
$diff = bcsub((string)$endAmount, $startAmount);
$currencies[$currencyId] = $currencies[$currencyId] ?? $this->currencyRepository->find($currencyId);
$currencies[$currencyId] ??= $this->currencyRepository->find($currencyId);
if (0 !== bccomp($diff, '0')) {
// store the values in a temporary array.
$tempData[] = [

View File

@@ -117,7 +117,7 @@ class BudgetController extends Controller
foreach ($spent as $row) {
$currencyId = $row['currency_id'];
$currencies[$currencyId] = $currencies[$currencyId] ?? $row; // don't mind the field 'sum'
$currencies[$currencyId] ??= $row; // don't mind the field 'sum'
// also store this day's sum:
$currencies[$currencyId]['spent'][$label] = $row['sum'];
}
@@ -237,7 +237,7 @@ class BudgetController extends Controller
// group by asset account ID:
foreach ($journals as $journal) {
$key = sprintf('%d-%d', (int)$journal['source_account_id'], $journal['currency_id']);
$result[$key] = $result[$key] ?? [
$result[$key] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
@@ -302,7 +302,7 @@ class BudgetController extends Controller
$chartData = [];
foreach ($journals as $journal) {
$key = sprintf('%d-%d', $journal['category_id'], $journal['currency_id']);
$result[$key] = $result[$key] ?? [
$result[$key] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
@@ -367,7 +367,7 @@ class BudgetController extends Controller
/** @var array $journal */
foreach ($journals as $journal) {
$key = sprintf('%d-%d', $journal['destination_account_id'], $journal['currency_id']);
$result[$key] = $result[$key] ?? [
$result[$key] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],

View File

@@ -87,7 +87,7 @@ class BudgetReportController extends Controller
foreach ($spent as $currency) {
foreach ($currency['budgets'] as $budget) {
$title = sprintf('%s (%s)', $budget['name'], $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -124,7 +124,7 @@ class BudgetReportController extends Controller
foreach ($budget['transaction_journals'] as $journal) {
$categoryName = $journal['category_name'] ?? trans('firefly.no_category');
$title = sprintf('%s (%s)', $categoryName, $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -161,7 +161,7 @@ class BudgetReportController extends Controller
foreach ($currency['budgets'] as $budget) {
foreach ($budget['transaction_journals'] as $journal) {
$title = sprintf('%s (%s)', $journal['destination_account_name'], $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -198,7 +198,7 @@ class BudgetReportController extends Controller
foreach ($spent as $currency) {
// add things to chart Data for each currency:
$spentKey = sprintf('%d-spent', $currency['currency_id']);
$chartData[$spentKey] = $chartData[$spentKey] ?? [
$chartData[$spentKey] ??= [
'label' => sprintf(
'%s (%s)',
(string)trans('firefly.spent_in_specific_budget', ['budget' => $budget->name]),
@@ -215,7 +215,7 @@ class BudgetReportController extends Controller
foreach ($currentBudget['transaction_journals'] as $journal) {
$key = $journal['date']->isoFormat($format);
$amount = app('steam')->positive($journal['amount']);
$chartData[$spentKey]['entries'][$key] = $chartData[$spentKey]['entries'][$key] ?? '0';
$chartData[$spentKey]['entries'][$key] ??= '0';
$chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount);
}
}
@@ -269,7 +269,7 @@ class BudgetReportController extends Controller
foreach ($currency['budgets'] as $budget) {
foreach ($budget['transaction_journals'] as $journal) {
$title = sprintf('%s (%s)', $journal['source_account_name'], $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],

View File

@@ -235,7 +235,7 @@ class CategoryController extends Controller
foreach ($outSet['transaction_journals'] as $journal) {
$amount = app('steam')->positive($journal['amount']);
$date = $journal['date']->isoFormat($format);
$chartData[$outKey]['entries'][$date] = $chartData[$outKey]['entries'][$date] ?? '0';
$chartData[$outKey]['entries'][$date] ??= '0';
$chartData[$outKey]['entries'][$date] = bcadd($amount, $chartData[$outKey]['entries'][$date]);
}
@@ -244,7 +244,7 @@ class CategoryController extends Controller
foreach ($inSet['transaction_journals'] as $journal) {
$amount = app('steam')->positive($journal['amount']);
$date = $journal['date']->isoFormat($format);
$chartData[$inKey]['entries'][$date] = $chartData[$inKey]['entries'][$date] ?? '0';
$chartData[$inKey]['entries'][$date] ??= '0';
$chartData[$inKey]['entries'][$date] = bcadd($amount, $chartData[$inKey]['entries'][$date]);
}
}

View File

@@ -86,7 +86,7 @@ class CategoryReportController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$objectName = $journal['budget_name'] ?? trans('firefly.no_budget');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -120,7 +120,7 @@ class CategoryReportController extends Controller
/** @var array $category */
foreach ($currency['categories'] as $category) {
$title = sprintf('%s (%s)', $category['name'], $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -155,7 +155,7 @@ class CategoryReportController extends Controller
/** @var array $category */
foreach ($currency['categories'] as $category) {
$title = sprintf('%s (%s)', $category['name'], $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -192,7 +192,7 @@ class CategoryReportController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$objectName = $journal['destination_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -228,7 +228,7 @@ class CategoryReportController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$objectName = $journal['destination_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -264,7 +264,7 @@ class CategoryReportController extends Controller
foreach ($spent as $currency) {
// add things to chart Data for each currency:
$spentKey = sprintf('%d-spent', $currency['currency_id']);
$chartData[$spentKey] = $chartData[$spentKey] ?? [
$chartData[$spentKey] ??= [
'label' => sprintf(
'%s (%s)',
(string)trans('firefly.spent_in_specific_category', ['category' => $category->name]),
@@ -281,7 +281,7 @@ class CategoryReportController extends Controller
foreach ($currentCategory['transaction_journals'] as $journal) {
$key = $journal['date']->isoFormat($format);
$amount = app('steam')->positive($journal['amount']);
$chartData[$spentKey]['entries'][$key] = $chartData[$spentKey]['entries'][$key] ?? '0';
$chartData[$spentKey]['entries'][$key] ??= '0';
$chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount);
}
}
@@ -291,7 +291,7 @@ class CategoryReportController extends Controller
foreach ($earned as $currency) {
// add things to chart Data for each currency:
$spentKey = sprintf('%d-earned', $currency['currency_id']);
$chartData[$spentKey] = $chartData[$spentKey] ?? [
$chartData[$spentKey] ??= [
'label' => sprintf(
'%s (%s)',
(string)trans('firefly.earned_in_specific_category', ['category' => $category->name]),
@@ -308,7 +308,7 @@ class CategoryReportController extends Controller
foreach ($currentCategory['transaction_journals'] as $journal) {
$key = $journal['date']->isoFormat($format);
$amount = app('steam')->positive($journal['amount']);
$chartData[$spentKey]['entries'][$key] = $chartData[$spentKey]['entries'][$key] ?? '0';
$chartData[$spentKey]['entries'][$key] ??= '0';
$chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount);
}
}
@@ -364,7 +364,7 @@ class CategoryReportController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$objectName = $journal['source_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -400,7 +400,7 @@ class CategoryReportController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$objectName = $journal['source_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],

View File

@@ -85,7 +85,7 @@ class DoubleReportController extends Controller
foreach ($currency['transaction_journals'] as $journal) {
$categoryName = $journal['budget_name'] ?? trans('firefly.no_budget');
$title = sprintf('%s (%s)', $categoryName, $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -120,7 +120,7 @@ class DoubleReportController extends Controller
foreach ($currency['transaction_journals'] as $journal) {
$categoryName = $journal['category_name'] ?? trans('firefly.no_category');
$title = sprintf('%s (%s)', $categoryName, $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -155,7 +155,7 @@ class DoubleReportController extends Controller
foreach ($currency['transaction_journals'] as $journal) {
$categoryName = $journal['category_name'] ?? trans('firefly.no_category');
$title = sprintf('%s (%s)', $categoryName, $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -195,7 +195,7 @@ class DoubleReportController extends Controller
$spentKey = sprintf('%d-spent', $currency['currency_id']);
$name = $this->getCounterpartName($accounts, $account->id, $account->name, $account->iban);
$chartData[$spentKey] = $chartData[$spentKey] ?? [
$chartData[$spentKey] ??= [
'label' => sprintf(
'%s (%s)',
(string)trans('firefly.spent_in_specific_double', ['account' => $name]),
@@ -211,7 +211,7 @@ class DoubleReportController extends Controller
foreach ($currency['transaction_journals'] as $journal) {
$key = $journal['date']->isoFormat($format);
$amount = app('steam')->positive($journal['amount']);
$chartData[$spentKey]['entries'][$key] = $chartData[$spentKey]['entries'][$key] ?? '0';
$chartData[$spentKey]['entries'][$key] ??= '0';
$chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount);
}
}
@@ -221,7 +221,7 @@ class DoubleReportController extends Controller
$earnedKey = sprintf('%d-earned', $currency['currency_id']);
$name = $this->getCounterpartName($accounts, $account->id, $account->name, $account->iban);
$chartData[$earnedKey] = $chartData[$earnedKey] ?? [
$chartData[$earnedKey] ??= [
'label' => sprintf(
'%s (%s)',
(string)trans('firefly.earned_in_specific_double', ['account' => $name]),
@@ -237,7 +237,7 @@ class DoubleReportController extends Controller
foreach ($currency['transaction_journals'] as $journal) {
$key = $journal['date']->isoFormat($format);
$amount = app('steam')->positive($journal['amount']);
$chartData[$earnedKey]['entries'][$key] = $chartData[$earnedKey]['entries'][$key] ?? '0';
$chartData[$earnedKey]['entries'][$key] ??= '0';
$chartData[$earnedKey]['entries'][$key] = bcadd($chartData[$earnedKey]['entries'][$key], $amount);
}
}
@@ -323,7 +323,7 @@ class DoubleReportController extends Controller
// do something
$tagName = trans('firefly.no_tags');
$title = sprintf('%s (%s)', $tagName, $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -341,7 +341,7 @@ class DoubleReportController extends Controller
// do something
$tagName = $tag['name'];
$title = sprintf('%s (%s)', $tagName, $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -383,7 +383,7 @@ class DoubleReportController extends Controller
// do something
$tagName = trans('firefly.no_tags');
$title = sprintf('%s (%s)', $tagName, $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -401,7 +401,7 @@ class DoubleReportController extends Controller
// do something
$tagName = $tag['name'];
$title = sprintf('%s (%s)', $tagName, $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],

View File

@@ -147,7 +147,7 @@ class ExpenseReportController extends Controller
while ($currentStart < $end) {
$currentEnd = clone $currentStart;
$currentEnd = $currentEnd->$function(); /** @phpstan-ignore-line */
$currentEnd = $currentEnd->$function(); // @phpstan-ignore-line
// get expenses grouped by opposing name:
$expenses = $this->groupByName($this->getExpensesForOpposing($accounts, $all, $currentStart, $currentEnd));
@@ -166,8 +166,8 @@ class ExpenseReportController extends Controller
$currentExpense = $expenses[$name] ?? '0';
// add to sum:
$sumOfIncome[$exp->id] = $sumOfIncome[$exp->id] ?? '0';
$sumOfExpense[$exp->id] = $sumOfExpense[$exp->id] ?? '0';
$sumOfIncome[$exp->id] ??= '0';
$sumOfExpense[$exp->id] ??= '0';
$sumOfIncome[$exp->id] = bcadd($sumOfIncome[$exp->id], $currentIncome);
$sumOfExpense[$exp->id] = bcadd($sumOfExpense[$exp->id], $currentExpense);

View File

@@ -182,14 +182,14 @@ class ReportController extends Controller
foreach ($journals as $journal) {
$period = $journal['date']->format($format);
$currencyId = (int)$journal['currency_id'];
$data[$currencyId] = $data[$currencyId] ?? [
$data[$currencyId] ??= [
'currency_id' => $currencyId,
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
'currency_name' => $journal['currency_name'],
'currency_decimal_places' => (int)$journal['currency_decimal_places'],
];
$data[$currencyId][$period] = $data[$currencyId][$period] ?? [
$data[$currencyId][$period] ??= [
'period' => $period,
'spent' => '0',
'earned' => '0',

View File

@@ -87,7 +87,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['budget_name'] ?? trans('firefly.no_budget');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -123,7 +123,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['category_name'] ?? trans('firefly.no_category');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -159,7 +159,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['category_name'] ?? trans('firefly.no_category');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -195,7 +195,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['destination_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -231,7 +231,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['destination_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -269,7 +269,7 @@ class TagReportController extends Controller
foreach ($spent as $currency) {
// add things to chart Data for each currency:
$spentKey = sprintf('%d-spent', $currency['currency_id']);
$chartData[$spentKey] = $chartData[$spentKey] ?? [
$chartData[$spentKey] ??= [
'label' => sprintf(
'%s (%s)',
(string)trans('firefly.spent_in_specific_tag', ['tag' => $tag->tag]),
@@ -286,7 +286,7 @@ class TagReportController extends Controller
foreach ($currentTag['transaction_journals'] as $journal) {
$key = $journal['date']->isoFormat($format);
$amount = app('steam')->positive($journal['amount']);
$chartData[$spentKey]['entries'][$key] = $chartData[$spentKey]['entries'][$key] ?? '0';
$chartData[$spentKey]['entries'][$key] ??= '0';
$chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount);
}
}
@@ -296,7 +296,7 @@ class TagReportController extends Controller
foreach ($earned as $currency) {
// add things to chart Data for each currency:
$spentKey = sprintf('%d-earned', $currency['currency_id']);
$chartData[$spentKey] = $chartData[$spentKey] ?? [
$chartData[$spentKey] ??= [
'label' => sprintf(
'%s (%s)',
(string)trans('firefly.earned_in_specific_tag', ['tag' => $tag->tag]),
@@ -313,7 +313,7 @@ class TagReportController extends Controller
foreach ($currentTag['transaction_journals'] as $journal) {
$key = $journal['date']->isoFormat($format);
$amount = app('steam')->positive($journal['amount']);
$chartData[$spentKey]['entries'][$key] = $chartData[$spentKey]['entries'][$key] ?? '0';
$chartData[$spentKey]['entries'][$key] ??= '0';
$chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount);
}
}
@@ -369,7 +369,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['source_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -405,7 +405,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['source_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -439,7 +439,7 @@ class TagReportController extends Controller
/** @var array $tag */
foreach ($currency['tags'] as $tag) {
$title = sprintf('%s (%s)', $tag['name'], $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -473,7 +473,7 @@ class TagReportController extends Controller
/** @var array $tag */
foreach ($currency['tags'] as $tag) {
$title = sprintf('%s (%s)', $tag['name'], $currency['currency_name']);
$result[$title] = $result[$title] ?? [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],

View File

@@ -78,7 +78,7 @@ class TransactionController extends Controller
foreach ($result as $journal) {
$budget = $journal['budget_name'] ?? (string)trans('firefly.no_budget');
$title = sprintf('%s (%s)', $budget, $journal['currency_symbol']);
$data[$title] = $data[$title] ?? [
$data[$title] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
@@ -131,7 +131,7 @@ class TransactionController extends Controller
foreach ($result as $journal) {
$category = $journal['category_name'] ?? (string)trans('firefly.no_category');
$title = sprintf('%s (%s)', $category, $journal['currency_symbol']);
$data[$title] = $data[$title] ?? [
$data[$title] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
@@ -184,7 +184,7 @@ class TransactionController extends Controller
foreach ($result as $journal) {
$name = $journal['destination_account_name'];
$title = sprintf('%s (%s)', $name, $journal['currency_symbol']);
$data[$title] = $data[$title] ?? [
$data[$title] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
@@ -237,7 +237,7 @@ class TransactionController extends Controller
foreach ($result as $journal) {
$name = $journal['source_account_name'];
$title = sprintf('%s (%s)', $name, $journal['currency_symbol']);
$data[$title] = $data[$title] ?? [
$data[$title] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],

View File

@@ -42,6 +42,7 @@ use Illuminate\View\View;
use Monolog\Handler\RotatingFileHandler;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use const PHP_SAPI;
/**
* Class DebugController
@@ -127,7 +128,7 @@ class DebugController extends Controller
// get latest log file:
$logger = Log::driver();
// PHPstan doesn't recognize the method because of its polymorphic nature.
$handlers = $logger->getHandlers(); /** @phpstan-ignore-line */
$handlers = $logger->getHandlers(); // @phpstan-ignore-line
$logContent = '';
foreach ($handlers as $handler) {
if ($handler instanceof RotatingFileHandler) {
@@ -172,7 +173,7 @@ class DebugController extends Controller
'db_version' => app('fireflyconfig')->get('db_version', 1)->data,
'php_version' => PHP_VERSION,
'php_os' => PHP_OS,
'interface' => \PHP_SAPI,
'interface' => PHP_SAPI,
'bcscale' => bcscale(),
'display_errors' => ini_get('display_errors'),
'error_reporting' => $this->errorReporting((int)ini_get('error_reporting')),

View File

@@ -179,9 +179,9 @@ class BoxController extends Controller
foreach ($set as $journal) {
$currencyId = (int)$journal['currency_id'];
$amount = $journal['amount'] ?? '0';
$incomes[$currencyId] = $incomes[$currencyId] ?? '0';
$incomes[$currencyId] ??= '0';
$incomes[$currencyId] = bcadd($incomes[$currencyId], app('steam')->positive($amount));
$sums[$currencyId] = $sums[$currencyId] ?? '0';
$sums[$currencyId] ??= '0';
$sums[$currencyId] = bcadd($sums[$currencyId], app('steam')->positive($amount));
}
@@ -194,9 +194,9 @@ class BoxController extends Controller
/** @var array $journal */
foreach ($set as $journal) {
$currencyId = (int)$journal['currency_id'];
$expenses[$currencyId] = $expenses[$currencyId] ?? '0';
$expenses[$currencyId] ??= '0';
$expenses[$currencyId] = bcadd($expenses[$currencyId], $journal['amount'] ?? '0');
$sums[$currencyId] = $sums[$currencyId] ?? '0';
$sums[$currencyId] ??= '0';
$sums[$currencyId] = bcadd($sums[$currencyId], $journal['amount']);
}

View File

@@ -46,7 +46,7 @@ class IntroController extends Controller
public function getIntroSteps(string $route, string $specificPage = null): JsonResponse
{
app('log')->debug(sprintf('getIntroSteps for route "%s" and page "%s"', $route, $specificPage));
$specificPage = $specificPage ?? '';
$specificPage ??= '';
$steps = $this->getBasicSteps($route);
$specificSteps = $this->getSpecificSteps($route, $specificPage);
if (0 === count($specificSteps)) {
@@ -106,7 +106,7 @@ class IntroController extends Controller
*/
public function postEnable(string $route, string $specialPage = null): JsonResponse
{
$specialPage = $specialPage ?? '';
$specialPage ??= '';
$route = str_replace('.', '_', $route);
$key = 'shown_demo_' . $route;
if ('' !== $specialPage) {
@@ -130,7 +130,7 @@ class IntroController extends Controller
*/
public function postFinished(string $route, string $specialPage = null): JsonResponse
{
$specialPage = $specialPage ?? '';
$specialPage ??= '';
$key = 'shown_demo_' . $route;
if ('' !== $specialPage) {
$key .= '_' . $specialPage;

View File

@@ -106,7 +106,7 @@ class IndexController extends Controller
$array = $transformer->transform($piggy);
$groupOrder = (int)$array['object_group_order'];
// make group array if necessary:
$piggyBanks[$groupOrder] = $piggyBanks[$groupOrder] ?? [
$piggyBanks[$groupOrder] ??= [
'object_group_id' => $array['object_group_id'] ?? 0,
'object_group_title' => $array['object_group_title'] ?? trans('firefly.default_group_title_name'),
'piggy_banks' => [],
@@ -154,7 +154,7 @@ class IndexController extends Controller
$groupId = $group['object_group_id'];
foreach ($group['piggy_banks'] as $piggy) {
$currencyId = $piggy['currency_id'];
$sums[$groupId][$currencyId] = $sums[$groupId][$currencyId] ?? [
$sums[$groupId][$currencyId] ??= [
'target' => '0',
'saved' => '0',
'left_to_save' => '0',

View File

@@ -104,7 +104,7 @@ class BalanceController extends Controller
foreach ($journals as $journal) {
$sourceAccount = $journal['source_account_id'];
$currencyId = $journal['currency_id'];
$spent[$sourceAccount] = $spent[$sourceAccount] ?? [
$spent[$sourceAccount] ??= [
'source_account_id' => $sourceAccount,
'currency_id' => $journal['currency_id'],
'currency_code' => $journal['currency_code'],
@@ -116,7 +116,7 @@ class BalanceController extends Controller
$spent[$sourceAccount]['spent'] = bcadd($spent[$sourceAccount]['spent'], $journal['amount']);
// also fix sum:
$report['sums'][$budgetId][$currencyId] = $report['sums'][$budgetId][$currencyId] ?? [
$report['sums'][$budgetId][$currencyId] ??= [
'sum' => '0',
'currency_id' => $journal['currency_id'],
'currency_code' => $journal['currency_code'],

View File

@@ -109,7 +109,7 @@ class BudgetController extends Controller
/** @var Account $account */
foreach ($accounts as $account) {
$accountId = $account->id;
$report[$accountId] = $report[$accountId] ?? [
$report[$accountId] ??= [
'name' => $account->name,
'id' => $account->id,
'iban' => $account->iban,
@@ -120,7 +120,7 @@ class BudgetController extends Controller
// loop expenses.
foreach ($spent as $currency) {
$currencyId = $currency['currency_id'];
$sums[$currencyId] = $sums[$currencyId] ?? [
$sums[$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -130,7 +130,7 @@ class BudgetController extends Controller
foreach ($currency['budgets'] as $budget) {
foreach ($budget['transaction_journals'] as $journal) {
$sourceAccountId = $journal['source_account_id'];
$report[$sourceAccountId]['currencies'][$currencyId] = $report[$sourceAccountId]['currencies'][$currencyId] ?? [
$report[$sourceAccountId]['currencies'][$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -167,7 +167,7 @@ class BudgetController extends Controller
foreach ($budget['transaction_journals'] as $journal) {
$destinationId = $journal['destination_account_id'];
$key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
$result[$key] = $result[$key] ?? [
$result[$key] ??= [
'transactions' => 0,
'sum' => '0',
'avg' => '0',
@@ -219,7 +219,7 @@ class BudgetController extends Controller
/** @var Budget $budget */
foreach ($budgets as $budget) {
$budgetId = $budget->id;
$report[$budgetId] = $report[$budgetId] ?? [
$report[$budgetId] ??= [
'name' => $budget->name,
'id' => $budget->id,
'currencies' => [],
@@ -227,7 +227,7 @@ class BudgetController extends Controller
}
foreach ($spent as $currency) {
$currencyId = $currency['currency_id'];
$sums[$currencyId] = $sums[$currencyId] ?? [
$sums[$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -240,7 +240,7 @@ class BudgetController extends Controller
foreach ($budget['transaction_journals'] as $journal) {
// add currency info to report array:
$report[$budgetId]['currencies'][$currencyId] = $report[$budgetId]['currencies'][$currencyId] ?? [
$report[$budgetId]['currencies'][$currencyId] ??= [
'sum' => '0',
'sum_pct' => '0',
'currency_id' => $currency['currency_id'],
@@ -332,7 +332,7 @@ class BudgetController extends Controller
$count++;
$key = sprintf('%d-%d', $budget['id'], $currency['currency_id']);
$dateKey = $journal['date']->format($keyFormat);
$report[$key] = $report[$key] ?? [
$report[$key] ??= [
'id' => $budget['id'],
'name' => sprintf('%s (%s)', $budget['name'], $currency['currency_name']),
'sum' => '0',
@@ -343,7 +343,7 @@ class BudgetController extends Controller
'currency_decimal_places' => $currency['currency_decimal_places'],
'entries' => [],
];
$report[$key]['entries'][$dateKey] = $report[$key] ['entries'][$dateKey] ?? '0';
$report[$key]['entries'][$dateKey] ??= '0';
$report[$key]['entries'][$dateKey] = bcadd($journal['amount'], $report[$key] ['entries'][$dateKey]);
$report[$key]['sum'] = bcadd($report[$key] ['sum'], $journal['amount']);
$report[$key]['avg'] = bcdiv($report[$key]['sum'], (string)count($periods));

View File

@@ -82,7 +82,7 @@ class CategoryController extends Controller
/** @var Account $account */
foreach ($accounts as $account) {
$accountId = $account->id;
$report[$accountId] = $report[$accountId] ?? [
$report[$accountId] ??= [
'name' => $account->name,
'id' => $account->id,
'iban' => $account->iban,
@@ -98,7 +98,7 @@ class CategoryController extends Controller
foreach ($currency['categories'] as $category) {
foreach ($category['transaction_journals'] as $journal) {
$sourceAccountId = $journal['source_account_id'];
$report[$sourceAccountId]['currencies'][$currencyId] = $report[$sourceAccountId]['currencies'][$currencyId] ?? [
$report[$sourceAccountId]['currencies'][$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -107,9 +107,7 @@ class CategoryController extends Controller
];
$report[$sourceAccountId]['currencies'][$currencyId]['categories'][$category['id']]
= $report[$sourceAccountId]['currencies'][$currencyId]['categories'][$category['id']]
??
[
??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',
@@ -134,8 +132,7 @@ class CategoryController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$destinationId = $journal['destination_account_id'];
$report[$destinationId]['currencies'][$currencyId]
= $report[$destinationId]['currencies'][$currencyId]
?? [
??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -143,9 +140,7 @@ class CategoryController extends Controller
'categories' => [],
];
$report[$destinationId]['currencies'][$currencyId]['categories'][$category['id']]
= $report[$destinationId]['currencies'][$currencyId]['categories'][$category['id']]
??
[
??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',
@@ -182,7 +177,7 @@ class CategoryController extends Controller
/** @var Account $account */
foreach ($accounts as $account) {
$accountId = $account->id;
$report[$accountId] = $report[$accountId] ?? [
$report[$accountId] ??= [
'name' => $account->name,
'id' => $account->id,
'iban' => $account->iban,
@@ -193,7 +188,7 @@ class CategoryController extends Controller
// loop expenses.
foreach ($spent as $currency) {
$currencyId = $currency['currency_id'];
$sums[$currencyId] = $sums[$currencyId] ?? [
$sums[$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -205,7 +200,7 @@ class CategoryController extends Controller
foreach ($currency['categories'] as $category) {
foreach ($category['transaction_journals'] as $journal) {
$sourceAccountId = $journal['source_account_id'];
$report[$sourceAccountId]['currencies'][$currencyId] = $report[$sourceAccountId]['currencies'][$currencyId] ?? [
$report[$sourceAccountId]['currencies'][$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -231,7 +226,7 @@ class CategoryController extends Controller
// loop income.
foreach ($earned as $currency) {
$currencyId = $currency['currency_id'];
$sums[$currencyId] = $sums[$currencyId] ?? [
$sums[$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -243,7 +238,7 @@ class CategoryController extends Controller
foreach ($currency['categories'] as $category) {
foreach ($category['transaction_journals'] as $journal) {
$destinationAccountId = $journal['destination_account_id'];
$report[$destinationAccountId]['currencies'][$currencyId] = $report[$destinationAccountId]['currencies'][$currencyId] ?? [
$report[$destinationAccountId]['currencies'][$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -287,7 +282,7 @@ class CategoryController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$destinationId = $journal['destination_account_id'];
$key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
$result[$key] = $result[$key] ?? [
$result[$key] ??= [
'transactions' => 0,
'sum' => '0',
'avg' => '0',
@@ -340,7 +335,7 @@ class CategoryController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$sourceId = $journal['source_account_id'];
$key = sprintf('%d-%d', $sourceId, $currency['currency_id']);
$result[$key] = $result[$key] ?? [
$result[$key] ??= [
'transactions' => 0,
'sum' => '0',
'avg' => '0',
@@ -392,7 +387,7 @@ class CategoryController extends Controller
/** @var Category $category */
foreach ($categories as $category) {
$categoryId = $category->id;
$report[$categoryId] = $report[$categoryId] ?? [
$report[$categoryId] ??= [
'name' => $category->name,
'id' => $category->id,
'currencies' => [],
@@ -400,7 +395,7 @@ class CategoryController extends Controller
}
foreach ($spent as $currency) {
$currencyId = $currency['currency_id'];
$sums[$currencyId] = $sums[$currencyId] ?? [
$sums[$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -415,7 +410,7 @@ class CategoryController extends Controller
foreach ($category['transaction_journals'] as $journal) {
// add currency info to report array:
$report[$categoryId]['currencies'][$currencyId] = $report[$categoryId]['currencies'][$currencyId] ?? [
$report[$categoryId]['currencies'][$currencyId] ??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',
@@ -441,7 +436,7 @@ class CategoryController extends Controller
foreach ($earned as $currency) {
$currencyId = $currency['currency_id'];
$sums[$currencyId] = $sums[$currencyId] ?? [
$sums[$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -456,7 +451,7 @@ class CategoryController extends Controller
foreach ($category['transaction_journals'] as $journal) {
// add currency info to report array:
$report[$categoryId]['currencies'][$currencyId] = $report[$categoryId]['currencies'][$currencyId] ?? [
$report[$categoryId]['currencies'][$currencyId] ??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',
@@ -523,7 +518,7 @@ class CategoryController extends Controller
foreach ($set as $currencyId => $currencyRow) {
foreach ($currencyRow['categories'] as $categoryId => $categoryRow) {
$key = sprintf('%d-%d', $currencyId, $categoryId);
$data[$key] = $data[$key] ?? [
$data[$key] ??= [
'id' => $categoryRow['id'],
'title' => sprintf('%s (%s)', $categoryRow['name'], $currencyRow['currency_name']),
'currency_id' => $currencyRow['currency_id'],
@@ -537,7 +532,7 @@ class CategoryController extends Controller
];
foreach ($categoryRow['transaction_journals'] as $journal) {
$date = $journal['date']->format($format);
$data[$key]['entries'][$date] = $data[$key]['entries'][$date] ?? '0';
$data[$key]['entries'][$date] ??= '0';
$data[$key]['entries'][$date] = bcadd($data[$key]['entries'][$date], $journal['amount']);
$data[$key]['sum'] = bcadd($data[$key]['sum'], $journal['amount']);
}
@@ -604,7 +599,7 @@ class CategoryController extends Controller
foreach ($set as $currencyId => $currencyRow) {
foreach ($currencyRow['categories'] as $categoryId => $categoryRow) {
$key = sprintf('%d-%d', $currencyId, $categoryId);
$data[$key] = $data[$key] ?? [
$data[$key] ??= [
'id' => $categoryRow['id'],
'title' => sprintf('%s (%s)', $categoryRow['name'], $currencyRow['currency_name']),
'currency_id' => $currencyRow['currency_id'],
@@ -618,7 +613,7 @@ class CategoryController extends Controller
];
foreach ($categoryRow['transaction_journals'] as $journal) {
$date = $journal['date']->format($format);
$data[$key]['entries'][$date] = $data[$key]['entries'][$date] ?? '0';
$data[$key]['entries'][$date] ??= '0';
$data[$key]['entries'][$date] = bcadd($data[$key]['entries'][$date], $journal['amount']);
$data[$key]['sum'] = bcadd($data[$key]['sum'], $journal['amount']);
}

View File

@@ -88,7 +88,7 @@ class DoubleController extends Controller
foreach ($currency['transaction_journals'] as $journal) {
$sourceId = $journal['source_account_id'];
$key = sprintf('%d-%d', $sourceId, $currency['currency_id']);
$result[$key] = $result[$key] ?? [
$result[$key] ??= [
'transactions' => 0,
'sum' => '0',
'avg' => '0',
@@ -141,7 +141,7 @@ class DoubleController extends Controller
foreach ($currency['transaction_journals'] as $journal) {
$destinationId = $journal['destination_account_id'];
$key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
$result[$key] = $result[$key] ?? [
$result[$key] ??= [
'transactions' => 0,
'sum' => '0',
'avg' => '0',
@@ -198,7 +198,7 @@ class DoubleController extends Controller
foreach ($spent as $currency) {
$currencyId = $currency['currency_id'];
$sums[$currencyId] = $sums[$currencyId] ?? [
$sums[$currencyId] ??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',
@@ -216,7 +216,7 @@ class DoubleController extends Controller
$destIban = $journal['destination_account_iban'];
$genericName = $this->getCounterpartName($withCounterpart, $destId, $destName, $destIban);
$objectName = sprintf('%s (%s)', $genericName, $currency['currency_name']);
$report[$objectName] = $report[$objectName] ?? [
$report[$objectName] ??= [
'dest_name' => '',
'dest_iban' => '',
'source_name' => '',
@@ -246,7 +246,7 @@ class DoubleController extends Controller
foreach ($earned as $currency) {
$currencyId = $currency['currency_id'];
$sums[$currencyId] = $sums[$currencyId] ?? [
$sums[$currencyId] ??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',
@@ -264,7 +264,7 @@ class DoubleController extends Controller
$sourceIban = $journal['source_account_iban'];
$genericName = $this->getCounterpartName($withCounterpart, $sourceId, $sourceName, $sourceIban);
$objectName = sprintf('%s (%s)', $genericName, $currency['currency_name']);
$report[$objectName] = $report[$objectName] ?? [
$report[$objectName] ??= [
'dest_name' => '',
'dest_iban' => '',
'source_name' => '',
@@ -342,7 +342,7 @@ class DoubleController extends Controller
foreach ($spent as $currency) {
$currencyId = $currency['currency_id'];
$sums[$currencyId] = $sums[$currencyId] ?? [
$sums[$currencyId] ??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',
@@ -356,7 +356,7 @@ class DoubleController extends Controller
/** @var array $journal */
foreach ($currency['transaction_journals'] as $journal) {
$objectName = sprintf('%s (%s)', $journal['source_account_name'], $currency['currency_name']);
$report[$objectName] = $report[$objectName] ?? [
$report[$objectName] ??= [
'account_id' => $journal['source_account_id'],
'account_name' => $objectName,
'currency_id' => $currency['currency_id'],
@@ -381,7 +381,7 @@ class DoubleController extends Controller
foreach ($earned as $currency) {
$currencyId = $currency['currency_id'];
$sums[$currencyId] = $sums[$currencyId] ?? [
$sums[$currencyId] ??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',
@@ -395,7 +395,7 @@ class DoubleController extends Controller
/** @var array $journal */
foreach ($currency['transaction_journals'] as $journal) {
$objectName = sprintf('%s (%s)', $journal['destination_account_name'], $currency['currency_name']);
$report[$objectName] = $report[$objectName] ?? [
$report[$objectName] ??= [
'account_id' => $journal['destination_account_id'],
'account_name' => $objectName,
'currency_id' => $currency['currency_id'],

View File

@@ -162,7 +162,7 @@ class OperationsController extends Controller
/** @var int $currencyId */
foreach ($keys as $currencyId) {
$currencyInfo = $incomes['sums'][$currencyId] ?? $expenses['sums'][$currencyId];
$sums[$currencyId] = $sums[$currencyId] ?? [
$sums[$currencyId] ??= [
'currency_id' => $currencyId,
'currency_name' => $currencyInfo['currency_name'],
'currency_code' => $currencyInfo['currency_code'],

View File

@@ -75,7 +75,7 @@ class TagController extends Controller
/** @var Account $account */
foreach ($accounts as $account) {
$accountId = $account->id;
$report[$accountId] = $report[$accountId] ?? [
$report[$accountId] ??= [
'name' => $account->name,
'id' => $account->id,
'iban' => $account->iban,
@@ -91,7 +91,7 @@ class TagController extends Controller
foreach ($currency['tags'] as $tag) {
foreach ($tag['transaction_journals'] as $journal) {
$sourceAccountId = $journal['source_account_id'];
$report[$sourceAccountId]['currencies'][$currencyId] = $report[$sourceAccountId]['currencies'][$currencyId] ?? [
$report[$sourceAccountId]['currencies'][$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -100,9 +100,7 @@ class TagController extends Controller
];
$report[$sourceAccountId]['currencies'][$currencyId]['tags'][$tag['id']]
= $report[$sourceAccountId]['currencies'][$currencyId]['tags'][$tag['id']]
??
[
??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',
@@ -127,8 +125,7 @@ class TagController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$destinationId = $journal['destination_account_id'];
$report[$destinationId]['currencies'][$currencyId]
= $report[$destinationId]['currencies'][$currencyId]
?? [
??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -136,9 +133,7 @@ class TagController extends Controller
'tags' => [],
];
$report[$destinationId]['currencies'][$currencyId]['tags'][$tag['id']]
= $report[$destinationId]['currencies'][$currencyId]['tags'][$tag['id']]
??
[
??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',
@@ -175,7 +170,7 @@ class TagController extends Controller
/** @var Account $account */
foreach ($accounts as $account) {
$accountId = $account->id;
$report[$accountId] = $report[$accountId] ?? [
$report[$accountId] ??= [
'name' => $account->name,
'id' => $account->id,
'iban' => $account->iban,
@@ -186,7 +181,7 @@ class TagController extends Controller
// loop expenses.
foreach ($spent as $currency) {
$currencyId = $currency['currency_id'];
$sums[$currencyId] = $sums[$currencyId] ?? [
$sums[$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -198,7 +193,7 @@ class TagController extends Controller
foreach ($currency['tags'] as $tag) {
foreach ($tag['transaction_journals'] as $journal) {
$sourceAccountId = $journal['source_account_id'];
$report[$sourceAccountId]['currencies'][$currencyId] = $report[$sourceAccountId]['currencies'][$currencyId] ?? [
$report[$sourceAccountId]['currencies'][$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -224,7 +219,7 @@ class TagController extends Controller
// loop income.
foreach ($earned as $currency) {
$currencyId = $currency['currency_id'];
$sums[$currencyId] = $sums[$currencyId] ?? [
$sums[$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -236,7 +231,7 @@ class TagController extends Controller
foreach ($currency['tags'] as $tag) {
foreach ($tag['transaction_journals'] as $journal) {
$destinationAccountId = $journal['destination_account_id'];
$report[$destinationAccountId]['currencies'][$currencyId] = $report[$destinationAccountId]['currencies'][$currencyId] ?? [
$report[$destinationAccountId]['currencies'][$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -280,7 +275,7 @@ class TagController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$destinationId = $journal['destination_account_id'];
$key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
$result[$key] = $result[$key] ?? [
$result[$key] ??= [
'transactions' => 0,
'sum' => '0',
'avg' => '0',
@@ -333,7 +328,7 @@ class TagController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$sourceId = $journal['source_account_id'];
$key = sprintf('%d-%d', $sourceId, $currency['currency_id']);
$result[$key] = $result[$key] ?? [
$result[$key] ??= [
'transactions' => 0,
'sum' => '0',
'avg' => '0',
@@ -385,7 +380,7 @@ class TagController extends Controller
/** @var Tag $tag */
foreach ($tags as $tag) {
$tagId = $tag->id;
$report[$tagId] = $report[$tagId] ?? [
$report[$tagId] ??= [
'name' => $tag->tag,
'id' => $tag->id,
'currencies' => [],
@@ -393,7 +388,7 @@ class TagController extends Controller
}
foreach ($spent as $currency) {
$currencyId = $currency['currency_id'];
$sums[$currencyId] = $sums[$currencyId] ?? [
$sums[$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -408,7 +403,7 @@ class TagController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
// add currency info to report array:
$report[$tagId]['currencies'][$currencyId] = $report[$tagId]['currencies'][$currencyId] ?? [
$report[$tagId]['currencies'][$currencyId] ??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',
@@ -434,7 +429,7 @@ class TagController extends Controller
foreach ($earned as $currency) {
$currencyId = $currency['currency_id'];
$sums[$currencyId] = $sums[$currencyId] ?? [
$sums[$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -449,7 +444,7 @@ class TagController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
// add currency info to report array:
$report[$tagId]['currencies'][$currencyId] = $report[$tagId]['currencies'][$currencyId] ?? [
$report[$tagId]['currencies'][$currencyId] ??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',

View File

@@ -49,6 +49,7 @@ use Psr\Container\NotFoundExceptionInterface;
class ReportController extends Controller
{
use RenderPartialViews;
protected ReportHelperInterface $helper;
private BudgetRepositoryInterface $repository;

View File

@@ -100,7 +100,7 @@ class CreateController extends Controller
session()->flash('warning', trans('firefly.rule_from_search_words', ['string' => $words]));
$operators[] = [
'type' => 'description_contains',
'value' => $words
'value' => $words,
];
}
$oldTriggers = $this->parseFromOperators($operators);

View File

@@ -243,8 +243,8 @@ class TagController extends Controller
$subTitleIcon = 'fa-tag';
$page = (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
$start = $start ?? session('start');
$end = $end ?? session('end');
$start ??= session('start');
$end ??= session('end');
$location = $this->repository->getLocation($tag);
$attachments = $this->repository->getAttachments($tag);
$subTitle = trans(
@@ -257,7 +257,7 @@ class TagController extends Controller
);
$startPeriod = $this->repository->firstUseDate($tag);
$startPeriod = $startPeriod ?? today(config('app.timezone'));
$startPeriod ??= today(config('app.timezone'));
$endPeriod = clone $end;
$periods = $this->getTagPeriodOverview($tag, $startPeriod, $endPeriod);
$path = route('tags.show', [$tag->id, $start->format('Y-m-d'), $end->format('Y-m-d')]);

View File

@@ -32,7 +32,6 @@ use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface
use FireflyIII\Transformers\TransactionGroupTransformer;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
use Symfony\Component\HttpFoundation\ParameterBag;

View File

@@ -26,7 +26,6 @@ namespace FireflyIII\Http\Controllers\Webhooks;
use FireflyIII\Http\Controllers\Controller;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\Request;
use Illuminate\View\View;
/**

View File

@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Jobs;
use Exception;
use FireflyIII\Exceptions\FireflyException;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Message;
use Illuminate\Queue\InteractsWithQueue;
@@ -90,7 +89,7 @@ class MailError extends Job implements ShouldQueue
}
}
);
} catch (Exception | TransportException $e) { /** @phpstan-ignore-line */
} catch (Exception | TransportException $e) { // @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not email or log the error. Please validate your email settings, use the .env.example file as a guide.');

View File

@@ -40,9 +40,7 @@ class AccessTokenCreatedMail extends Mailable
/**
* AccessTokenCreatedMail constructor.
*/
public function __construct()
{
}
public function __construct() {}
/**
* Build the message.

View File

@@ -44,9 +44,7 @@ class AdminTestMail extends Mailable
/**
* AdminTestMail constructor.
*/
public function __construct()
{
}
public function __construct() {}
/**
* Build the message.

View File

@@ -292,22 +292,9 @@ class Account extends Model
}
/**
* Get the virtual balance
*
* @return Attribute
*/
protected function virtualBalance(): Attribute
{
return Attribute::make(
get: static fn($value) => (string)$value,
);
}
/**
* Get the user ID
*
* @return Attribute
*/
protected function accountTypeId(): Attribute
protected function accountId(): Attribute
{
return Attribute::make(
get: static fn($value) => (int)$value,
@@ -315,9 +302,11 @@ class Account extends Model
}
/**
* Get the user ID
*
* @return Attribute
*/
protected function accountId(): Attribute
protected function accountTypeId(): Attribute
{
return Attribute::make(
get: static fn($value) => (int)$value,
@@ -334,4 +323,16 @@ class Account extends Model
);
}
/**
* Get the virtual balance
*
* @return Attribute
*/
protected function virtualBalance(): Attribute
{
return Attribute::make(
get: static fn($value) => (string)$value,
);
}
}

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Casts\Attribute;
@@ -31,7 +32,6 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
use Carbon\Carbon;
/**
* FireflyIII\Models\AutoBudget

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
@@ -32,7 +33,6 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
use Carbon\Carbon;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
@@ -134,6 +134,7 @@ class AvailableBudget extends Model
get: static fn($value) => (string)$value,
);
}
/**
* @return Attribute
*/

View File

@@ -246,18 +246,6 @@ class Bill extends Model
);
}
/**
* Get the skip
*
* @return Attribute
*/
protected function skip(): Attribute
{
return Attribute::make(
get: static fn ($value) => (int)$value,
);
}
/**
* Get the min amount
*
@@ -273,7 +261,19 @@ class Bill extends Model
/**
* @return Attribute
*/
protected function transactionCurrencyId(): Attribute
protected function order(): Attribute
{
return Attribute::make(
get: static fn($value) => (int)$value,
);
}
/**
* Get the skip
*
* @return Attribute
*/
protected function skip(): Attribute
{
return Attribute::make(
get: static fn($value) => (int)$value,
@@ -283,7 +283,7 @@ class Bill extends Model
/**
* @return Attribute
*/
protected function order(): Attribute
protected function transactionCurrencyId(): Attribute
{
return Attribute::make(
get: static fn($value) => (int)$value,

View File

@@ -181,6 +181,7 @@ class Budget extends Model
{
return $this->belongsToMany(Transaction::class, 'budget_transaction', 'budget_id');
}
/**
* @return Attribute
*/

View File

@@ -25,6 +25,7 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Collection;
@@ -35,7 +36,7 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
/**
* FireflyIII\Models\Category
*

View File

@@ -25,10 +25,11 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
/**
* FireflyIII\Models\Configuration
*

View File

@@ -22,8 +22,10 @@
declare(strict_types=1);
namespace FireflyIII\Models;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Builder;
@@ -31,7 +33,6 @@ use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Carbon\Carbon;
/**
* Class CurrencyExchangeRate
@@ -111,26 +112,6 @@ class CurrencyExchangeRate extends Model
return $this->belongsTo(User::class);
}
/**
* @return Attribute
*/
protected function rate(): Attribute
{
return Attribute::make(
get: static fn ($value) => (string)$value,
);
}
/**
* @return Attribute
*/
protected function userRate(): Attribute
{
return Attribute::make(
get: static fn ($value) => (string)$value,
);
}
/**
* @return Attribute
*/
@@ -141,6 +122,16 @@ class CurrencyExchangeRate extends Model
);
}
/**
* @return Attribute
*/
protected function rate(): Attribute
{
return Attribute::make(
get: static fn($value) => (string)$value,
);
}
/**
* @return Attribute
*/
@@ -151,5 +142,15 @@ class CurrencyExchangeRate extends Model
);
}
/**
* @return Attribute
*/
protected function userRate(): Attribute
{
return Attribute::make(
get: static fn($value) => (string)$value,
);
}
}

View File

@@ -26,13 +26,14 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
/**
* Class GroupMembership
*

View File

@@ -26,13 +26,14 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
/**
* Class InvitedUser
*

View File

@@ -25,13 +25,14 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
/**
* FireflyIII\Models\LinkType
*

View File

@@ -26,13 +26,14 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
/**
* FireflyIII\Models\Location
*

View File

@@ -25,12 +25,13 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
/**
* FireflyIII\Models\Note
*

View File

@@ -26,6 +26,7 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Builder;
@@ -35,7 +36,7 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphToMany;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
/**
* FireflyIII\Models\ObjectGroup
*

View File

@@ -23,7 +23,9 @@ declare(strict_types=1);
namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
@@ -33,9 +35,8 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\Relations\MorphToMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
use Carbon\Carbon;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
/**
* FireflyIII\Models\PiggyBank
*
@@ -182,18 +183,6 @@ class PiggyBank extends Model
$this->attributes['targetamount'] = (string)$value;
}
/**
* Get the max amount
*
* @return Attribute
*/
protected function targetamount(): Attribute
{
return Attribute::make(
get: static fn ($value) => (string)$value,
);
}
/**
* @return Attribute
*/
@@ -214,4 +203,16 @@ class PiggyBank extends Model
);
}
/**
* Get the max amount
*
* @return Attribute
*/
protected function targetamount(): Attribute
{
return Attribute::make(
get: static fn($value) => (string)$value,
);
}
}

View File

@@ -23,13 +23,14 @@ declare(strict_types=1);
namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Carbon\Carbon;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
/**
* FireflyIII\Models\PiggyBankEvent
*

View File

@@ -25,11 +25,12 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
/**
* FireflyIII\Models\PiggyBankRepetition
*

View File

@@ -25,13 +25,14 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
/**
* FireflyIII\Models\Preference
*

View File

@@ -25,6 +25,7 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Casts\Attribute;
@@ -36,7 +37,7 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
/**
* FireflyIII\Models\Recurrence
*

View File

@@ -25,12 +25,13 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
/**
* FireflyIII\Models\RecurrenceMeta
*

Some files were not shown because too many files have changed in this diff Show More