Skip to content

Firefly III: a personal finances manager

Fix tests.

James Coleea2c48bca52d
diff --git a/app/Http/Controllers/Chart/AccountController.php b/app/Http/Controllers/Chart/AccountController.php
index b326c9272e..10923b03a5 100644
--- a/app/Http/Controllers/Chart/AccountController.php
+++ b/app/Http/Controllers/Chart/AccountController.php
@@ -467,10 +467,14 @@ class AccountController extends Controller
/** @var CurrencyRepositoryInterface $repository */
$repository = app(CurrencyRepositoryInterface::class);
- $default = app('amount')->getDefaultCurrency();
- $chartData = [];
+ /** @var AccountRepositoryInterface $accountRepos */
+ $accountRepos = app(AccountRepositoryInterface::class);
+
+ $default = app('amount')->getDefaultCurrency();
+ $chartData = [];
+ /** @var Account $account */
foreach ($accounts as $account) {
- $currency = $repository->findNull((int)$account->getMeta('currency_id'));
+ $currency = $repository->findNull((int)$accountRepos->getMetaValue($account, 'currency_id'));
if (null === $currency) {
$currency = $default;
}
diff --git a/app/Models/Bill.php b/app/Models/Bill.php
index 3560800ec6..99a30828e5 100644
--- a/app/Models/Bill.php
+++ b/app/Models/Bill.php
@@ -139,10 +139,10 @@ class Bill extends Model
*
* @param $value
*
- * @return string
+ * @return string|null
* @throws \Illuminate\Contracts\Encryption\DecryptException
*/
- public function getNameAttribute($value): string
+ public function getNameAttribute($value): ?string
{
if (1 === (int)$this->name_encrypted) {
return Crypt::decrypt($value);
diff --git a/app/Models/Budget.php b/app/Models/Budget.php
index b6c29ae3ed..6838945741 100644
--- a/app/Models/Budget.php
+++ b/app/Models/Budget.php
@@ -96,10 +96,10 @@ class Budget extends Model
*
* @param $value
*
- * @return string
+ * @return string|null
* @throws \Illuminate\Contracts\Encryption\DecryptException
*/
- public function getNameAttribute($value): string
+ public function getNameAttribute($value): ?string
{
if ($this->encrypted) {
return Crypt::decrypt($value);
diff --git a/app/Models/Category.php b/app/Models/Category.php
index a9cdb27bce..b8ea97894d 100644
--- a/app/Models/Category.php
+++ b/app/Models/Category.php
@@ -85,10 +85,10 @@ class Category extends Model
*
* @param $value
*
- * @return string
+ * @return string|null
* @throws \Illuminate\Contracts\Encryption\DecryptException
*/
- public function getNameAttribute($value): string
+ public function getNameAttribute($value): ?string
{
if ($this->encrypted) {
return Crypt::decrypt($value);
diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php
index 9a07f79175..d6779aef84 100644
--- a/app/Models/PiggyBank.php
+++ b/app/Models/PiggyBank.php
@@ -107,10 +107,10 @@ class PiggyBank extends Model
*
* @param $value
*
- * @return string
+ * @return string|null
* @throws \Illuminate\Contracts\Encryption\DecryptException
*/
- public function getNameAttribute($value): string
+ public function getNameAttribute($value): ?string
{
if ($this->encrypted) {
return Crypt::decrypt($value);
diff --git a/app/Models/Tag.php b/app/Models/Tag.php
index ef97718a6e..2d2ddc7758 100644
--- a/app/Models/Tag.php
+++ b/app/Models/Tag.php
@@ -85,10 +85,10 @@ class Tag extends Model
*
* @param $value
*
- * @return string
+ * @return string|null
* @throws \Illuminate\Contracts\Encryption\DecryptException
*/
- public function getDescriptionAttribute($value): string
+ public function getDescriptionAttribute($value): ?string
{
if (null === $value) {
return $value;
diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php
index 2501343b4d..7a6a1e1ada 100644
--- a/app/Models/TransactionJournal.php
+++ b/app/Models/TransactionJournal.php
@@ -153,10 +153,10 @@ class TransactionJournal extends Model
*
* @param $value
*
- * @return string
+ * @return string|null
* @throws \Illuminate\Contracts\Encryption\DecryptException
*/
- public function getDescriptionAttribute($value): string
+ public function getDescriptionAttribute($value): ?string
{
if ($this->encrypted) {
return Crypt::decrypt($value);
diff --git a/app/Rules/IsAssetAccountId.php b/app/Rules/IsAssetAccountId.php
index 7ffa717037..b072784b0b 100644
--- a/app/Rules/IsAssetAccountId.php
+++ b/app/Rules/IsAssetAccountId.php
@@ -1,6 +1,6 @@
<?php
-namespace FireflyIII\Rules;
+namespace FireflyIII\TransactionRules\Triggers;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;