Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Code cleanup
James Colefa7ab45a40be
diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.phpindex af5391c1fd..49b6da7e3f 100644--- a/app/Repositories/Tag/TagRepository.php+++ b/app/Repositories/Tag/TagRepository.php@@ -75,7 +75,7 @@ class TagRepository implements TagRepositoryInterface** @return bool*- * @throws \Exception+*/public function destroy(Tag $tag): bool{@@ -98,9 +98,8 @@ class TagRepository implements TagRepositoryInterface$collector->setUser($this->user);$collector->setRange($start, $end)->setTypes([TransactionType::DEPOSIT])->setAllAssetAccounts()->setTag($tag);$set = $collector->getJournals();- $sum = strval($set->sum('transaction_amount'));- return $sum;+ return strval($set->sum('transaction_amount'));}/**@@ -222,9 +221,8 @@ class TagRepository implements TagRepositoryInterface$collector->setUser($this->user);$collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setAllAssetAccounts()->setTag($tag);$set = $collector->getJournals();- $sum = strval($set->sum('transaction_amount'));- return $sum;+ return strval($set->sum('transaction_amount'));}/**@@ -268,10 +266,10 @@ class TagRepository implements TagRepositoryInterface$journals = $collector->getJournals();$sum = '0';foreach ($journals as $journal) {- $sum = bcadd($sum, app('steam')->positive(strval($journal->transaction_amount)));+ $sum = bcadd($sum, app('steam')->positive((string)$journal->transaction_amount));}- return strval($sum);+ return (string)$sum;}/**@@ -301,7 +299,7 @@ class TagRepository implements TagRepositoryInterface];foreach ($journals as $journal) {- $amount = app('steam')->positive(strval($journal->transaction_amount));+ $amount = app('steam')->positive((string)$journal->transaction_amount);$type = $journal->transaction_type_type;if (TransactionType::WITHDRAWAL === $type) {$amount = bcmul($amount, '-1');@@ -350,7 +348,7 @@ class TagRepository implements TagRepositoryInterface$tagsWithAmounts = [];/** @var Tag $tag */foreach ($set as $tag) {- $tagsWithAmounts[$tag->id] = strval($tag->amount_sum);+ $tagsWithAmounts[$tag->id] = (string)$tag->amount_sum;}$tags = $allTags->orderBy('tags.id', 'desc')->get(['tags.id', 'tags.tag']);@@ -431,8 +429,8 @@ class TagRepository implements TagRepositoryInterface$step = 1;}- $extra = $step / $amount;- $result = (int)($range[0] + $extra);- return $result;+ $extra = $step / $amount;++ return (int)($range[0] + $extra);}}diff --git a/app/Repositories/User/UserRepository.php b/app/Repositories/User/UserRepository.phpindex 4a3d865606..a18e4617ae 100644--- a/app/Repositories/User/UserRepository.php+++ b/app/Repositories/User/UserRepository.php@@ -77,8 +77,8 @@ class UserRepository implements UserRepositoryInterfacePreferences::setForUser($user, 'previous_email_' . date('Y-m-d-H-i-s'), $oldEmail);// set undo and confirm token:- Preferences::setForUser($user, 'email_change_undo_token', strval(bin2hex(random_bytes(16))));- Preferences::setForUser($user, 'email_change_confirm_token', strval(bin2hex(random_bytes(16))));+ Preferences::setForUser($user, 'email_change_undo_token', (string)bin2hex(random_bytes(16)));+ Preferences::setForUser($user, 'email_change_confirm_token', (string)bin2hex(random_bytes(16)));// update user$user->email = $newEmail;@@ -145,7 +145,7 @@ class UserRepository implements UserRepositoryInterface** @return bool*- * @throws \Exception+*/public function destroy(User $user): bool{@@ -231,7 +231,7 @@ class UserRepository implements UserRepositoryInterface}$return['is_admin'] = $user->hasRole('owner');- $return['blocked'] = 1 === intval($user->blocked);+ $return['blocked'] = 1 === (int)$user->blocked;$return['blocked_code'] = $user->blocked_code;$return['accounts'] = $user->accounts()->count();$return['journals'] = $user->transactionJournals()->count();diff --git a/app/Repositories/User/UserRepositoryInterface.php b/app/Repositories/User/UserRepositoryInterface.phpindex 3582dc509e..8839c738d2 100644--- a/app/Repositories/User/UserRepositoryInterface.php+++ b/app/Repositories/User/UserRepositoryInterface.php@@ -103,23 +103,25 @@ interface UserRepositoryInterface/*** @param int $userId+ ** @deprecated* @return User*/public function find(int $userId): User;/**- * @param int $userId+ * @param string $email+ ** @return User|null*/- public function findNull(int $userId): ?User;+ public function findByEmail(string $email): ?User;/**- * @param string $email+ * @param int $userId** @return User|null*/- public function findByEmail(string $email): ?User;+ public function findNull(int $userId): ?User;/*** Returns the first user in the DB. Generally only works when there is just one.diff --git a/app/Rules/BelongsUser.php b/app/Rules/BelongsUser.phpindex 1607a29bf0..facf3c0b98 100644--- a/app/Rules/BelongsUser.php+++ b/app/Rules/BelongsUser.php@@ -72,11 +72,11 @@ class BelongsUser implements Ruleif (!auth()->check()) {return true; // @codeCoverageIgnore}- $attribute = strval($attribute);+ $attribute = (string)$attribute;switch ($attribute) {case 'piggy_bank_id':$count = PiggyBank::leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')- ->where('piggy_banks.id', '=', intval($value))+ ->where('piggy_banks.id', '=', (int)$value)->where('accounts.user_id', '=', auth()->user()->id)->count();return $count === 1;@@ -87,7 +87,7 @@ class BelongsUser implements Rulereturn $count === 1;break;case 'bill_id':- $count = Bill::where('id', '=', intval($value))->where('user_id', '=', auth()->user()->id)->count();+ $count = Bill::where('id', '=', (int)$value)->where('user_id', '=', auth()->user()->id)->count();return $count === 1;case 'bill_name':@@ -96,12 +96,12 @@ class BelongsUser implements Rulereturn $count === 1;break;case 'budget_id':- $count = Budget::where('id', '=', intval($value))->where('user_id', '=', auth()->user()->id)->count();+ $count = Budget::where('id', '=', (int)$value)->where('user_id', '=', auth()->user()->id)->count();return $count === 1;break;case 'category_id':- $count = Category::where('id', '=', intval($value))->where('user_id', '=', auth()->user()->id)->count();+ $count = Category::where('id', '=', (int)$value)->where('user_id', '=', auth()->user()->id)->count();return $count === 1;break;@@ -112,7 +112,7 @@ class BelongsUser implements Rulebreak;case 'source_id':case 'destination_id':- $count = Account::where('id', '=', intval($value))->where('user_id', '=', auth()->user()->id)->count();+ $count = Account::where('id', '=', (int)$value)->where('user_id', '=', auth()->user()->id)->count();return $count === 1;break;@@ -143,7 +143,7 @@ class BelongsUser implements Rule}$count = 0;foreach ($objects as $object) {- if (trim(strval($object->$field)) === trim($value)) {+ if (trim((string)$object->$field) === trim($value)) {$count++;}}diff --git a/app/Rules/UniqueIban.php b/app/Rules/UniqueIban.phpindex 8cd5312b80..5af463b6b4 100644--- a/app/Rules/UniqueIban.php+++ b/app/Rules/UniqueIban.php@@ -76,7 +76,7 @@ class UniqueIban implements Ruleif (!auth()->check()) {return true; // @codeCoverageIgnore}- if (is_null($this->expectedType)) {+ if (null === $this->expectedType) {return true;}$maxCounts = [@@ -114,7 +114,7 @@ class UniqueIban implements Rule->accounts()->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')->where('account_types.type', $type);- if (!is_null($this->account)) {+ if (null !== $this->account) {$query->where('accounts.id', '!=', $this->account->id);}$result = $query->get(['accounts.*']);diff --git a/app/Services/Bunq/Id/BunqId.php b/app/Services/Bunq/Id/BunqId.phpindex 02c263cf23..8c62a3d29a 100644--- a/app/Services/Bunq/Id/BunqId.php+++ b/app/Services/Bunq/Id/BunqId.php@@ -38,7 +38,7 @@ class BunqId*/public function __construct($data = null){- if (!is_null($data)) {+ if (null !== $data) {$this->id = $data['id'];}}diff --git a/app/Services/Bunq/Id/DeviceSessionId.php b/app/Services/Bunq/Id/DeviceSessionId.phpindex 7ac7d73ed1..91c5233870 100644--- a/app/Services/Bunq/Id/DeviceSessionId.php+++ b/app/Services/Bunq/Id/DeviceSessionId.php@@ -27,13 +27,4 @@ namespace FireflyIII\Services\Bunq\Id;*/class DeviceSessionId extends BunqId{- /**- * DeviceSessionId constructor.- *- * @param null $data- */- public function __construct($data = null)- {- parent::__construct($data);- }}diff --git a/app/Services/Bunq/Object/Alias.php b/app/Services/Bunq/Object/Alias.phpindex a0d3877f06..bb3f971a5a 100644--- a/app/Services/Bunq/Object/Alias.php+++ b/app/Services/Bunq/Object/Alias.php@@ -28,11 +28,11 @@ namespace FireflyIII\Services\Bunq\Object;class Alias extends BunqObject{/** @var string */- private $name = '';+ private $name;/** @var string */- private $type = '';+ private $type;/** @var string */- private $value = '';+ private $value;/*** Alias constructor.diff --git a/app/Services/Bunq/Object/Amount.php b/app/Services/Bunq/Object/Amount.phpindex f142424d8f..64da7a7416 100644--- a/app/Services/Bunq/Object/Amount.php+++ b/app/Services/Bunq/Object/Amount.php@@ -28,9 +28,9 @@ namespace FireflyIII\Services\Bunq\Object;class Amount extends BunqObject{/** @var string */- private $currency = '';+ private $currency;/** @var string */- private $value = '';+ private $value;/*** Amount constructor.diff --git a/app/Services/Bunq/Object/DeviceServer.php b/app/Services/Bunq/Object/DeviceServer.phpindex 64bf9dced0..77dd6a02ef 100644--- a/app/Services/Bunq/Object/DeviceServer.php+++ b/app/Services/Bunq/Object/DeviceServer.php@@ -48,7 +48,6 @@ class DeviceServer extends BunqObject** @param array $data*- * @throws \InvalidArgumentException*/public function __construct(array $data){diff --git a/app/Services/Bunq/Object/LabelMonetaryAccount.php b/app/Services/Bunq/Object/LabelMonetaryAccount.phpindex a8023dbd7c..c652f959df 100644--- a/app/Services/Bunq/Object/LabelMonetaryAccount.php+++ b/app/Services/Bunq/Object/LabelMonetaryAccount.php@@ -40,15 +40,6 @@ class LabelMonetaryAccount extends BunqObject/** @var LabelUser */private $labelUser;- /**- * @return LabelUser- */- public function getLabelUser(): LabelUser- {- return $this->labelUser;- }--/*** LabelMonetaryAccount constructor.*@@ -71,6 +62,14 @@ class LabelMonetaryAccount extends BunqObjectreturn $this->iban;}+ /**+ * @return LabelUser+ */+ public function getLabelUser(): LabelUser+ {+ return $this->labelUser;+ }+/*** @return array*/diff --git a/app/Services/Bunq/Object/LabelUser.php b/app/Services/Bunq/Object/LabelUser.phpindex c3eaacc5d9..2d940851c7 100644--- a/app/Services/Bunq/Object/LabelUser.php+++ b/app/Services/Bunq/Object/LabelUser.php@@ -40,6 +40,20 @@ class LabelUser extends BunqObject/** @var string */private $uuid;+ /**+ * LabelUser constructor.+ *+ * @param array $data+ */+ public function __construct(array $data)+ {+ $this->uuid = $data['uuid'];+ $this->displayName = $data['display_name'];+ $this->country = $data['country'];+ $this->publicNickName = $data['public_nick_name'];+ $this->avatar = new Avatar($data['avatar']);+ }+/*** @return Avatar*/@@ -64,22 +78,6 @@ class LabelUser extends BunqObjectreturn $this->publicNickName;}--- /**- * LabelUser constructor.- *- * @param array $data- */- public function __construct(array $data)- {- $this->uuid = $data['uuid'];- $this->displayName = $data['display_name'];- $this->country = $data['country'];- $this->publicNickName = $data['public_nick_name'];- $this->avatar = new Avatar($data['avatar']);- }-/*** @return array*/diff --git a/app/Services/Bunq/Object/MonetaryAccountBank.php b/app/Services/Bunq/Object/MonetaryAccountBank.phpindex 2d0fddef6b..f38e88a53f 100644--- a/app/Services/Bunq/Object/MonetaryAccountBank.php+++ b/app/Services/Bunq/Object/MonetaryAccountBank.php@@ -38,15 +38,15 @@ class MonetaryAccountBank extends BunqObject/** @var Carbon */private $created;/** @var string */- private $currency = '';+ private $currency;/** @var Amount */private $dailyLimit;/** @var Amount */private $dailySpent;/** @var string */- private $description = '';+ private $description;/** @var int */- private $id = 0;+ private $id;/** @var MonetaryAccountProfile */private $monetaryAccountProfile;/** @var array */@@ -54,28 +54,27 @@ class MonetaryAccountBank extends BunqObject/** @var Amount */private $overdraftLimit;/** @var string */- private $publicUuid = '';+ private $publicUuid;/** @var string */- private $reason = '';+ private $reason;/** @var string */- private $reasonDescription = '';+ private $reasonDescription;/** @var MonetaryAccountSetting */private $setting;/** @var string */- private $status = '';+ private $status;/** @var string */- private $subStatus = '';+ private $subStatus;/** @var Carbon */private $updated;/** @var int */- private $userId = 0;+ private $userId;/*** MonetaryAccountBank constructor.** @param array $data*- * @throws \InvalidArgumentException*/public function __construct(array $data){@@ -106,8 +105,6 @@ class MonetaryAccountBank extends BunqObjectforeach ($data['notification_filters'] as $filter) {$this->notificationFilters[] = new NotificationFilter($filter);}-- return;}/**diff --git a/app/Services/Bunq/Object/MonetaryAccountProfile.php b/app/Services/Bunq/Object/MonetaryAccountProfile.phpindex c51223671b..93d3dd5c2f 100644--- a/app/Services/Bunq/Object/MonetaryAccountProfile.php+++ b/app/Services/Bunq/Object/MonetaryAccountProfile.php@@ -28,7 +28,7 @@ namespace FireflyIII\Services\Bunq\Object;class MonetaryAccountProfile extends BunqObject{/** @var string */- private $profileActionRequired = '';+ private $profileActionRequired;/** @var Amount */private $profileAmountRequired;/**diff --git a/app/Services/Bunq/Object/MonetaryAccountSetting.php b/app/Services/Bunq/Object/MonetaryAccountSetting.phpindex 2fb81df801..449113b80c 100644--- a/app/Services/Bunq/Object/MonetaryAccountSetting.php+++ b/app/Services/Bunq/Object/MonetaryAccountSetting.php@@ -28,11 +28,11 @@ namespace FireflyIII\Services\Bunq\Object;class MonetaryAccountSetting extends BunqObject{/** @var string */- private $color = '';+ private $color;/** @var string */- private $defaultAvatarStatus = '';+ private $defaultAvatarStatus;/** @var string */- private $restrictionChat = '';+ private $restrictionChat;/*** MonetaryAccountSetting constructor.diff --git a/app/Services/Bunq/Object/NotificationFilter.php b/app/Services/Bunq/Object/NotificationFilter.phpindex b61dbf0664..f6fe9bd3a1 100644--- a/app/Services/Bunq/Object/NotificationFilter.php+++ b/app/Services/Bunq/Object/NotificationFilter.php@@ -34,7 +34,7 @@ class NotificationFilter extends BunqObject*/public function __construct(array $data){- unset($data);+}/**diff --git a/app/Services/Bunq/Object/Payment.php b/app/Services/Bunq/Object/Payment.phpindex a5e1763ed2..2e063897d0 100644--- a/app/Services/Bunq/Object/Payment.php+++ b/app/Services/Bunq/Object/Payment.php@@ -61,7 +61,6 @@ class Payment extends BunqObject** @param array $data*- * @throws \InvalidArgumentException*/public function __construct(array $data){diff --git a/app/Services/Bunq/Object/ServerPublicKey.php b/app/Services/Bunq/Object/ServerPublicKey.phpindex 0a89187145..a5fa808392 100644--- a/app/Services/Bunq/Object/ServerPublicKey.php+++ b/app/Services/Bunq/Object/ServerPublicKey.php@@ -28,7 +28,7 @@ namespace FireflyIII\Services\Bunq\Object;class ServerPublicKey extends BunqObject{/** @var string */- private $publicKey = '';+ private $publicKey;/*** ServerPublicKey constructor.diff --git a/app/Services/Bunq/Object/UserCompany.php b/app/Services/Bunq/Object/UserCompany.phpindex fee6c445be..1ed89f6faa 100644--- a/app/Services/Bunq/Object/UserCompany.php+++ b/app/Services/Bunq/Object/UserCompany.php@@ -44,9 +44,9 @@ class UserCompany extends BunqObject*/private $avatar;/** @var string */- private $cocNumber = '';+ private $cocNumber;/** @var string */- private $counterBankIban = '';+ private $counterBankIban;/** @var Carbon */private $created;/**@@ -58,48 +58,47 @@ class UserCompany extends BunqObject*/private $directorAlias;/** @var string */- private $displayName = '';+ private $displayName;/** @var int */- private $id = 0;+ private $id;/** @var string */- private $language = '';+ private $language;/** @var string */- private $name = '';+ private $name;/** @var array */private $notificationFilters = [];/** @var string */- private $publicNickName = '';+ private $publicNickName;/** @var string */- private $publicUuid = '';+ private $publicUuid;/** @var string */- private $region = '';+ private $region;/** @var string */- private $sectorOfIndustry = '';+ private $sectorOfIndustry;/** @var int */- private $sessionTimeout = 0;+ private $sessionTimeout;/** @var string */- private $status = '';+ private $status;/** @var string */- private $subStatus = '';+ private $subStatus;/** @var string */- private $typeOfBusinessEntity = '';+ private $typeOfBusinessEntity;/** @var array */private $ubos = [];/** @var Carbon */private $updated;/** @var int */- private $versionTos = 0;+ private $versionTos;/*** UserCompany constructor.** @param array $data*- * @throws \InvalidArgumentException*/public function __construct(array $data){- $this->id = intval($data['id']);+ $this->id = (int)$data['id'];$this->created = Carbon::createFromFormat('Y-m-d H:i:s.u', $data['created']);$this->updated = Carbon::createFromFormat('Y-m-d H:i:s.u', $data['updated']);$this->status = $data['status'];@@ -109,8 +108,8 @@ class UserCompany extends BunqObject$this->publicNickName = $data['public_nick_name'];$this->language = $data['language'];$this->region = $data['region'];- $this->sessionTimeout = intval($data['session_timeout']);- $this->versionTos = intval($data['version_terms_of_service']);+ $this->sessionTimeout = (int)$data['session_timeout'];+ $this->versionTos = (int)$data['version_terms_of_service'];$this->cocNumber = $data['chamber_of_commerce_number'];$this->typeOfBusinessEntity = $data['type_of_business_entity'] ?? '';$this->sectorOfIndustry = $data['sector_of_industry'] ?? '';diff --git a/app/Services/Bunq/Object/UserLight.php b/app/Services/Bunq/Object/UserLight.phpindex e6ff84b504..3576c94d31 100644--- a/app/Services/Bunq/Object/UserLight.php+++ b/app/Services/Bunq/Object/UserLight.php@@ -34,21 +34,21 @@ class UserLight extends BunqObject/** @var Carbon */private $created;/** @var string */- private $displayName = '';+ private $displayName;/** @var string */- private $firstName = '';+ private $firstName;/** @var int */- private $id = 0;+ private $id;/** @var string */- private $lastName = '';+ private $lastName;/** @var string */- private $legalName = '';+ private $legalName;/** @var string */- private $middleName = '';+ private $middleName;/** @var string */- private $publicNickName = '';+ private $publicNickName;/** @var string */- private $publicUuid = '';+ private $publicUuid;/** @var Carbon */private $updated;@@ -57,14 +57,13 @@ class UserLight extends BunqObject** @param array $data*- * @throws \InvalidArgumentException*/public function __construct(array $data){if (0 === count($data)) {return;}- $this->id = intval($data['id']);+ $this->id = (int)$data['id'];$this->created = Carbon::createFromFormat('Y-m-d H:i:s.u', $data['created']);$this->updated = Carbon::createFromFormat('Y-m-d H:i:s.u', $data['updated']);$this->publicUuid = $data['public_uuid'];diff --git a/app/Services/Bunq/Object/UserPerson.php b/app/Services/Bunq/Object/UserPerson.phpindex 265c31429e..bcec433ebb 100644--- a/app/Services/Bunq/Object/UserPerson.php+++ b/app/Services/Bunq/Object/UserPerson.php@@ -46,7 +46,7 @@ class UserPerson extends BunqObject/** @var array */private $billingContracts = [];/** @var string */- private $countryOfBirth = '';+ private $countryOfBirth;/** @var Carbon */private $created;/**@@ -64,60 +64,59 @@ class UserPerson extends BunqObject/** @var Carbon */private $dateOfBirth;/** @var string */- private $displayName = '';+ private $displayName;/** @var string */- private $documentCountry = '';+ private $documentCountry;/** @var string */- private $documentNumber = '';+ private $documentNumber;/** @var string */- private $documentType = '';+ private $documentType;/** @var string */- private $firstName = '';+ private $firstName;/** @var string */- private $gender = '';+ private $gender;/** @var int */- private $id = 0;+ private $id;/** @var string */- private $language = '';+ private $language;/** @var string */- private $lastName = '';+ private $lastName;/** @var string */- private $legalName = '';+ private $legalName;/** @var string */- private $middleName = '';+ private $middleName;/** @var string */- private $nationality = '';+ private $nationality;/** @var array */private $notificationFilters = [];/** @var string */- private $placeOfBirth = '';+ private $placeOfBirth;/** @var string */- private $publicNickName = '';+ private $publicNickName;/** @var string */- private $publicUuid = '';+ private $publicUuid;/*** @var mixed*/private $region;/** @var int */- private $sessionTimeout = 0;+ private $sessionTimeout;/** @var string */- private $status = '';+ private $status;/** @var string */- private $subStatus = '';+ private $subStatus;/** @var string */- private $taxResident = '';+ private $taxResident;/** @var Carbon */private $updated;/** @var int */- private $versionTos = 0;+ private $versionTos;/*** UserPerson constructor.** @param array $data*- * @throws \InvalidArgumentException*/public function __construct(array $data){@@ -129,7 +128,7 @@ class UserPerson extends BunqObjectreturn;}- $this->id = intval($data['id']);+ $this->id = (int)$data['id'];$this->created = Carbon::createFromFormat('Y-m-d H:i:s.u', $data['created']);$this->updated = Carbon::createFromFormat('Y-m-d H:i:s.u', $data['updated']);$this->status = $data['status'];@@ -139,7 +138,7 @@ class UserPerson extends BunqObject$this->publicNickName = $data['public_nick_name'];$this->language = $data['language'];$this->region = $data['region'];- $this->sessionTimeout = intval($data['session_timeout']);+ $this->sessionTimeout = (int)$data['session_timeout'];$this->firstName = $data['first_name'];$this->middleName = $data['middle_name'];$this->lastName = $data['last_name'];@@ -150,7 +149,7 @@ class UserPerson extends BunqObject$this->countryOfBirth = $data['country_of_birth'];$this->nationality = $data['nationality'];$this->gender = $data['gender'];- $this->versionTos = intval($data['version_terms_of_service']);+ $this->versionTos = (int)$data['version_terms_of_service'];$this->documentNumber = $data['document_number'];$this->documentType = $data['document_type'];$this->documentCountry = $data['document_country_of_issuance'];diff --git a/app/Services/Bunq/Request/BunqRequest.php b/app/Services/Bunq/Request/BunqRequest.phpindex ca132487de..a9ba838fba 100644--- a/app/Services/Bunq/Request/BunqRequest.php+++ b/app/Services/Bunq/Request/BunqRequest.php@@ -27,7 +27,6 @@ use FireflyIII\Exceptions\FireflyException;use FireflyIII\Services\Bunq\Object\ServerPublicKey;use Log;use Requests;-use Requests_Exception;/*** Class BunqRequest.@@ -41,7 +40,7 @@ abstract class BunqRequest/** @var string */private $privateKey = '';/** @var string */- private $server = '';+ private $server;/*** @var array*/@@ -58,8 +57,8 @@ abstract class BunqRequest*/public function __construct(){- $this->server = strval(config('import.options.bunq.server'));- $this->version = strval(config('import.options.bunq.version'));+ $this->server = (string)config('import.options.bunq.server');+ $this->version = (string)config('import.options.bunq.version');Log::debug(sprintf('Created new BunqRequest with server "%s" and version "%s"', $this->server, $this->version));}@@ -230,14 +229,14 @@ abstract class BunqRequesttry {$response = Requests::delete($fullUri, $headers);- } catch (Requests_Exception $e) {+ } catch (Exception $e) {return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()]]];}$body = $response->body;$array = json_decode($body, true);$responseHeaders = $response->headers->getAll();- $statusCode = intval($response->status_code);+ $statusCode = (int)$response->status_code;$array['ResponseHeaders'] = $responseHeaders;$array['ResponseStatusCode'] = $statusCode;@@ -277,14 +276,14 @@ abstract class BunqRequesttry {$response = Requests::get($fullUri, $headers);- } catch (Requests_Exception $e) {+ } catch (Exception $e) {return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()]]];}$body = $response->body;$array = json_decode($body, true);$responseHeaders = $response->headers->getAll();- $statusCode = intval($response->status_code);+ $statusCode = (int)$response->status_code;$array['ResponseHeaders'] = $responseHeaders;$array['ResponseStatusCode'] = $statusCode;@@ -318,14 +317,14 @@ abstract class BunqRequesttry {$response = Requests::post($fullUri, $headers, $body);- } catch (Requests_Exception|Exception $e) {+ } catch (Exception $e) {return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()]]];}Log::debug('Seems to have NO exceptions in Response');$body = $response->body;$array = json_decode($body, true);$responseHeaders = $response->headers->getAll();- $statusCode = intval($response->status_code);+ $statusCode = (int)$response->status_code;$array['ResponseHeaders'] = $responseHeaders;$array['ResponseStatusCode'] = $statusCode;@@ -355,7 +354,7 @@ abstract class BunqRequesttry {$response = Requests::delete($fullUri, $headers);- } catch (Requests_Exception|Exception $e) {+ } catch (Exception $e) {return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()]]];}$body = $response->body;@@ -389,7 +388,7 @@ abstract class BunqRequesttry {$response = Requests::post($fullUri, $headers, $body);- } catch (Requests_Exception|Exception $e) {+ } catch (Exception $e) {return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()]]];}$body = $response->body;@@ -465,7 +464,7 @@ abstract class BunqRequest$message[] = $error['error_description'];}}- throw new FireflyException('Bunq ERROR ' . $response['ResponseStatusCode'] . ': ' . join(', ', $message));+ throw new FireflyException('Bunq ERROR ' . $response['ResponseStatusCode'] . ': ' . implode(', ', $message));}/**diff --git a/app/Services/Bunq/Request/DeleteDeviceSessionRequest.php b/app/Services/Bunq/Request/DeleteDeviceSessionRequest.phpindex 545b9e7814..31567043cb 100644--- a/app/Services/Bunq/Request/DeleteDeviceSessionRequest.php+++ b/app/Services/Bunq/Request/DeleteDeviceSessionRequest.php@@ -34,7 +34,6 @@ class DeleteDeviceSessionRequest extends BunqRequestprivate $sessionToken;/**- * @throws \Exception*/public function call(): void{diff --git a/app/Services/Bunq/Request/DeviceServerRequest.php b/app/Services/Bunq/Request/DeviceServerRequest.phpindex 7e8600d7c9..236d0b3b94 100644--- a/app/Services/Bunq/Request/DeviceServerRequest.php+++ b/app/Services/Bunq/Request/DeviceServerRequest.php@@ -46,14 +46,14 @@ class DeviceServerRequest extends BunqRequestpublic function call(): void{Log::debug('Now in DeviceServerRequest::call()');- $uri = 'device-server';- $data = ['description' => $this->description, 'secret' => $this->secret, 'permitted_ips' => $this->permittedIps];+ $uri = 'device-server';+ $data = ['description' => $this->description, 'secret' => $this->secret, 'permitted_ips' => $this->permittedIps];$headers = $this->getDefaultHeaders();$headers['X-Bunq-Client-Authentication'] = $this->installationToken->getToken();$response = $this->sendSignedBunqPost($uri, $data, $headers);$deviceServerId = new DeviceServerId;- $deviceServerId->setId(intval($response['Response'][0]['Id']['id']));+ $deviceServerId->setId((int)$response['Response'][0]['Id']['id']);$this->deviceServerId = $deviceServerId;return;diff --git a/app/Services/Bunq/Request/DeviceSessionRequest.php b/app/Services/Bunq/Request/DeviceSessionRequest.phpindex d67c14c8d1..5e559485d3 100644--- a/app/Services/Bunq/Request/DeviceSessionRequest.php+++ b/app/Services/Bunq/Request/DeviceSessionRequest.php@@ -113,7 +113,7 @@ class DeviceSessionRequest extends BunqRequest{$data = $this->getKeyFromResponse('Id', $response);$deviceSessionId = new DeviceSessionId;- $deviceSessionId->setId(intval($data['id']));+ $deviceSessionId->setId((int)$data['id']);return $deviceSessionId;}@@ -125,10 +125,9 @@ class DeviceSessionRequest extends BunqRequest*/private function extractSessionToken(array $response): SessionToken{- $data = $this->getKeyFromResponse('Token', $response);- $sessionToken = new SessionToken($data);+ $data = $this->getKeyFromResponse('Token', $response);- return $sessionToken;+ return new SessionToken($data);}/**@@ -138,10 +137,9 @@ class DeviceSessionRequest extends BunqRequest*/private function extractUserCompany($response): UserCompany{- $data = $this->getKeyFromResponse('UserCompany', $response);- $userCompany = new UserCompany($data);+ $data = $this->getKeyFromResponse('UserCompany', $response);- return $userCompany;+ return new UserCompany($data);}/**@@ -151,9 +149,8 @@ class DeviceSessionRequest extends BunqRequest*/private function extractUserPerson($response): UserPerson{- $data = $this->getKeyFromResponse('UserPerson', $response);- $userPerson = new UserPerson($data);+ $data = $this->getKeyFromResponse('UserPerson', $response);- return $userPerson;+ return new UserPerson($data);}}diff --git a/app/Services/Bunq/Request/InstallationTokenRequest.php b/app/Services/Bunq/Request/InstallationTokenRequest.phpindex 8eb54531ff..0558738218 100644--- a/app/Services/Bunq/Request/InstallationTokenRequest.php+++ b/app/Services/Bunq/Request/InstallationTokenRequest.php@@ -103,7 +103,7 @@ class InstallationTokenRequest extends BunqRequest{$installationId = new InstallationId;$data = $this->getKeyFromResponse('Id', $response);- $installationId->setId(intval($data['id']));+ $installationId->setId((int)$data['id']);return $installationId;}@@ -115,10 +115,9 @@ class InstallationTokenRequest extends BunqRequest*/private function extractInstallationToken(array $response): InstallationToken{- $data = $this->getKeyFromResponse('Token', $response);- $installationToken = new InstallationToken($data);+ $data = $this->getKeyFromResponse('Token', $response);- return $installationToken;+ return new InstallationToken($data);}/**@@ -128,9 +127,8 @@ class InstallationTokenRequest extends BunqRequest*/private function extractServerPublicKey(array $response): ServerPublicKey{- $data = $this->getKeyFromResponse('ServerPublicKey', $response);- $serverPublicKey = new ServerPublicKey($data);+ $data = $this->getKeyFromResponse('ServerPublicKey', $response);- return $serverPublicKey;+ return new ServerPublicKey($data);}}diff --git a/app/Services/Bunq/Request/ListUserRequest.php b/app/Services/Bunq/Request/ListUserRequest.phpindex 241a819129..9c5549df92 100644--- a/app/Services/Bunq/Request/ListUserRequest.php+++ b/app/Services/Bunq/Request/ListUserRequest.php@@ -42,7 +42,6 @@ class ListUserRequest extends BunqRequestprivate $userPerson;/**- * @throws \Exception*/public function call(): void{diff --git a/app/Services/Bunq/Token/BunqToken.php b/app/Services/Bunq/Token/BunqToken.phpindex 7b4ee2efe9..161448a364 100644--- a/app/Services/Bunq/Token/BunqToken.php+++ b/app/Services/Bunq/Token/BunqToken.php@@ -96,7 +96,6 @@ class BunqToken/*** @param array $response*- * @throws \InvalidArgumentException*/protected function makeTokenFromResponse(array $response): void{diff --git a/app/Services/Currency/FixerIO.php b/app/Services/Currency/FixerIO.phpindex ec0f4cb10b..561cac7315 100644--- a/app/Services/Currency/FixerIO.php+++ b/app/Services/Currency/FixerIO.php@@ -23,12 +23,12 @@ declare(strict_types=1);namespace FireflyIII\Services\Currency;use Carbon\Carbon;+use Exception;use FireflyIII\Models\CurrencyExchangeRate;use FireflyIII\Models\TransactionCurrency;use FireflyIII\User;use Log;use Requests;-use Requests_Exception;/*** Class FixerIO.@@ -53,7 +53,7 @@ class FixerIO implements ExchangeRateInterface$result = Requests::get($uri);$statusCode = $result->status_code;$body = $result->body;- } catch (Requests_Exception $e) {+ } catch (Exception $e) {// don't care about error$body = sprintf('Requests_Exception: %s', $e->getMessage());}@@ -69,7 +69,7 @@ class FixerIO implements ExchangeRateInterface}if (null !== $content) {$code = $toCurrency->code;- $rate = isset($content['rates'][$code]) ? $content['rates'][$code] : '1';+ $rate = $content['rates'][$code] ?? '1';}// create new currency exchange rate object:diff --git a/app/Services/Currency/FixerIOv2.php b/app/Services/Currency/FixerIOv2.phpindex 12b9b76dbd..e037206fb4 100644--- a/app/Services/Currency/FixerIOv2.php+++ b/app/Services/Currency/FixerIOv2.php@@ -23,12 +23,12 @@ declare(strict_types=1);namespace FireflyIII\Services\Currency;use Carbon\Carbon;+use Exception;use FireflyIII\Models\CurrencyExchangeRate;use FireflyIII\Models\TransactionCurrency;use FireflyIII\User;use Log;use Requests;-use Requests_Exception;/*** Class FixerIOv2.@@ -76,7 +76,7 @@ class FixerIOv2 implements ExchangeRateInterface$statusCode = $result->status_code;$body = $result->body;Log::debug(sprintf('Result status code is %d', $statusCode));- } catch (Requests_Exception $e) {+ } catch (Exception $e) {// don't care about error$body = sprintf('Requests_Exception: %s', $e->getMessage());}@@ -92,11 +92,11 @@ class FixerIOv2 implements ExchangeRateInterface}if (null !== $content) {$code = $toCurrency->code;- $rate = $content['rates'][$code] ?? 0;+ $rate = (float)($content['rates'][$code] ?? 0);}Log::debug('Got the following rates from Fixer: ', $content['rates'] ?? []);$exchangeRate->rate = $rate;- if ($rate !== 0) {+ if ($rate !== 0.0) {$exchangeRate->save();}diff --git a/app/Services/Github/Request/UpdateRequest.php b/app/Services/Github/Request/UpdateRequest.phpindex 6311adaae5..9fb0f212dd 100644--- a/app/Services/Github/Request/UpdateRequest.php+++ b/app/Services/Github/Request/UpdateRequest.php@@ -60,10 +60,10 @@ class UpdateRequest implements GithubRequestif (isset($releaseXml->entry)) {foreach ($releaseXml->entry as $entry) {$array = [- 'id' => strval($entry->id),- 'updated' => strval($entry->updated),- 'title' => strval($entry->title),- 'content' => strval($entry->content),+ 'id' => (string)$entry->id,+ 'updated' => (string)$entry->updated,+ 'title' => (string)$entry->title,+ 'content' => (string)$entry->content,];$this->releases[] = new Release($array);}diff --git a/app/Services/Internal/Support/AccountServiceTrait.php b/app/Services/Internal/Support/AccountServiceTrait.phpindex 3f06ad1f14..f126d66605 100644--- a/app/Services/Internal/Support/AccountServiceTrait.php+++ b/app/Services/Internal/Support/AccountServiceTrait.php@@ -127,11 +127,10 @@ trait AccountServiceTrait* @param array $data** @return TransactionJournal|null- * @throws \FireflyIII\Exceptions\FireflyException*/public function storeIBJournal(Account $account, array $data): ?TransactionJournal{- $amount = strval($data['openingBalance']);+ $amount = (string)$data['openingBalance'];Log::debug(sprintf('Submitted amount is %s', $amount));if (0 === bccomp($amount, '0')) {@@ -145,7 +144,7 @@ trait AccountServiceTrait'type' => TransactionType::OPENING_BALANCE,'user' => $account->user->id,'transaction_currency_id' => $currencyId,- 'description' => strval(trans('firefly.initial_balance_description', ['account' => $account->name])),+ 'description' => (string)trans('firefly.initial_balance_description', ['account' => $account->name]),'completed' => true,'date' => $data['openingBalanceDate'],'bill_id' => null,@@ -232,7 +231,6 @@ trait AccountServiceTrait* @param array $data** @return bool- * @throws \FireflyIII\Exceptions\FireflyException*/public function updateIB(Account $account, array $data): bool{@@ -268,9 +266,9 @@ trait AccountServiceTraitpublic function updateIBJournal(Account $account, TransactionJournal $journal, array $data): bool{$date = $data['openingBalanceDate'];- $amount = strval($data['openingBalance']);+ $amount = (string)$data['openingBalance'];$negativeAmount = bcmul($amount, '-1');- $currencyId = intval($data['currency_id']);+ $currencyId = (int)$data['currency_id'];Log::debug(sprintf('Submitted amount for opening balance to update is "%s"', $amount));if (0 === bccomp($amount, '0')) {@@ -291,13 +289,13 @@ trait AccountServiceTrait// update transactions:/** @var Transaction $transaction */foreach ($journal->transactions()->get() as $transaction) {- if (intval($account->id) === intval($transaction->account_id)) {+ if ((int)$account->id === (int)$transaction->account_id) {Log::debug(sprintf('Will (eq) change transaction #%d amount from "%s" to "%s"', $transaction->id, $transaction->amount, $amount));$transaction->amount = $amount;$transaction->transaction_currency_id = $currencyId;$transaction->save();}- if (!(intval($account->id) === intval($transaction->account_id))) {+ if (!((int)$account->id === (int)$transaction->account_id)) {Log::debug(sprintf('Will (neq) change transaction #%d amount from "%s" to "%s"', $transaction->id, $transaction->amount, $negativeAmount));$transaction->amount = $negativeAmount;$transaction->transaction_currency_id = $currencyId;@@ -383,9 +381,8 @@ trait AccountServiceTrait*/public function validIBData(array $data): bool{- $data['openingBalance'] = strval($data['openingBalance'] ?? '');- if (isset($data['openingBalance']) && null !== $data['openingBalance'] && strlen($data['openingBalance']) > 0- && isset($data['openingBalanceDate'])) {+ $data['openingBalance'] = (string)($data['openingBalance'] ?? '');+ if (isset($data['openingBalance'], $data['openingBalanceDate']) && \strlen($data['openingBalance']) > 0) {Log::debug('Array has valid opening balance data.');return true;diff --git a/app/Services/Internal/Support/JournalServiceTrait.php b/app/Services/Internal/Support/JournalServiceTrait.phpindex 229eee646c..4ce551ecde 100644--- a/app/Services/Internal/Support/JournalServiceTrait.php+++ b/app/Services/Internal/Support/JournalServiceTrait.php@@ -72,7 +72,7 @@ trait JournalServiceTrait$factory->setUser($journal->user);$bill = $factory->find($data['bill_id'], $data['bill_name']);- if (!is_null($bill)) {+ if (null !== $bill) {$journal->bill_id = $bill->id;$journal->save();@@ -110,10 +110,10 @@ trait JournalServiceTrait*/protected function storeNote(TransactionJournal $journal, ?string $notes): void{- $notes = strval($notes);+ $notes = (string)$notes;if (strlen($notes) > 0) {$note = $journal->notes()->first();- if (is_null($note)) {+ if (null === $note) {$note = new Note;$note->noteable()->associate($journal);}@@ -123,7 +123,7 @@ trait JournalServiceTraitreturn;}$note = $journal->notes()->first();- if (!is_null($note)) {+ if (null !== $note) {$note->delete();}diff --git a/app/Services/Internal/Support/TransactionServiceTrait.php b/app/Services/Internal/Support/TransactionServiceTrait.phpindex f14da605c0..7346c5cd98 100644--- a/app/Services/Internal/Support/TransactionServiceTrait.php+++ b/app/Services/Internal/Support/TransactionServiceTrait.php@@ -104,12 +104,12 @@ trait TransactionServiceTrait*/public function findAccount(?string $expectedType, ?int $accountId, ?string $accountName): Account{- $accountId = intval($accountId);- $accountName = strval($accountName);+ $accountId = (int)$accountId;+ $accountName = (string)$accountName;$repository = app(AccountRepositoryInterface::class);$repository->setUser($this->user);- if (is_null($expectedType)) {+ if (null === $expectedType) {return $repository->findNull($accountId);}@@ -215,7 +215,7 @@ trait TransactionServiceTrait*/protected function setBudget(Transaction $transaction, ?Budget $budget): void{- if (is_null($budget)) {+ if (null === $budget) {$transaction->budgets()->sync([]);return;@@ -232,7 +232,7 @@ trait TransactionServiceTrait*/protected function setCategory(Transaction $transaction, ?Category $category): void{- if (is_null($category)) {+ if (null === $category) {$transaction->categories()->sync([]);return;@@ -259,7 +259,7 @@ trait TransactionServiceTrait*/protected function setForeignCurrency(Transaction $transaction, ?TransactionCurrency $currency): void{- if (is_null($currency)) {+ if (null === $currency) {$transaction->foreign_currency_id = null;$transaction->save();diff --git a/app/Services/Internal/Update/AccountUpdateService.php b/app/Services/Internal/Update/AccountUpdateService.phpindex 1c57223155..c9711c0b46 100644--- a/app/Services/Internal/Update/AccountUpdateService.php+++ b/app/Services/Internal/Update/AccountUpdateService.php@@ -41,7 +41,6 @@ class AccountUpdateService* @param array $data** @return Account- * @throws \FireflyIII\Exceptions\FireflyException*/public function update(Account $account, array $data): Account{@@ -68,7 +67,7 @@ class AccountUpdateService// update note:if (isset($data['notes']) && null !== $data['notes']) {- $this->updateNote($account, strval($data['notes']));+ $this->updateNote($account, (string)$data['notes']);}return $account;diff --git a/app/Services/Internal/Update/BillUpdateService.php b/app/Services/Internal/Update/BillUpdateService.phpindex b17501bd55..69cf09f38d 100644--- a/app/Services/Internal/Update/BillUpdateService.php+++ b/app/Services/Internal/Update/BillUpdateService.php@@ -45,7 +45,7 @@ class BillUpdateService$matchArray = explode(',', $data['match']);$matchArray = array_unique($matchArray);- $match = join(',', $matchArray);+ $match = implode(',', $matchArray);$bill->name = $data['name'];$bill->match = $match;@@ -60,7 +60,7 @@ class BillUpdateService// update note:if (isset($data['notes']) && null !== $data['notes']) {- $this->updateNote($bill, strval($data['notes']));+ $this->updateNote($bill, (string)$data['notes']);}return $bill;diff --git a/app/Services/Internal/Update/TransactionUpdateService.php b/app/Services/Internal/Update/TransactionUpdateService.phpindex 6a31e71d06..c2f94d08e3 100644--- a/app/Services/Internal/Update/TransactionUpdateService.php+++ b/app/Services/Internal/Update/TransactionUpdateService.php@@ -45,7 +45,7 @@ class TransactionUpdateServicepublic function reconcile(int $transactionId): ?Transaction{$transaction = Transaction::find($transactionId);- if (!is_null($transaction)) {+ if (null !== $transaction) {$transaction->reconciled = true;$transaction->save();@@ -79,20 +79,20 @@ class TransactionUpdateService// update description:$transaction->description = $description;$foreignAmount = null;- if (floatval($transaction->amount) < 0) {+ if ((float)$transaction->amount < 0) {// this is the source transaction.$type = $this->accountType($journal, 'source');$account = $this->findAccount($type, $data['source_id'], $data['source_name']);- $amount = app('steam')->negative(strval($data['amount']));- $foreignAmount = app('steam')->negative(strval($data['foreign_amount']));+ $amount = app('steam')->negative((string)$data['amount']);+ $foreignAmount = app('steam')->negative((string)$data['foreign_amount']);}- if (floatval($transaction->amount) > 0) {+ if ((float)$transaction->amount > 0) {// this is the destination transaction.$type = $this->accountType($journal, 'destination');$account = $this->findAccount($type, $data['destination_id'], $data['destination_name']);- $amount = app('steam')->positive(strval($data['amount']));- $foreignAmount = app('steam')->positive(strval($data['foreign_amount']));+ $amount = app('steam')->positive((string)$data['amount']);+ $foreignAmount = app('steam')->positive((string)$data['foreign_amount']);}// update the actual transaction:@@ -107,11 +107,11 @@ class TransactionUpdateService// set foreign currency$foreign = $this->findCurrency($data['foreign_currency_id'], $data['foreign_currency_code']);// set foreign amount:- if (!is_null($data['foreign_amount']) && !is_null($foreign)) {+ if (null !== $data['foreign_amount'] && null !== $foreign) {$this->setForeignCurrency($transaction, $foreign);$this->setForeignAmount($transaction, $foreignAmount);}- if (is_null($data['foreign_amount']) || is_null($foreign)) {+ if (null === $data['foreign_amount'] || null === $foreign) {$this->setForeignCurrency($transaction, null);$this->setForeignAmount($transaction, null);}diff --git a/app/Services/Password/PwndVerifier.php b/app/Services/Password/PwndVerifier.phpindex b3ba550255..d5bc349253 100644--- a/app/Services/Password/PwndVerifier.php+++ b/app/Services/Password/PwndVerifier.php@@ -22,9 +22,9 @@ declare(strict_types=1);namespace FireflyIII\Services\Password;+use Exception;use Log;use Requests;-use Requests_Exception;/*** Class PwndVerifier.@@ -46,7 +46,7 @@ class PwndVerifier implements Verifiertry {$result = Requests::get($uri, ['originalPasswordIsAHash' => 'true'], $opt);- } catch (Requests_Exception $e) {+ } catch (Exception $e) {return true;}Log::debug(sprintf('Status code returned is %d', $result->status_code));diff --git a/app/Services/Password/PwndVerifierV2.php b/app/Services/Password/PwndVerifierV2.phpindex 09686d6a66..bf3cd330cf 100644--- a/app/Services/Password/PwndVerifierV2.php+++ b/app/Services/Password/PwndVerifierV2.php@@ -22,9 +22,9 @@ declare(strict_types=1);namespace FireflyIII\Services\Password;+use Exception;use Log;use Requests;-use Requests_Exception;/*** Class PwndVerifierV2.@@ -51,7 +51,7 @@ class PwndVerifierV2 implements Verifiertry {$result = Requests::get($uri, $opt);- } catch (Requests_Exception $e) {+ } catch (Exception $e) {return true;}Log::debug(sprintf('Status code returned is %d', $result->status_code));diff --git a/app/Services/Spectre/Object/Customer.php b/app/Services/Spectre/Object/Customer.phpindex 755dcfc38d..36a08a3ccf 100644--- a/app/Services/Spectre/Object/Customer.php+++ b/app/Services/Spectre/Object/Customer.php@@ -41,7 +41,7 @@ class Customer extends SpectreObject*/public function __construct(array $data){- $this->id = intval($data['id']);+ $this->id = (int)$data['id'];$this->identifier = $data['identifier'];$this->secret = $data['secret'];}diff --git a/app/Services/Spectre/Object/Transaction.php b/app/Services/Spectre/Object/Transaction.phpindex ecb7bcc671..296631915f 100644--- a/app/Services/Spectre/Object/Transaction.php+++ b/app/Services/Spectre/Object/Transaction.php@@ -84,7 +84,7 @@ class Transaction extends SpectreObject*/public function getAmount(): string{- return strval($this->amount);+ return (string)$this->amount;}/**@@ -124,7 +124,7 @@ class Transaction extends SpectreObject*/public function getHash(): string{- $array = [+ $array = ['id' => $this->id,'mode' => $this->mode,'status' => $this->status,@@ -139,9 +139,8 @@ class Transaction extends SpectreObject'created_at' => $this->createdAt->toIso8601String(),'updated_at' => $this->updatedAt->toIso8601String(),];- $hashed = hash('sha256', json_encode($array));- return $hashed;+ return hash('sha256', json_encode($array));}/**diff --git a/app/Services/Spectre/Object/TransactionExtra.php b/app/Services/Spectre/Object/TransactionExtra.phpindex ab0f0e9233..01538c1bd1 100644--- a/app/Services/Spectre/Object/TransactionExtra.php+++ b/app/Services/Spectre/Object/TransactionExtra.php@@ -136,9 +136,9 @@ class TransactionExtra extends SpectreObject'id' => $this->id,'record_number' => $this->recordNumber,'information' => $this->information,- 'time' => is_null($this->time) ? null : $this->time->toIso8601String(),- 'posting_date' => is_null($this->postingDate) ? null : $this->postingDate->toIso8601String(),- 'posting_time' => is_null($this->postingTime) ? null : $this->postingTime->toIso8601String(),+ 'time' => null === $this->time ? null : $this->time->toIso8601String(),+ 'posting_date' => null === $this->postingDate ? null : $this->postingDate->toIso8601String(),+ 'posting_time' => null === $this->postingTime ? null : $this->postingTime->toIso8601String(),'account_number' => $this->accountNumber,'original_amount' => $this->originalAmount,'original_currency_code' => $this->originalCurrencyCode,diff --git a/app/Services/Spectre/Request/ListAccountsRequest.php b/app/Services/Spectre/Request/ListAccountsRequest.phpindex 660fc0cf4c..86a3700400 100644--- a/app/Services/Spectre/Request/ListAccountsRequest.php+++ b/app/Services/Spectre/Request/ListAccountsRequest.php@@ -58,7 +58,7 @@ class ListAccountsRequest extends SpectreRequest// extract next ID$hasNextPage = false;- if (isset($response['meta']['next_id']) && intval($response['meta']['next_id']) > $nextId) {+ if (isset($response['meta']['next_id']) && (int)$response['meta']['next_id'] > $nextId) {$hasNextPage = true;$nextId = $response['meta']['next_id'];Log::debug(sprintf('Next ID is now %d.', $nextId));diff --git a/app/Services/Spectre/Request/ListCustomersRequest.php b/app/Services/Spectre/Request/ListCustomersRequest.phpindex 62f3ca9c7d..5d06f0d862 100644--- a/app/Services/Spectre/Request/ListCustomersRequest.php+++ b/app/Services/Spectre/Request/ListCustomersRequest.php@@ -55,7 +55,7 @@ class ListCustomersRequest extends SpectreRequest// extract next ID$hasNextPage = false;- if (isset($response['meta']['next_id']) && intval($response['meta']['next_id']) > $nextId) {+ if (isset($response['meta']['next_id']) && (int)$response['meta']['next_id'] > $nextId) {$hasNextPage = true;$nextId = $response['meta']['next_id'];Log::debug(sprintf('Next ID is now %d.', $nextId));diff --git a/app/Services/Spectre/Request/ListLoginsRequest.php b/app/Services/Spectre/Request/ListLoginsRequest.phpindex 14b9761a6b..d2e87c2a7d 100644--- a/app/Services/Spectre/Request/ListLoginsRequest.php+++ b/app/Services/Spectre/Request/ListLoginsRequest.php@@ -58,7 +58,7 @@ class ListLoginsRequest extends SpectreRequest// extract next ID$hasNextPage = false;- if (isset($response['meta']['next_id']) && intval($response['meta']['next_id']) > $nextId) {+ if (isset($response['meta']['next_id']) && (int)$response['meta']['next_id'] > $nextId) {$hasNextPage = true;$nextId = $response['meta']['next_id'];Log::debug(sprintf('Next ID is now %d.', $nextId));diff --git a/app/Services/Spectre/Request/ListTransactionsRequest.php b/app/Services/Spectre/Request/ListTransactionsRequest.phpindex f162bf22b3..f662ed436c 100644--- a/app/Services/Spectre/Request/ListTransactionsRequest.php+++ b/app/Services/Spectre/Request/ListTransactionsRequest.php@@ -58,7 +58,7 @@ class ListTransactionsRequest extends SpectreRequest// extract next ID$hasNextPage = false;- if (isset($response['meta']['next_id']) && intval($response['meta']['next_id']) > $nextId) {+ if (isset($response['meta']['next_id']) && (int)$response['meta']['next_id'] > $nextId) {$hasNextPage = true;$nextId = $response['meta']['next_id'];Log::debug(sprintf('Next ID is now %d.', $nextId));diff --git a/app/Services/Spectre/Request/SpectreRequest.php b/app/Services/Spectre/Request/SpectreRequest.phpindex 772bb52c39..93eb8a5ebd 100644--- a/app/Services/Spectre/Request/SpectreRequest.php+++ b/app/Services/Spectre/Request/SpectreRequest.php@@ -22,12 +22,11 @@ declare(strict_types=1);namespace FireflyIII\Services\Spectre\Request;+use Exception;use FireflyIII\Exceptions\FireflyException;-use FireflyIII\Services\Spectre\Exception\SpectreException;use FireflyIII\User;use Log;use Requests;-use Requests_Exception;use Requests_Response;/**@@ -44,9 +43,9 @@ abstract class SpectreRequest/** @var string */protected $serviceSecret = '';/** @var string */- private $privateKey = '';+ private $privateKey;/** @var string */- private $server = '';+ private $server;/** @var User */private $user;@@ -198,11 +197,11 @@ abstract class SpectreRequestLog::debug('Final headers for spectre signed get request:', $headers);try {$response = Requests::get($fullUri, $headers);- } catch (Requests_Exception $e) {+ } catch (Exception $e) {throw new FireflyException(sprintf('Request Exception: %s', $e->getMessage()));}$this->detectError($response);- $statusCode = intval($response->status_code);+ $statusCode = (int)$response->status_code;$body = $response->body;$array = json_decode($body, true);@@ -241,7 +240,7 @@ abstract class SpectreRequestLog::debug('Final headers for spectre signed POST request:', $headers);try {$response = Requests::post($fullUri, $headers, $body);- } catch (Requests_Exception $e) {+ } catch (Exception $e) {throw new FireflyException(sprintf('Request Exception: %s', $e->getMessage()));}$this->detectError($response);@@ -274,7 +273,7 @@ abstract class SpectreRequestthrow new FireflyException(sprintf('Error of class %s: %s', $errorClass, $message));}- $statusCode = intval($response->status_code);+ $statusCode = (int)$response->status_code;if (200 !== $statusCode) {throw new FireflyException(sprintf('Status code %d: %s', $statusCode, $response->body));}diff --git a/app/Support/Amount.php b/app/Support/Amount.phpindex 5feec11237..5426d27ece 100644--- a/app/Support/Amount.php+++ b/app/Support/Amount.php@@ -123,7 +123,7 @@ class Amountsetlocale(LC_MONETARY, $locale);$float = round($amount, 12);$info = localeconv();- $formatted = number_format($float, intval($format->decimal_places), $info['mon_decimal_point'], $info['mon_thousands_sep']);+ $formatted = number_format($float, (int)$format->decimal_places, $info['mon_decimal_point'], $info['mon_thousands_sep']);// some complicated switches to format the amount correctly:$precedes = $amount < 0 ? $info['n_cs_precedes'] : $info['p_cs_precedes'];diff --git a/app/Support/Binder/AccountList.php b/app/Support/Binder/AccountList.phpindex 2cf2052cad..085a7a43de 100644--- a/app/Support/Binder/AccountList.php+++ b/app/Support/Binder/AccountList.php@@ -47,7 +47,7 @@ class AccountList implements BinderInterface$list = [];$incoming = explode(',', $value);foreach ($incoming as $entry) {- $list[] = intval($entry);+ $list[] = (int)$entry;}$list = array_unique($list);if (count($list) === 0) {diff --git a/app/Support/Binder/BudgetList.php b/app/Support/Binder/BudgetList.phpindex 26ba5a927f..2db96e1c51 100644--- a/app/Support/Binder/BudgetList.php+++ b/app/Support/Binder/BudgetList.php@@ -45,7 +45,7 @@ class BudgetList implements BinderInterface$list = [];$incoming = explode(',', $value);foreach ($incoming as $entry) {- $list[] = intval($entry);+ $list[] = (int)$entry;}$list = array_unique($list);if (count($list) === 0) {diff --git a/app/Support/Binder/CategoryList.php b/app/Support/Binder/CategoryList.phpindex 11a88681c2..c8aa6c2cae 100644--- a/app/Support/Binder/CategoryList.php+++ b/app/Support/Binder/CategoryList.php@@ -45,7 +45,7 @@ class CategoryList implements BinderInterface$list = [];$incoming = explode(',', $value);foreach ($incoming as $entry) {- $list[] = intval($entry);+ $list[] = (int)$entry;}$list = array_unique($list);if (count($list) === 0) {diff --git a/app/Support/Binder/JournalList.php b/app/Support/Binder/JournalList.phpindex df130fd200..b58133bc3f 100644--- a/app/Support/Binder/JournalList.php+++ b/app/Support/Binder/JournalList.php@@ -44,7 +44,7 @@ class JournalList implements BinderInterface$list = [];$incoming = explode(',', $value);foreach ($incoming as $entry) {- $list[] = intval($entry);+ $list[] = (int)$entry;}$list = array_unique($list);if (count($list) === 0) {diff --git a/app/Support/Binder/UnfinishedJournal.php b/app/Support/Binder/UnfinishedJournal.phpindex f14fdf526f..b255144d8a 100644--- a/app/Support/Binder/UnfinishedJournal.php+++ b/app/Support/Binder/UnfinishedJournal.php@@ -45,7 +45,7 @@ class UnfinishedJournal implements BinderInterface->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')->where('completed', 0)->where('user_id', auth()->user()->id)->first(['transaction_journals.*']);- if (!is_null($journal)) {+ if (null !== $journal) {return $journal;}}diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.phpindex 5f4210e65c..a1707ed1d0 100644--- a/app/Support/ExpandedForm.php+++ b/app/Support/ExpandedForm.php@@ -46,7 +46,6 @@ class ExpandedForm** @return string* @throws \FireflyIII\Exceptions\FireflyException- * @throws \Throwable*/public function amount(string $name, $value = null, array $options = []): string{@@ -60,7 +59,6 @@ class ExpandedForm** @return string* @throws \FireflyIII\Exceptions\FireflyException- * @throws \Throwable*/public function amountSmall(string $name, $value = null, array $options = []): string{@@ -73,7 +71,6 @@ class ExpandedForm* @param array $options** @return string- * @throws \Throwable*/public function assetAccountList(string $name, $value = null, array $options = []): string{@@ -100,17 +97,17 @@ class ExpandedForm/** @var Account $account */foreach ($assetAccounts as $account) {$balance = app('steam')->balance($account, new Carbon);- $currencyId = intval($account->getMeta('currency_id'));+ $currencyId = (int)$account->getMeta('currency_id');$currency = $currencyRepos->findNull($currencyId);$role = $account->getMeta('accountRole');if (0 === strlen($role)) {$role = 'no_account_type'; // @codeCoverageIgnore}- if (is_null($currency)) {+ if (null === $currency) {$currency = $defaultCurrency;}- $key = strval(trans('firefly.opt_group_' . $role));+ $key = (string)trans('firefly.opt_group_' . $role);$grouped[$key][$account->id] = $account->name . ' (' . app('amount')->formatAnything($currency, $balance, false) . ')';}$res = $this->select($name, $grouped, $value, $options);@@ -126,7 +123,6 @@ class ExpandedForm** @return string* @throws \FireflyIII\Exceptions\FireflyException- * @throws \Throwable*/public function balance(string $name, $value = null, array $options = []): string{@@ -141,7 +137,7 @@ class ExpandedForm** @return string*- * @throws \Throwable+*/public function checkbox(string $name, $value = 1, $checked = null, $options = []): string{@@ -165,7 +161,7 @@ class ExpandedForm** @return string*- * @throws \Throwable+*/public function date(string $name, $value = null, array $options = []): string{@@ -185,7 +181,7 @@ class ExpandedForm** @return string*- * @throws \Throwable+*/public function file(string $name, array $options = []): string{@@ -204,7 +200,7 @@ class ExpandedForm** @return string*- * @throws \Throwable+*/public function integer(string $name, $value = null, array $options = []): string{@@ -225,7 +221,7 @@ class ExpandedForm** @return string*- * @throws \Throwable+*/public function location(string $name, $value = null, array $options = []): string{@@ -251,7 +247,7 @@ class ExpandedForm$fields = ['title', 'name', 'description'];/** @var Eloquent $entry */foreach ($set as $entry) {- $entryId = intval($entry->id);+ $entryId = (int)$entry->id;$title = null;foreach ($fields as $field) {@@ -277,7 +273,7 @@ class ExpandedForm$fields = ['title', 'name', 'description'];/** @var Eloquent $entry */foreach ($set as $entry) {- $entryId = intval($entry->id);+ $entryId = (int)$entry->id;$title = null;foreach ($fields as $field) {@@ -299,7 +295,7 @@ class ExpandedForm** @return string*- * @throws \Throwable+*/public function multiCheckbox(string $name, array $list = [], $selected = null, array $options = []): string{@@ -322,7 +318,7 @@ class ExpandedForm** @return string*- * @throws \Throwable+*/public function multiRadio(string $name, array $list = [], $selected = null, array $options = []): string{@@ -344,7 +340,7 @@ class ExpandedForm** @return string*- * @throws \Throwable+*/public function nonSelectableAmount(string $name, $value = null, array $options = []): string{@@ -353,7 +349,7 @@ class ExpandedForm$classes = $this->getHolderClasses($name);$value = $this->fillFieldValue($name, $value);$options['step'] = 'any';- $selectedCurrency = isset($options['currency']) ? $options['currency'] : Amt::getDefaultCurrency();+ $selectedCurrency = $options['currency'] ?? Amt::getDefaultCurrency();unset($options['currency'], $options['placeholder']);// make sure value is formatted nicely:@@ -373,7 +369,7 @@ class ExpandedForm** @return string*- * @throws \Throwable+*/public function nonSelectableBalance(string $name, $value = null, array $options = []): string{@@ -382,7 +378,7 @@ class ExpandedForm$classes = $this->getHolderClasses($name);$value = $this->fillFieldValue($name, $value);$options['step'] = 'any';- $selectedCurrency = isset($options['currency']) ? $options['currency'] : Amt::getDefaultCurrency();+ $selectedCurrency = $options['currency'] ?? Amt::getDefaultCurrency();unset($options['currency'], $options['placeholder']);// make sure value is formatted nicely:@@ -403,7 +399,7 @@ class ExpandedForm** @return string*- * @throws \Throwable+*/public function number(string $name, $value = null, array $options = []): string{@@ -425,7 +421,7 @@ class ExpandedForm** @return string*- * @throws \Throwable+*/public function optionsList(string $type, string $name): string{@@ -437,7 +433,7 @@ class ExpandedForm// don't care}- $previousValue = null === $previousValue ? 'store' : $previousValue;+ $previousValue = $previousValue ?? 'store';$html = view('form.options', compact('type', 'name', 'previousValue'))->render();return $html;@@ -449,14 +445,14 @@ class ExpandedForm** @return string*- * @throws \Throwable+*/public function password(string $name, array $options = []): string{$label = $this->label($name, $options);$options = $this->expandOptionArray($name, $label, $options);$classes = $this->getHolderClasses($name);- $html = view('form.password', compact('classes', 'name', 'label', 'value', 'options'))->render();+ $html = view('form.password', compact('classes', 'name', 'label', 'options'))->render();return $html;}@@ -469,7 +465,7 @@ class ExpandedForm** @return string*- * @throws \Throwable+*/public function select(string $name, array $list = [], $selected = null, array $options = []): string{@@ -490,7 +486,7 @@ class ExpandedForm** @return string*- * @throws \Throwable+*/public function staticText(string $name, $value, array $options = []): string{@@ -509,7 +505,7 @@ class ExpandedForm** @return string*- * @throws \Throwable+*/public function tags(string $name, $value = null, array $options = []): string{@@ -530,7 +526,7 @@ class ExpandedForm** @return string*- * @throws \Throwable+*/public function text(string $name, $value = null, array $options = []): string{@@ -550,7 +546,7 @@ class ExpandedForm** @return string*- * @throws \Throwable+*/public function textarea(string $name, $value = null, array $options = []): string{@@ -640,7 +636,7 @@ class ExpandedForm}$name = str_replace('[]', '', $name);- return strval(trans('form.' . $name));+ return (string)trans('form.' . $name);}/**@@ -652,7 +648,6 @@ class ExpandedForm* @return string** @throws \FireflyIII\Exceptions\FireflyException- * @throws \Throwable*/private function currencyField(string $name, string $view, $value = null, array $options = []): string{@@ -661,14 +656,14 @@ class ExpandedForm$classes = $this->getHolderClasses($name);$value = $this->fillFieldValue($name, $value);$options['step'] = 'any';- $defaultCurrency = isset($options['currency']) ? $options['currency'] : Amt::getDefaultCurrency();+ $defaultCurrency = $options['currency'] ?? Amt::getDefaultCurrency();$currencies = app('amount')->getAllCurrencies();unset($options['currency'], $options['placeholder']);// perhaps the currency has been sent to us in the field $amount_currency_id_$name (amount_currency_id_amount)$preFilled = session('preFilled');$key = 'amount_currency_id_' . $name;- $sentCurrencyId = isset($preFilled[$key]) ? intval($preFilled[$key]) : $defaultCurrency->id;+ $sentCurrencyId = isset($preFilled[$key]) ? (int)$preFilled[$key] : $defaultCurrency->id;// find this currency in set of currencies:foreach ($currencies as $currency) {diff --git a/app/Support/FireflyConfig.php b/app/Support/FireflyConfig.phpindex c74febbc69..19b8feca8a 100644--- a/app/Support/FireflyConfig.php+++ b/app/Support/FireflyConfig.php@@ -36,7 +36,7 @@ class FireflyConfig** @return bool*- * @throws \Exception+*/public function delete($name): bool{diff --git a/app/Support/Import/Configuration/Bunq/HaveAccounts.php b/app/Support/Import/Configuration/Bunq/HaveAccounts.phpindex 8dc16ccf7e..7a0db86d2a 100644--- a/app/Support/Import/Configuration/Bunq/HaveAccounts.php+++ b/app/Support/Import/Configuration/Bunq/HaveAccounts.php@@ -57,11 +57,11 @@ class HaveAccounts implements ConfigurationInterface/** @var Account $dbAccount */foreach ($collection as $dbAccount) {$id = $dbAccount->id;- $currencyId = intval($accountRepository->getMetaValue($dbAccount, 'currency_id'));+ $currencyId = (int)$accountRepository->getMetaValue($dbAccount, 'currency_id');$currency = $currencyRepository->findNull($currencyId);$dbAccounts[$id] = ['account' => $dbAccount,- 'currency' => is_null($currency) ? $defaultCurrency : $currency,+ 'currency' => null === $currency ? $defaultCurrency : $currency,];}@@ -78,11 +78,9 @@ class HaveAccounts implements ConfigurationInterface}- $data = [+ return ['config' => $config,];-- return $data;}/**@@ -119,9 +117,9 @@ class HaveAccounts implements ConfigurationInterface$accounts = $data['bunq_account_id'] ?? [];$mapping = [];foreach ($accounts as $bunqId) {- $bunqId = intval($bunqId);- $doImport = intval($data['do_import'][$bunqId] ?? 0) === 1;- $account = intval($data['import'][$bunqId] ?? 0);+ $bunqId = (int)$bunqId;+ $doImport = (int)($data['do_import'][$bunqId] ?? 0.0) === 1;+ $account = (int)($data['import'][$bunqId] ?? 0.0);if ($doImport) {$mapping[$bunqId] = $account;}diff --git a/app/Support/Import/Configuration/File/Initial.php b/app/Support/Import/Configuration/File/Initial.phpindex 615a72e9f0..e9232c12a5 100644--- a/app/Support/Import/Configuration/File/Initial.php+++ b/app/Support/Import/Configuration/File/Initial.php@@ -102,7 +102,7 @@ class Initial implements ConfigurationInterfaceLog::debug('Now in storeConfiguration for file Upload.');$config = $this->getConfig();$type = $data['import_file_type'] ?? 'csv'; // assume it's a CSV file.- $config['file-type'] = in_array($type, config('import.options.file.import_formats')) ? $type : 'csv';+ $config['file-type'] = \in_array($type, config('import.options.file.import_formats'), true) ? $type : 'csv';// update config:$this->repository->setConfiguration($this->job, $config);@@ -118,7 +118,7 @@ class Initial implements ConfigurationInterface}if (false === $uploaded) {- $this->warning = 'No valid upload.';+ $this->warning = (string)trans('firefly.upload_error');return true;}diff --git a/app/Support/Import/Configuration/File/Map.php b/app/Support/Import/Configuration/File/Map.phpindex 670f3c8dbf..2cf3ef4b39 100644--- a/app/Support/Import/Configuration/File/Map.php+++ b/app/Support/Import/Configuration/File/Map.php@@ -159,12 +159,12 @@ class Map implements ConfigurationInterface$config = $this->getConfig();if (isset($data['mapping'])) {- foreach ($data['mapping'] as $index => $data) {+ foreach ($data['mapping'] as $index => $array) {$config['column-mapping-config'][$index] = [];- foreach ($data as $value => $mapId) {- $mapId = intval($mapId);+ foreach ($array as $value => $mapId) {+ $mapId = (int)$mapId;if (0 !== $mapId) {- $config['column-mapping-config'][$index][$value] = intval($mapId);+ $config['column-mapping-config'][$index][$value] = $mapId;}}}@@ -186,10 +186,8 @@ class Map implements ConfigurationInterface{$mapperClass = config('csv.import_roles.' . $column . '.mapper');$mapperName = sprintf('\\FireflyIII\\Import\Mapper\\%s', $mapperClass);- /** @var MapperInterface $mapper */- $mapper = app($mapperName);- return $mapper;+ return app($mapperName);}/**diff --git a/app/Support/Import/Configuration/File/Roles.php b/app/Support/Import/Configuration/File/Roles.phpindex 3b33805840..2877621c32 100644--- a/app/Support/Import/Configuration/File/Roles.php+++ b/app/Support/Import/Configuration/File/Roles.php@@ -73,7 +73,7 @@ class Roles implements ConfigurationInterface}// example rows:- $stmt = (new Statement)->limit(intval(config('csv.example_rows', 5)))->offset($offset);+ $stmt = (new Statement)->limit((int)config('csv.example_rows', 5))->offset($offset);// set data:$roles = $this->getRoles();asort($roles);@@ -274,14 +274,14 @@ class Roles implements ConfigurationInterface}// warn if has foreign amount but no currency code:if ($hasForeignAmount && !$hasForeignCode) {- $this->warning = strval(trans('import.foreign_amount_warning'));+ $this->warning = (string)trans('import.foreign_amount_warning');Log::debug('isRolesComplete() returns FALSE because foreign amount present without foreign code.');return false;}if (0 === $assigned || !$hasAmount) {- $this->warning = strval(trans('import.roles_warning'));+ $this->warning = (string)trans('import.roles_warning');Log::debug('isRolesComplete() returns FALSE because no amount present.');return false;diff --git a/app/Support/Import/Configuration/File/UploadConfig.php b/app/Support/Import/Configuration/File/UploadConfig.phpindex 9dd8309554..8a0d6dbc07 100644--- a/app/Support/Import/Configuration/File/UploadConfig.php+++ b/app/Support/Import/Configuration/File/UploadConfig.php@@ -114,16 +114,16 @@ class UploadConfig implements ConfigurationInterface{Log::debug('Now in Initial::storeConfiguration()');$config = $this->getConfig();- $importId = intval($data['csv_import_account'] ?? 0);+ $importId = (int)($data['csv_import_account'] ?? 0.0);$account = $this->accountRepository->find($importId);- $delimiter = strval($data['csv_delimiter']);+ $delimiter = (string)$data['csv_delimiter'];// set "headers":- $config['has-headers'] = intval($data['has_headers'] ?? 0) === 1;- $config['date-format'] = strval($data['date_format']);+ $config['has-headers'] = (int)($data['has_headers'] ?? 0.0) === 1;+ $config['date-format'] = (string)$data['date_format'];$config['delimiter'] = 'tab' === $delimiter ? "\t" : $delimiter;- $config['apply-rules'] = intval($data['apply_rules'] ?? 0) === 1;- $config['match-bills'] = intval($data['match_bills'] ?? 0) === 1;+ $config['apply-rules'] = (int)($data['apply_rules'] ?? 0.0) === 1;+ $config['match-bills'] = (int)($data['match_bills'] ?? 0.0) === 1;Log::debug('Entered import account.', ['id' => $importId]);diff --git a/app/Support/Import/Configuration/Spectre/HaveAccounts.php b/app/Support/Import/Configuration/Spectre/HaveAccounts.phpindex d4db42118e..2219748065 100644--- a/app/Support/Import/Configuration/Spectre/HaveAccounts.php+++ b/app/Support/Import/Configuration/Spectre/HaveAccounts.php@@ -58,11 +58,11 @@ class HaveAccounts implements ConfigurationInterface/** @var Account $dbAccount */foreach ($collection as $dbAccount) {$id = $dbAccount->id;- $currencyId = intval($dbAccount->getMeta('currency_id'));+ $currencyId = (int)$dbAccount->getMeta('currency_id');$currency = $currencyRepository->find($currencyId);$dbAccounts[$id] = ['account' => $dbAccount,- 'currency' => is_null($currency->id) ? $defaultCurrency : $currency,+ 'currency' => null === $currency->id ? $defaultCurrency : $currency,];}@@ -79,12 +79,9 @@ class HaveAccounts implements ConfigurationInterface}- $data = [+ return ['config' => $config,];--- return $data;}/**@@ -121,9 +118,9 @@ class HaveAccounts implements ConfigurationInterface$accounts = $data['spectre_account_id'] ?? [];$mapping = [];foreach ($accounts as $spectreId) {- $spectreId = intval($spectreId);- $doImport = intval($data['do_import'][$spectreId] ?? 0) === 1;- $account = intval($data['import'][$spectreId] ?? 0);+ $spectreId = (int)$spectreId;+ $doImport = (int)($data['do_import'][$spectreId] ?? 0.0) === 1;+ $account = (int)($data['import'][$spectreId] ?? 0.0);if ($doImport) {$mapping[$spectreId] = $account;}diff --git a/app/Support/Import/Information/BunqInformation.php b/app/Support/Import/Information/BunqInformation.phpindex ab12faf500..76356bbef3 100644--- a/app/Support/Import/Information/BunqInformation.php+++ b/app/Support/Import/Information/BunqInformation.php@@ -63,7 +63,6 @@ class BunqInformation implements InformationInterface* @return array** @throws FireflyException- * @throws \Exception*/public function getAccounts(): array{@@ -117,7 +116,7 @@ class BunqInformation implements InformationInterface/*** @param SessionToken $sessionToken*- * @throws \Exception+*/private function closeSession(SessionToken $sessionToken): void{@@ -141,7 +140,7 @@ class BunqInformation implements InformationInterface** @return Collection*- * @throws \Exception+*/private function getMonetaryAccounts(SessionToken $sessionToken, int $userId): Collection{@@ -166,7 +165,6 @@ class BunqInformation implements InformationInterface* @return int** @throws FireflyException- * @throws \Exception*/private function getUserInformation(SessionToken $sessionToken): int{@@ -194,7 +192,7 @@ class BunqInformation implements InformationInterface/*** @return SessionToken*- * @throws \Exception+*/private function startSession(): SessionToken{diff --git a/app/Support/Navigation.php b/app/Support/Navigation.phpindex 8390252ad5..9c1fe63c02 100644--- a/app/Support/Navigation.php+++ b/app/Support/Navigation.php@@ -91,7 +91,7 @@ class Navigationpublic function blockPeriods(\Carbon\Carbon $start, \Carbon\Carbon $end, string $range): array{if ($end < $start) {- list($start, $end) = [$end, $start];+ [$start, $end] = [$end, $start];}$periods = [];/*@@ -262,17 +262,17 @@ class Navigation// define period to increment$increment = 'addDay';$format = $this->preferredCarbonFormat($start, $end);- $displayFormat = strval(trans('config.month_and_day'));+ $displayFormat = (string)trans('config.month_and_day');// increment by month (for year)if ($start->diffInMonths($end) > 1) {$increment = 'addMonth';- $displayFormat = strval(trans('config.month'));+ $displayFormat = (string)trans('config.month');}// increment by year (for multi year)if ($start->diffInMonths($end) > 12) {$increment = 'addYear';- $displayFormat = strval(trans('config.year'));+ $displayFormat = (string)trans('config.year');}$begin = clone $start;@@ -316,7 +316,7 @@ class Navigation];if (isset($formatMap[$repeatFrequency])) {- return $date->formatLocalized(strval($formatMap[$repeatFrequency]));+ return $date->formatLocalized((string)$formatMap[$repeatFrequency]);}if ('3M' === $repeatFrequency || 'quarter' === $repeatFrequency) {$quarter = ceil($theDate->month / 3);@@ -362,13 +362,13 @@ class Navigation*/public function preferredCarbonLocalizedFormat(Carbon $start, Carbon $end): string{- $format = strval(trans('config.month_and_day'));+ $format = (string)trans('config.month_and_day');if ($start->diffInMonths($end) > 1) {- $format = strval(trans('config.month'));+ $format = (string)trans('config.month');}if ($start->diffInMonths($end) > 12) {- $format = strval(trans('config.year'));+ $format = (string)trans('config.year');}return $format;diff --git a/app/Support/Preferences.php b/app/Support/Preferences.phpindex 30f0567ba5..9acd6163fc 100644--- a/app/Support/Preferences.php+++ b/app/Support/Preferences.php@@ -75,9 +75,7 @@ class Preferences*/public function findByName(string $name): Collection{- $set = Preference::where('name', $name)->get();-- return $set;+ return Preference::where('name', $name)->get();}/**@@ -168,7 +166,7 @@ class Preferencesif (null !== $preference && null !== $preference->data) {$lastActivity = $preference->data;}- if (is_array($lastActivity)) {+ if (\is_array($lastActivity)) {$lastActivity = implode(',', $lastActivity);}diff --git a/app/Support/Search/Modifier.php b/app/Support/Search/Modifier.phpindex afce3946c8..6ac782f818 100644--- a/app/Support/Search/Modifier.php+++ b/app/Support/Search/Modifier.php@@ -166,11 +166,11 @@ class Modifier{$journalBudget = '';if (null !== $transaction->transaction_journal_budget_name) {- $journalBudget = Steam::decrypt(intval($transaction->transaction_journal_budget_encrypted), $transaction->transaction_journal_budget_name);+ $journalBudget = Steam::decrypt((int)$transaction->transaction_journal_budget_encrypted, $transaction->transaction_journal_budget_name);}$transactionBudget = '';if (null !== $transaction->transaction_budget_name) {- $journalBudget = Steam::decrypt(intval($transaction->transaction_budget_encrypted), $transaction->transaction_budget_name);+ $journalBudget = Steam::decrypt((int)$transaction->transaction_budget_encrypted, $transaction->transaction_budget_name);}return self::stringCompare($journalBudget, $search) || self::stringCompare($transactionBudget, $search);@@ -186,11 +186,11 @@ class Modifier{$journalCategory = '';if (null !== $transaction->transaction_journal_category_name) {- $journalCategory = Steam::decrypt(intval($transaction->transaction_journal_category_encrypted), $transaction->transaction_journal_category_name);+ $journalCategory = Steam::decrypt((int)$transaction->transaction_journal_category_encrypted, $transaction->transaction_journal_category_name);}$transactionCategory = '';if (null !== $transaction->transaction_category_name) {- $journalCategory = Steam::decrypt(intval($transaction->transaction_category_encrypted), $transaction->transaction_category_name);+ $journalCategory = Steam::decrypt((int)$transaction->transaction_category_encrypted, $transaction->transaction_category_name);}return self::stringCompare($journalCategory, $search) || self::stringCompare($transactionCategory, $search);diff --git a/app/Support/Search/Search.php b/app/Support/Search/Search.phpindex 30c259200d..2b21f7bfb9 100644--- a/app/Support/Search/Search.php+++ b/app/Support/Search/Search.php@@ -23,7 +23,6 @@ declare(strict_types=1);namespace FireflyIII\Support\Search;use Carbon\Carbon;-use FireflyIII\Exceptions\FireflyException;use FireflyIII\Helpers\Collector\JournalCollectorInterface;use FireflyIII\Helpers\Filter\InternalTransferFilter;use FireflyIII\Models\Transaction;@@ -45,7 +44,7 @@ class Search implements SearchInterface/** @var User */private $user;/** @var array */- private $validModifiers = [];+ private $validModifiers;/** @var array */private $words = [];@@ -63,7 +62,7 @@ class Search implements SearchInterface*/public function getWordsAsString(): string{- $string = join(' ', $this->words);+ $string = implode(' ', $this->words);if (0 === strlen($string)) {return is_string($this->originalQuery) ? $this->originalQuery : '';}@@ -196,19 +195,19 @@ class Search implements SearchInterfaceswitch ($modifier['type']) {case 'amount_is':case 'amount':- $amount = app('steam')->positive(strval($modifier['value']));+ $amount = app('steam')->positive((string)$modifier['value']);Log::debug(sprintf('Set "%s" using collector with value "%s"', $modifier['type'], $amount));$collector->amountIs($amount);break;case 'amount_max':case 'amount_less':- $amount = app('steam')->positive(strval($modifier['value']));+ $amount = app('steam')->positive((string)$modifier['value']);Log::debug(sprintf('Set "%s" using collector with value "%s"', $modifier['type'], $amount));$collector->amountLess($amount);break;case 'amount_min':case 'amount_more':- $amount = app('steam')->positive(strval($modifier['value']));+ $amount = app('steam')->positive((string)$modifier['value']);Log::debug(sprintf('Set "%s" using collector with value "%s"', $modifier['type'], $amount));$collector->amountMore($amount);break;@@ -246,9 +245,9 @@ class Search implements SearchInterfaceprivate function extractModifier(string $string){$parts = explode(':', $string);- if (2 === count($parts) && strlen(trim(strval($parts[0]))) > 0 && strlen(trim(strval($parts[1])))) {- $type = trim(strval($parts[0]));- $value = trim(strval($parts[1]));+ if (2 === count($parts) && strlen(trim((string)$parts[0])) > 0 && strlen(trim((string)$parts[1]))) {+ $type = trim((string)$parts[0]);+ $value = trim((string)$parts[1]);if (in_array($type, $this->validModifiers)) {// filter for valid type$this->modifiers->push(['type' => $type, 'value' => $value]);@@ -268,8 +267,8 @@ class Search implements SearchInterface// first "modifier" is always the text of the search:// check descr of journal:if (count($this->words) > 0- && !$this->strposArray(strtolower(strval($transaction->description)), $this->words)- && !$this->strposArray(strtolower(strval($transaction->transaction_description)), $this->words)+ && !$this->strposArray(strtolower((string)$transaction->description), $this->words)+ && !$this->strposArray(strtolower((string)$transaction->transaction_description), $this->words)) {Log::debug('Description does not match', $this->words);diff --git a/app/Support/Steam.php b/app/Support/Steam.phpindex ffdd0c6be4..d6d998b9ff 100644--- a/app/Support/Steam.php+++ b/app/Support/Steam.php@@ -51,32 +51,28 @@ class Steamif ($cache->has()) {return $cache->get(); // @codeCoverageIgnore}- $currencyId = intval($account->getMeta('currency_id'));+ $currencyId = (int)$account->getMeta('currency_id');// use system default currency:if (0 === $currencyId) {$currency = app('amount')->getDefaultCurrencyByUser($account->user);$currencyId = $currency->id;}// first part: get all balances in own currency:- $nativeBalance = strval(- $account->transactions()- ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')- ->where('transaction_journals.date', '<=', $date->format('Y-m-d 23:59:59'))- ->where('transactions.transaction_currency_id', $currencyId)- ->sum('transactions.amount')- );+ $nativeBalance = (string)$account->transactions()+ ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')+ ->where('transaction_journals.date', '<=', $date->format('Y-m-d 23:59:59'))+ ->where('transactions.transaction_currency_id', $currencyId)+ ->sum('transactions.amount');// get all balances in foreign currency:- $foreignBalance = strval(- $account->transactions()- ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')- ->where('transaction_journals.date', '<=', $date->format('Y-m-d'))- ->where('transactions.foreign_currency_id', $currencyId)- ->where('transactions.transaction_currency_id', '!=', $currencyId)- ->sum('transactions.foreign_amount')- );+ $foreignBalance = (string)$account->transactions()+ ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')+ ->where('transaction_journals.date', '<=', $date->format('Y-m-d'))+ ->where('transactions.foreign_currency_id', $currencyId)+ ->where('transactions.transaction_currency_id', '!=', $currencyId)+ ->sum('transactions.foreign_amount');$balance = bcadd($nativeBalance, $foreignBalance);- $virtual = null === $account->virtual_balance ? '0' : strval($account->virtual_balance);+ $virtual = null === $account->virtual_balance ? '0' : (string)$account->virtual_balance;$balance = bcadd($balance, $virtual);$cache->store($balance);@@ -99,25 +95,21 @@ class Steamif ($cache->has()) {return $cache->get(); // @codeCoverageIgnore}- $currencyId = intval($account->getMeta('currency_id'));+ $currencyId = (int)$account->getMeta('currency_id');- $nativeBalance = strval(- $account->transactions()- ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')- ->where('transaction_journals.date', '<=', $date->format('Y-m-d'))- ->where('transactions.transaction_currency_id', $currencyId)- ->sum('transactions.amount')- );+ $nativeBalance = (string)$account->transactions()+ ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')+ ->where('transaction_journals.date', '<=', $date->format('Y-m-d'))+ ->where('transactions.transaction_currency_id', $currencyId)+ ->sum('transactions.amount');// get all balances in foreign currency:- $foreignBalance = strval(- $account->transactions()- ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')- ->where('transaction_journals.date', '<=', $date->format('Y-m-d'))- ->where('transactions.foreign_currency_id', $currencyId)- ->where('transactions.transaction_currency_id', '!=', $currencyId)- ->sum('transactions.foreign_amount')- );+ $foreignBalance = (string)$account->transactions()+ ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')+ ->where('transaction_journals.date', '<=', $date->format('Y-m-d'))+ ->where('transactions.foreign_currency_id', $currencyId)+ ->where('transactions.transaction_currency_id', '!=', $currencyId)+ ->sum('transactions.foreign_amount');$balance = bcadd($nativeBalance, $foreignBalance);$cache->store($balance);@@ -155,7 +147,7 @@ class Steam$startBalance = $this->balance($account, $start);$balances[$formatted] = $startBalance;- $currencyId = intval($account->getMeta('currency_id'));+ $currencyId = (int)$account->getMeta('currency_id');$start->addDay();// query!@@ -182,14 +174,14 @@ class Steam/** @var Transaction $entry */foreach ($set as $entry) {// normal amount and foreign amount- $modified = null === $entry->modified ? '0' : strval($entry->modified);- $foreignModified = null === $entry->modified_foreign ? '0' : strval($entry->modified_foreign);+ $modified = null === $entry->modified ? '0' : (string)$entry->modified;+ $foreignModified = null === $entry->modified_foreign ? '0' : (string)$entry->modified_foreign;$amount = '0';- if ($currencyId === intval($entry->transaction_currency_id) || 0 === $currencyId) {+ if ($currencyId === (int)$entry->transaction_currency_id || 0 === $currencyId) {// use normal amount:$amount = $modified;}- if ($currencyId === intval($entry->foreign_currency_id)) {+ if ($currencyId === (int)$entry->foreign_currency_id) {// use foreign amount:$amount = $foreignModified;}@@ -268,7 +260,7 @@ class Steam->get(['transactions.account_id', DB::raw('MAX(transaction_journals.date) AS max_date')]);foreach ($set as $entry) {- $list[intval($entry->account_id)] = new Carbon($entry->max_date);+ $list[(int)$entry->account_id] = new Carbon($entry->max_date);}return $list;@@ -295,7 +287,7 @@ class Steam*/public function opposite(string $amount = null): ?string{- if (is_null($amount)) {+ if (null === $amount) {return null;}$amount = bcmul($amount, '-1');@@ -316,24 +308,24 @@ class Steam// has a K in it, remove the K and multiply by 1024.$bytes = bcmul(rtrim($string, 'kK'), '1024');- return intval($bytes);+ return (int)$bytes;}if (!(false === stripos($string, 'm'))) {// has a M in it, remove the M and multiply by 1048576.$bytes = bcmul(rtrim($string, 'mM'), '1048576');- return intval($bytes);+ return (int)$bytes;}if (!(false === stripos($string, 'g'))) {// has a G in it, remove the G and multiply by (1024)^3.$bytes = bcmul(rtrim($string, 'gG'), '1073741824');- return intval($bytes);+ return (int)$bytes;}- return intval($string);+ return (int)$string;}/**diff --git a/app/Support/Twig/Extension/Transaction.php b/app/Support/Twig/Extension/Transaction.phpindex 042f28fb39..c461925e78 100644--- a/app/Support/Twig/Extension/Transaction.php+++ b/app/Support/Twig/Extension/Transaction.php@@ -45,12 +45,12 @@ class Transaction extends Twig_Extension*/public function amount(TransactionModel $transaction): string{- $amount = bcmul(app('steam')->positive(strval($transaction->transaction_amount)), '-1');+ $amount = bcmul(app('steam')->positive((string)$transaction->transaction_amount), '-1');$format = '%s';$coloured = true;// at this point amount is always negative.- if (TransactionType::RECONCILIATION === $transaction->transaction_type_type && 1 === bccomp(strval($transaction->transaction_amount), '0')) {+ if (TransactionType::RECONCILIATION === $transaction->transaction_type_type && 1 === bccomp((string)$transaction->transaction_amount, '0')) {$amount = bcmul($amount, '-1');}@@ -64,7 +64,7 @@ class Transaction extends Twig_Extension$format = '<span class="text-info">%s</span>';}if (TransactionType::OPENING_BALANCE === $transaction->transaction_type_type) {- $amount = strval($transaction->transaction_amount);+ $amount = (string)$transaction->transaction_amount;}$currency = new TransactionCurrency;@@ -73,7 +73,7 @@ class Transaction extends Twig_Extension$str = sprintf($format, app('amount')->formatAnything($currency, $amount, $coloured));if (null !== $transaction->transaction_foreign_amount) {- $amount = bcmul(app('steam')->positive(strval($transaction->transaction_foreign_amount)), '-1');+ $amount = bcmul(app('steam')->positive((string)$transaction->transaction_foreign_amount), '-1');if (TransactionType::DEPOSIT === $transaction->transaction_type_type) {$amount = bcmul($amount, '-1');}@@ -101,7 +101,7 @@ class Transaction extends Twig_Extensionpublic function amountArray(array $transaction): string{// first display amount:- $amount = strval($transaction['amount']);+ $amount = (string)$transaction['amount'];$fakeCurrency = new TransactionCurrency;$fakeCurrency->decimal_places = $transaction['currency_dp'];$fakeCurrency->symbol = $transaction['currency_symbol'];@@ -109,7 +109,7 @@ class Transaction extends Twig_Extension// then display (if present) the foreign amount:if (null !== $transaction['foreign_amount']) {- $amount = strval($transaction['foreign_amount']);+ $amount = (string)$transaction['foreign_amount'];$fakeCurrency = new TransactionCurrency;$fakeCurrency->decimal_places = $transaction['foreign_currency_dp'];$fakeCurrency->symbol = $transaction['foreign_currency_symbol'];@@ -205,7 +205,7 @@ class Transaction extends Twig_Extensionpublic function description(TransactionModel $transaction): string{$description = $transaction->description;- if (strlen(strval($transaction->transaction_description)) > 0) {+ if (strlen((string)$transaction->transaction_description) > 0) {$description = $transaction->transaction_description . ' (' . $transaction->description . ')';}@@ -226,13 +226,13 @@ class Transaction extends Twig_Extension}$name = app('steam')->tryDecrypt($transaction->account_name);- $transactionId = intval($transaction->account_id);+ $transactionId = (int)$transaction->account_id;$type = $transaction->account_type;// name is present in object, use that one:if (bccomp($transaction->transaction_amount, '0') === -1 && null !== $transaction->opposing_account_id) {$name = $transaction->opposing_account_name;- $transactionId = intval($transaction->opposing_account_id);+ $transactionId = (int)$transaction->opposing_account_id;$type = $transaction->opposing_account_type;}@@ -249,7 +249,7 @@ class Transaction extends Twig_Extension->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')->first(['transactions.account_id', 'accounts.encrypted', 'accounts.name', 'account_types.type']);- if (is_null($other)) {+ if (null === $other) {Log::error(sprintf('Cannot find other transaction for journal #%d', $journalId));return '';@@ -384,13 +384,13 @@ class Transaction extends Twig_Extension// if the amount is negative, assume that the current account (the one in $transaction) is indeed the source account.$name = app('steam')->tryDecrypt($transaction->account_name);- $transactionId = intval($transaction->account_id);+ $transactionId = (int)$transaction->account_id;$type = $transaction->account_type;// name is present in object, use that one:if (1 === bccomp($transaction->transaction_amount, '0') && null !== $transaction->opposing_account_id) {$name = $transaction->opposing_account_name;- $transactionId = intval($transaction->opposing_account_id);+ $transactionId = (int)$transaction->opposing_account_id;$type = $transaction->opposing_account_type;}// Find the opposing account and use that one:diff --git a/app/Support/Twig/Extension/TransactionJournal.php b/app/Support/Twig/Extension/TransactionJournal.phpindex 6e8d9a9ede..cc06e02726 100644--- a/app/Support/Twig/Extension/TransactionJournal.php+++ b/app/Support/Twig/Extension/TransactionJournal.php@@ -59,7 +59,7 @@ class TransactionJournal extends Twig_Extension/** @var JournalRepositoryInterface $repository */$repository = app(JournalRepositoryInterface::class);$result = $repository->getMetaField($journal, $field);- if (is_null($result)) {+ if (null === $result) {return '';}@@ -80,10 +80,10 @@ class TransactionJournal extends Twig_Extension/** @var JournalRepositoryInterface $repository */$repository = app(JournalRepositoryInterface::class);$result = $repository->getMetaField($journal, $field);- if (is_null($result)) {+ if (null === $result) {return false;}- if (strlen(strval($result)) === 0) {+ if (strlen((string)$result) === 0) {return false;}@@ -135,8 +135,7 @@ class TransactionJournal extends Twig_Extension}$array[] = app('amount')->formatAnything($total['currency'], $total['amount']);}- $txt = join(' / ', $array);- return $txt;+ return join(' / ', $array);}}diff --git a/app/Support/Twig/Journal.php b/app/Support/Twig/Journal.phpindex d37e071a45..ec15461939 100644--- a/app/Support/Twig/Journal.php+++ b/app/Support/Twig/Journal.php@@ -64,7 +64,7 @@ class Journal extends Twig_Extension$array[] = sprintf('<a title="%1$s" href="%2$s">%1$s</a>', e($entry->name), route('accounts.show', $entry->id));}$array = array_unique($array);- $result = join(', ', $array);+ $result = implode(', ', $array);$cache->store($result);return $result;@@ -129,7 +129,7 @@ class Journal extends Twig_Extension$array[] = sprintf('<a title="%1$s" href="%2$s">%1$s</a>', e($entry->name), route('accounts.show', $entry->id));}$array = array_unique($array);- $result = join(', ', $array);+ $result = implode(', ', $array);$cache->store($result);return $result;@@ -164,7 +164,7 @@ class Journal extends Twig_Extension$budgets[] = sprintf('<a title="%1$s" href="%2$s">%1$s</a>', e($budget->name), route('budgets.show', $budget->id));}}- $string = join(', ', array_unique($budgets));+ $string = implode(', ', array_unique($budgets));$cache->store($string);return $string;@@ -205,7 +205,7 @@ class Journal extends Twig_Extension}}- $string = join(', ', array_unique($categories));+ $string = implode(', ', array_unique($categories));$cache->store($string);return $string;diff --git a/app/TransactionRules/Actions/ClearNotes.php b/app/TransactionRules/Actions/ClearNotes.phpindex 7dec7f12f7..a6bd490588 100644--- a/app/TransactionRules/Actions/ClearNotes.php+++ b/app/TransactionRules/Actions/ClearNotes.php@@ -52,7 +52,7 @@ class ClearNotes implements ActionInterface** @return bool*- * @throws \Exception+*/public function act(TransactionJournal $journal): bool{diff --git a/app/TransactionRules/Processor.php b/app/TransactionRules/Processor.phpindex 2c4d343765..2cf9f31759 100644--- a/app/TransactionRules/Processor.php+++ b/app/TransactionRules/Processor.php@@ -128,7 +128,7 @@ final class Processor{$self = new self;foreach ($triggers as $entry) {- $entry['value'] = null === $entry['value'] ? '' : $entry['value'];+ $entry['value'] = $entry['value'] ?? '';$trigger = TriggerFactory::makeTriggerFromStrings($entry['type'], $entry['value'], $entry['stopProcessing']);$self->triggers->push($trigger);}diff --git a/app/TransactionRules/Triggers/AmountMore.php b/app/TransactionRules/Triggers/AmountMore.phpindex a56d9cede5..545542b279 100644--- a/app/TransactionRules/Triggers/AmountMore.php+++ b/app/TransactionRules/Triggers/AmountMore.php@@ -50,7 +50,7 @@ final class AmountMore extends AbstractTrigger implements TriggerInterfacepublic static function willMatchEverything($value = null){if (null !== $value) {- $res = 0 === bccomp('0', strval($value));+ $res = 0 === bccomp('0', (string)$value);if (true === $res) {Log::error(sprintf('Cannot use %s with a value equal to 0.', self::class));}diff --git a/app/TransactionRules/Triggers/DescriptionContains.php b/app/TransactionRules/Triggers/DescriptionContains.phpindex d055699e2f..7a58121418 100644--- a/app/TransactionRules/Triggers/DescriptionContains.php+++ b/app/TransactionRules/Triggers/DescriptionContains.php@@ -49,7 +49,7 @@ final class DescriptionContains extends AbstractTrigger implements TriggerInterfpublic static function willMatchEverything($value = null){if (null !== $value) {- $res = '' === strval($value);+ $res = '' === (string)$value;if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}diff --git a/app/TransactionRules/Triggers/DescriptionEnds.php b/app/TransactionRules/Triggers/DescriptionEnds.phpindex cb6c53c00f..e4bbf5b71d 100644--- a/app/TransactionRules/Triggers/DescriptionEnds.php+++ b/app/TransactionRules/Triggers/DescriptionEnds.php@@ -49,7 +49,7 @@ final class DescriptionEnds extends AbstractTrigger implements TriggerInterfacepublic static function willMatchEverything($value = null){if (null !== $value) {- $res = '' === strval($value);+ $res = '' === (string)$value;if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}diff --git a/app/TransactionRules/Triggers/DescriptionStarts.php b/app/TransactionRules/Triggers/DescriptionStarts.phpindex 075a0d8441..d795004605 100644--- a/app/TransactionRules/Triggers/DescriptionStarts.php+++ b/app/TransactionRules/Triggers/DescriptionStarts.php@@ -49,7 +49,7 @@ final class DescriptionStarts extends AbstractTrigger implements TriggerInterfacpublic static function willMatchEverything($value = null){if (null !== $value) {- $res = '' === strval($value);+ $res = '' === (string)$value;if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}diff --git a/app/TransactionRules/Triggers/FromAccountContains.php b/app/TransactionRules/Triggers/FromAccountContains.phpindex ecb4ef0eab..2434fdd217 100644--- a/app/TransactionRules/Triggers/FromAccountContains.php+++ b/app/TransactionRules/Triggers/FromAccountContains.php@@ -50,7 +50,7 @@ final class FromAccountContains extends AbstractTrigger implements TriggerInterfpublic static function willMatchEverything($value = null){if (null !== $value) {- $res = '' === strval($value);+ $res = '' === (string)$value;if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}diff --git a/app/TransactionRules/Triggers/FromAccountEnds.php b/app/TransactionRules/Triggers/FromAccountEnds.phpindex c18fc72c1d..16f1393a23 100644--- a/app/TransactionRules/Triggers/FromAccountEnds.php+++ b/app/TransactionRules/Triggers/FromAccountEnds.php@@ -50,7 +50,7 @@ final class FromAccountEnds extends AbstractTrigger implements TriggerInterfacepublic static function willMatchEverything($value = null){if (null !== $value) {- $res = '' === strval($value);+ $res = '' === (string)$value;if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}diff --git a/app/TransactionRules/Triggers/FromAccountIs.php b/app/TransactionRules/Triggers/FromAccountIs.phpindex 4e1810297b..100ba5970e 100644--- a/app/TransactionRules/Triggers/FromAccountIs.php+++ b/app/TransactionRules/Triggers/FromAccountIs.php@@ -50,7 +50,7 @@ final class FromAccountIs extends AbstractTrigger implements TriggerInterfacepublic static function willMatchEverything($value = null){if (null !== $value) {- $res = '' === strval($value);+ $res = '' === (string)$value;if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}diff --git a/app/TransactionRules/Triggers/FromAccountStarts.php b/app/TransactionRules/Triggers/FromAccountStarts.phpindex 0d15c40dae..cc12f8fcfb 100644--- a/app/TransactionRules/Triggers/FromAccountStarts.php+++ b/app/TransactionRules/Triggers/FromAccountStarts.php@@ -50,7 +50,7 @@ final class FromAccountStarts extends AbstractTrigger implements TriggerInterfacpublic static function willMatchEverything($value = null){if (null !== $value) {- $res = '' === strval($value);+ $res = '' === (string)$value;if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}diff --git a/app/TransactionRules/Triggers/HasAttachment.php b/app/TransactionRules/Triggers/HasAttachment.phpindex f415e7ea22..0dba22509b 100644--- a/app/TransactionRules/Triggers/HasAttachment.php+++ b/app/TransactionRules/Triggers/HasAttachment.php@@ -48,12 +48,9 @@ class HasAttachment extends AbstractTrigger implements TriggerInterface*/public static function willMatchEverything($value = null){- $value = intval($value);- if ($value < 0) {- return true;- }+ $value = (int)$value;- return false;+ return $value < 0;}/**@@ -65,7 +62,7 @@ class HasAttachment extends AbstractTrigger implements TriggerInterface*/public function triggered(TransactionJournal $journal): bool{- $minimum = intval($this->triggerValue);+ $minimum = (int)$this->triggerValue;$attachments = $journal->attachments()->count();if ($attachments >= $minimum) {Log::debug(diff --git a/app/TransactionRules/Triggers/NotesContain.php b/app/TransactionRules/Triggers/NotesContain.phpindex e17babae41..68aa90ec86 100644--- a/app/TransactionRules/Triggers/NotesContain.php+++ b/app/TransactionRules/Triggers/NotesContain.php@@ -50,7 +50,7 @@ final class NotesContain extends AbstractTrigger implements TriggerInterfacepublic static function willMatchEverything($value = null){if (null !== $value) {- $res = '' === strval($value);+ $res = '' === (string)$value;if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}diff --git a/app/TransactionRules/Triggers/NotesEnd.php b/app/TransactionRules/Triggers/NotesEnd.phpindex 08cc86e290..4929b29ad2 100644--- a/app/TransactionRules/Triggers/NotesEnd.php+++ b/app/TransactionRules/Triggers/NotesEnd.php@@ -50,7 +50,7 @@ final class NotesEnd extends AbstractTrigger implements TriggerInterfacepublic static function willMatchEverything($value = null){if (null !== $value) {- $res = '' === strval($value);+ $res = '' === (string)$value;if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}diff --git a/app/TransactionRules/Triggers/NotesStart.php b/app/TransactionRules/Triggers/NotesStart.phpindex 3e0defa274..3631143312 100644--- a/app/TransactionRules/Triggers/NotesStart.php+++ b/app/TransactionRules/Triggers/NotesStart.php@@ -50,7 +50,7 @@ final class NotesStart extends AbstractTrigger implements TriggerInterfacepublic static function willMatchEverything($value = null){if (null !== $value) {- $res = '' === strval($value);+ $res = '' === (string)$value;if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}diff --git a/app/TransactionRules/Triggers/ToAccountContains.php b/app/TransactionRules/Triggers/ToAccountContains.phpindex 1120880094..b0c78f7322 100644--- a/app/TransactionRules/Triggers/ToAccountContains.php+++ b/app/TransactionRules/Triggers/ToAccountContains.php@@ -50,7 +50,7 @@ final class ToAccountContains extends AbstractTrigger implements TriggerInterfacpublic static function willMatchEverything($value = null){if (null !== $value) {- $res = '' === strval($value);+ $res = '' === (string)$value;if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}diff --git a/app/TransactionRules/Triggers/ToAccountEnds.php b/app/TransactionRules/Triggers/ToAccountEnds.phpindex 17345f1322..d7ecefdbea 100644--- a/app/TransactionRules/Triggers/ToAccountEnds.php+++ b/app/TransactionRules/Triggers/ToAccountEnds.php@@ -50,7 +50,7 @@ final class ToAccountEnds extends AbstractTrigger implements TriggerInterfacepublic static function willMatchEverything($value = null){if (null !== $value) {- $res = '' === strval($value);+ $res = '' === (string)$value;if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}diff --git a/app/TransactionRules/Triggers/ToAccountIs.php b/app/TransactionRules/Triggers/ToAccountIs.phpindex 87b3831fea..5754527ef7 100644--- a/app/TransactionRules/Triggers/ToAccountIs.php+++ b/app/TransactionRules/Triggers/ToAccountIs.php@@ -50,7 +50,7 @@ final class ToAccountIs extends AbstractTrigger implements TriggerInterfacepublic static function willMatchEverything($value = null){if (null !== $value) {- $res = '' === strval($value);+ $res = '' === (string)$value;if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}diff --git a/app/TransactionRules/Triggers/ToAccountStarts.php b/app/TransactionRules/Triggers/ToAccountStarts.phpindex 4662760264..6867a95fa3 100644--- a/app/TransactionRules/Triggers/ToAccountStarts.php+++ b/app/TransactionRules/Triggers/ToAccountStarts.php@@ -50,7 +50,7 @@ final class ToAccountStarts extends AbstractTrigger implements TriggerInterfacepublic static function willMatchEverything($value = null){if (null !== $value) {- $res = '' === strval($value);+ $res = '' === (string)$value;if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}diff --git a/app/TransactionRules/Triggers/TransactionType.php b/app/TransactionRules/Triggers/TransactionType.phpindex a5a2c3d2c6..7d3d033197 100644--- a/app/TransactionRules/Triggers/TransactionType.php+++ b/app/TransactionRules/Triggers/TransactionType.php@@ -65,7 +65,7 @@ final class TransactionType extends AbstractTrigger implements TriggerInterface*/public function triggered(TransactionJournal $journal): bool{- $type = null !== $journal->transaction_type_type ? $journal->transaction_type_type : strtolower($journal->transactionType->type);+ $type = $journal->transaction_type_type ?? strtolower($journal->transactionType->type);$search = strtolower($this->triggerValue);if ($type === $search) {diff --git a/app/Transformers/AccountTransformer.php b/app/Transformers/AccountTransformer.phpindex 6f64a76e39..28ccc35829 100644--- a/app/Transformers/AccountTransformer.php+++ b/app/Transformers/AccountTransformer.php@@ -101,7 +101,7 @@ class AccountTransformer extends TransformerAbstract*/public function includeTransactions(Account $account): FractalCollection{- $pageSize = intval(app('preferences')->getForUser($account->user, 'listPageSize', 50)->data);+ $pageSize = (int)app('preferences')->getForUser($account->user, 'listPageSize', 50)->data;// journals always use collector and limited using URL parameters.$collector = app(JournalCollectorInterface::class);@@ -112,7 +112,7 @@ class AccountTransformer extends TransformerAbstract} else {$collector->setOpposingAccounts(new Collection([$account]));}- if (!is_null($this->parameters->get('start')) && !is_null($this->parameters->get('end'))) {+ if (null !== $this->parameters->get('start') && null !== $this->parameters->get('end')) {$collector->setRange($this->parameters->get('start'), $this->parameters->get('end'));}$collector->setLimit($pageSize)->setPage($this->parameters->get('page'));@@ -151,7 +151,7 @@ class AccountTransformer extends TransformerAbstractif (strlen($role) === 0 || $type !== AccountType::ASSET) {$role = null;}- $currencyId = intval($this->repository->getMetaValue($account, 'currency_id'));+ $currencyId = (int)$this->repository->getMetaValue($account, 'currency_id');$currencyCode = null;$decimalPlaces = 2;if ($currencyId > 0) {@@ -161,7 +161,7 @@ class AccountTransformer extends TransformerAbstract}$date = new Carbon;- if (!is_null($this->parameters->get('date'))) {+ if (null !== $this->parameters->get('date')) {$date = $this->parameters->get('date');}@@ -183,7 +183,7 @@ class AccountTransformer extends TransformerAbstract$repository = app(AccountRepositoryInterface::class);$repository->setUser($account->user);$amount = $repository->getOpeningBalanceAmount($account);- $openingBalance = is_null($amount) ? null : round($amount, $decimalPlaces);+ $openingBalance = null === $amount ? null : round($amount, $decimalPlaces);$openingBalanceDate = $repository->getOpeningBalanceDate($account);}@@ -192,7 +192,7 @@ class AccountTransformer extends TransformerAbstract'updated_at' => $account->updated_at->toAtomString(),'created_at' => $account->created_at->toAtomString(),'name' => $account->name,- 'active' => intval($account->active) === 1,+ 'active' => (int)$account->active === 1,'type' => $type,'currency_id' => $currencyId,'currency_code' => $currencyCode,diff --git a/app/Transformers/BillTransformer.php b/app/Transformers/BillTransformer.phpindex 45b9a89182..80572eca0b 100644--- a/app/Transformers/BillTransformer.php+++ b/app/Transformers/BillTransformer.php@@ -93,7 +93,7 @@ class BillTransformer extends TransformerAbstract*/public function includeTransactions(Bill $bill): FractalCollection{- $pageSize = intval(app('preferences')->getForUser($bill->user, 'listPageSize', 50)->data);+ $pageSize = (int)app('preferences')->getForUser($bill->user, 'listPageSize', 50)->data;// journals always use collector and limited using URL parameters.$collector = app(JournalCollectorInterface::class);@@ -101,7 +101,7 @@ class BillTransformer extends TransformerAbstract$collector->withOpposingAccount()->withCategoryInformation()->withBudgetInformation();$collector->setAllAssetAccounts();$collector->setBills(new Collection([$bill]));- if (!is_null($this->parameters->get('start')) && !is_null($this->parameters->get('end'))) {+ if (null !== $this->parameters->get('start') && null !== $this->parameters->get('end')) {$collector->setRange($this->parameters->get('start'), $this->parameters->get('end'));}$collector->setLimit($pageSize)->setPage($this->parameters->get('page'));@@ -145,8 +145,8 @@ class BillTransformer extends TransformerAbstract'date' => $bill->date->format('Y-m-d'),'repeat_freq' => $bill->repeat_freq,'skip' => (int)$bill->skip,- 'automatch' => intval($bill->automatch) === 1,- 'active' => intval($bill->active) === 1,+ 'automatch' => (int)$bill->automatch === 1,+ 'active' => (int)$bill->active === 1,'attachments_count' => $bill->attachments()->count(),'pay_dates' => $payDates,'paid_dates' => $paidData['paid_dates'],@@ -161,7 +161,7 @@ class BillTransformer extends TransformerAbstract];/** @var Note $note */$note = $bill->notes()->first();- if (!is_null($note)) {+ if (null !== $note) {$data['notes'] = $note->text;}@@ -222,7 +222,7 @@ class BillTransformer extends TransformerAbstractprotected function paidData(Bill $bill): array{Log::debug(sprintf('Now in paidData for bill #%d', $bill->id));- if (is_null($this->parameters->get('start')) || is_null($this->parameters->get('end'))) {+ if (null === $this->parameters->get('start') || null === $this->parameters->get('end')) {Log::debug('parameters are NULL, return empty array');return [@@ -267,7 +267,7 @@ class BillTransformer extends TransformerAbstract*/protected function payDates(Bill $bill): array{- if (is_null($this->parameters->get('start')) || is_null($this->parameters->get('end'))) {+ if (null === $this->parameters->get('start') || null === $this->parameters->get('end')) {return [];}$set = new Collection;diff --git a/app/Transformers/BudgetTransformer.php b/app/Transformers/BudgetTransformer.phpindex 7fc3d82db7..698c3009b8 100644--- a/app/Transformers/BudgetTransformer.php+++ b/app/Transformers/BudgetTransformer.php@@ -75,7 +75,7 @@ class BudgetTransformer extends TransformerAbstract*/public function includeTransactions(Budget $budget): FractalCollection{- $pageSize = intval(app('preferences')->getForUser($budget->user, 'listPageSize', 50)->data);+ $pageSize = (int)app('preferences')->getForUser($budget->user, 'listPageSize', 50)->data;// journals always use collector and limited using URL parameters.$collector = app(JournalCollectorInterface::class);@@ -83,7 +83,7 @@ class BudgetTransformer extends TransformerAbstract$collector->withOpposingAccount()->withCategoryInformation()->withBudgetInformation();$collector->setAllAssetAccounts();$collector->setBudgets(new Collection([$budget]));- if (!is_null($this->parameters->get('start')) && !is_null($this->parameters->get('end'))) {+ if (null !== $this->parameters->get('start') && null !== $this->parameters->get('end')) {$collector->setRange($this->parameters->get('start'), $this->parameters->get('end'));}$collector->setLimit($pageSize)->setPage($this->parameters->get('page'));@@ -118,7 +118,7 @@ class BudgetTransformer extends TransformerAbstract'id' => (int)$budget->id,'updated_at' => $budget->updated_at->toAtomString(),'created_at' => $budget->created_at->toAtomString(),- 'active' => intval($budget->active) === 1,+ 'active' => (int)$budget->active === 1,'name' => $budget->name,'links' => [[diff --git a/app/Transformers/CategoryTransformer.php b/app/Transformers/CategoryTransformer.phpindex 8c7ea8d6dc..3d7de337c9 100644--- a/app/Transformers/CategoryTransformer.php+++ b/app/Transformers/CategoryTransformer.php@@ -75,7 +75,7 @@ class CategoryTransformer extends TransformerAbstract*/public function includeTransactions(Category $category): FractalCollection{- $pageSize = intval(app('preferences')->getForUser($category->user, 'listPageSize', 50)->data);+ $pageSize = (int)app('preferences')->getForUser($category->user, 'listPageSize', 50)->data;// journals always use collector and limited using URL parameters.$collector = app(JournalCollectorInterface::class);@@ -83,7 +83,7 @@ class CategoryTransformer extends TransformerAbstract$collector->withOpposingAccount()->withCategoryInformation()->withCategoryInformation();$collector->setAllAssetAccounts();$collector->setCategories(new Collection([$category]));- if (!is_null($this->parameters->get('start')) && !is_null($this->parameters->get('end'))) {+ if (null !== $this->parameters->get('start') && null !== $this->parameters->get('end')) {$collector->setRange($this->parameters->get('start'), $this->parameters->get('end'));}$collector->setLimit($pageSize)->setPage($this->parameters->get('page'));diff --git a/app/Transformers/JournalMetaTransformer.php b/app/Transformers/JournalMetaTransformer.phpindex 09de3a397a..6f54be2e2e 100644--- a/app/Transformers/JournalMetaTransformer.php+++ b/app/Transformers/JournalMetaTransformer.php@@ -75,7 +75,7 @@ class JournalMetaTransformer extends TransformerAbstractpublic function includeTransactions(TransactionJournalMeta $meta): FractalCollection{$journal = $meta->transactionJournal;- $pageSize = intval(app('preferences')->getForUser($journal->user, 'listPageSize', 50)->data);+ $pageSize = (int)app('preferences')->getForUser($journal->user, 'listPageSize', 50)->data;// journals always use collector and limited using URL parameters.$collector = app(JournalCollectorInterface::class);@@ -83,7 +83,7 @@ class JournalMetaTransformer extends TransformerAbstract$collector->withOpposingAccount()->withCategoryInformation()->withCategoryInformation();$collector->setAllAssetAccounts();$collector->setJournals(new Collection([$journal]));- if (!is_null($this->parameters->get('start')) && !is_null($this->parameters->get('end'))) {+ if (null !== $this->parameters->get('start') && null !== $this->parameters->get('end')) {$collector->setRange($this->parameters->get('start'), $this->parameters->get('end'));}$collector->setLimit($pageSize)->setPage($this->parameters->get('page'));diff --git a/app/Transformers/PiggyBankEventTransformer.php b/app/Transformers/PiggyBankEventTransformer.phpindex 2fad262ebd..a9b53ab085 100644--- a/app/Transformers/PiggyBankEventTransformer.php+++ b/app/Transformers/PiggyBankEventTransformer.php@@ -91,7 +91,7 @@ class PiggyBankEventTransformer extends TransformerAbstractpublic function includeTransaction(PiggyBankEvent $event): Item{$journal = $event->transactionJournal;- $pageSize = intval(app('preferences')->getForUser($journal->user, 'listPageSize', 50)->data);+ $pageSize = (int)app('preferences')->getForUser($journal->user, 'listPageSize', 50)->data;// journals always use collector and limited using URL parameters.$collector = app(JournalCollectorInterface::class);@@ -99,7 +99,7 @@ class PiggyBankEventTransformer extends TransformerAbstract$collector->withOpposingAccount()->withCategoryInformation()->withCategoryInformation();$collector->setAllAssetAccounts();$collector->setJournals(new Collection([$journal]));- if (!is_null($this->parameters->get('start')) && !is_null($this->parameters->get('end'))) {+ if (null !== $this->parameters->get('start') && null !== $this->parameters->get('end')) {$collector->setRange($this->parameters->get('start'), $this->parameters->get('end'));}$collector->setLimit($pageSize)->setPage($this->parameters->get('page'));@@ -118,7 +118,7 @@ class PiggyBankEventTransformer extends TransformerAbstractpublic function transform(PiggyBankEvent $event): array{$account = $event->piggyBank->account;- $currencyId = intval($account->getMeta('currency_id'));+ $currencyId = (int)$account->getMeta('currency_id');$decimalPlaces = 2;if ($currencyId > 0) {/** @var CurrencyRepositoryInterface $repository */diff --git a/app/Transformers/PiggyBankTransformer.php b/app/Transformers/PiggyBankTransformer.phpindex dba7617104..02a4831c8d 100644--- a/app/Transformers/PiggyBankTransformer.php+++ b/app/Transformers/PiggyBankTransformer.php@@ -117,7 +117,7 @@ class PiggyBankTransformer extends TransformerAbstractpublic function transform(PiggyBank $piggyBank): array{$account = $piggyBank->account;- $currencyId = intval($account->getMeta('currency_id'));+ $currencyId = (int)$account->getMeta('currency_id');$decimalPlaces = 2;if ($currencyId > 0) {/** @var CurrencyRepositoryInterface $repository */@@ -133,8 +133,8 @@ class PiggyBankTransformer extends TransformerAbstract$piggyRepos->setUser($account->user);$currentAmount = round($piggyRepos->getCurrentAmount($piggyBank), $decimalPlaces);- $startDate = is_null($piggyBank->startdate) ? null : $piggyBank->startdate->format('Y-m-d');- $targetDate = is_null($piggyBank->targetdate) ? null : $piggyBank->targetdate->format('Y-m-d');+ $startDate = null === $piggyBank->startdate ? null : $piggyBank->startdate->format('Y-m-d');+ $targetDate = null === $piggyBank->targetdate ? null : $piggyBank->targetdate->format('Y-m-d');$targetAmount = round($piggyBank->targetamount, $decimalPlaces);$data = ['id' => (int)$piggyBank->id,@@ -146,7 +146,7 @@ class PiggyBankTransformer extends TransformerAbstract'startdate' => $startDate,'targetdate' => $targetDate,'order' => (int)$piggyBank->order,- 'active' => intval($piggyBank->active) === 1,+ 'active' => (int)$piggyBank->active === 1,'notes' => null,'links' => [[@@ -157,7 +157,7 @@ class PiggyBankTransformer extends TransformerAbstract];/** @var Note $note */$note = $piggyBank->notes()->first();- if (!is_null($note)) {+ if (null !== $note) {$data['notes'] = $note->text;}diff --git a/app/Transformers/TagTransformer.php b/app/Transformers/TagTransformer.phpindex d57b6f2599..19ce472453 100644--- a/app/Transformers/TagTransformer.php+++ b/app/Transformers/TagTransformer.php@@ -74,7 +74,7 @@ class TagTransformer extends TransformerAbstract*/public function includeTransactions(Tag $tag): FractalCollection{- $pageSize = intval(app('preferences')->getForUser($tag->user, 'listPageSize', 50)->data);+ $pageSize = (int)app('preferences')->getForUser($tag->user, 'listPageSize', 50)->data;// journals always use collector and limited using URL parameters.$collector = app(JournalCollectorInterface::class);@@ -82,7 +82,7 @@ class TagTransformer extends TransformerAbstract$collector->withOpposingAccount()->withCategoryInformation()->withCategoryInformation();$collector->setAllAssetAccounts();$collector->setTag($tag);- if (!is_null($this->parameters->get('start')) && !is_null($this->parameters->get('end'))) {+ if (null !== $this->parameters->get('start') && null !== $this->parameters->get('end')) {$collector->setRange($this->parameters->get('start'), $this->parameters->get('end'));}$collector->setLimit($pageSize)->setPage($this->parameters->get('page'));@@ -113,7 +113,7 @@ class TagTransformer extends TransformerAbstract*/public function transform(Tag $tag): array{- $date = is_null($tag->date) ? null : $tag->date->format('Y-m-d');+ $date = null === $tag->date ? null : $tag->date->format('Y-m-d');$data = ['id' => (int)$tag->id,'updated_at' => $tag->updated_at->toAtomString(),diff --git a/app/Transformers/TransactionTransformer.php b/app/Transformers/TransactionTransformer.phpindex 29a1333ad9..4f028bc60e 100644--- a/app/Transformers/TransactionTransformer.php+++ b/app/Transformers/TransactionTransformer.php@@ -157,21 +157,21 @@ class TransactionTransformer extends TransformerAbstract$categoryName = null;$budgetId = null;$budgetName = null;- $categoryId = is_null($transaction->transaction_category_id) ? $transaction->transaction_journal_category_id+ $categoryId = null === $transaction->transaction_category_id ? $transaction->transaction_journal_category_id: $transaction->transaction_category_id;- $categoryName = is_null($transaction->transaction_category_name) ? $transaction->transaction_journal_category_name+ $categoryName = null === $transaction->transaction_category_name ? $transaction->transaction_journal_category_name: $transaction->transaction_category_name;if ($transaction->transaction_type_type === TransactionType::WITHDRAWAL) {- $budgetId = is_null($transaction->transaction_budget_id) ? $transaction->transaction_journal_budget_id+ $budgetId = null === $transaction->transaction_budget_id ? $transaction->transaction_journal_budget_id: $transaction->transaction_budget_id;- $budgetName = is_null($transaction->transaction_budget_name) ? $transaction->transaction_journal_budget_name+ $budgetName = null === $transaction->transaction_budget_name ? $transaction->transaction_journal_budget_name: $transaction->transaction_budget_name;}/** @var Note $dbNote */$dbNote = $transaction->transactionJournal->notes()->first();$notes = null;- if (!is_null($dbNote)) {+ if (null !== $dbNote) {$notes = $dbNote->text;}@@ -186,7 +186,7 @@ class TransactionTransformer extends TransformerAbstract'identifier' => $transaction->identifier,'journal_id' => (int)$transaction->journal_id,'reconciled' => (bool)$transaction->reconciled,- 'amount' => round($transaction->transaction_amount, intval($transaction->transaction_currency_dp)),+ 'amount' => round($transaction->transaction_amount, (int)$transaction->transaction_currency_dp),'currency_id' => $transaction->transaction_currency_id,'currency_code' => $transaction->transaction_currency_code,'currency_symbol' => $transaction->transaction_currency_symbol,@@ -212,8 +212,8 @@ class TransactionTransformer extends TransformerAbstract];// expand foreign amount:- if (!is_null($transaction->transaction_foreign_amount)) {- $data['foreign_amount'] = round($transaction->transaction_foreign_amount, intval($transaction->foreign_currency_dp));+ if (null !== $transaction->transaction_foreign_amount) {+ $data['foreign_amount'] = round($transaction->transaction_foreign_amount, (int)$transaction->foreign_currency_dp);}// switch on type for consistency@@ -251,7 +251,7 @@ class TransactionTransformer extends TransformerAbstract}// expand description.- if (strlen(strval($transaction->transaction_description)) > 0) {+ if (strlen((string)$transaction->transaction_description) > 0) {$data['description'] = $transaction->transaction_description . ' (' . $transaction->description . ')';}diff --git a/app/Transformers/UserTransformer.php b/app/Transformers/UserTransformer.phpindex 902c601f1a..dadb23fb94 100644--- a/app/Transformers/UserTransformer.php+++ b/app/Transformers/UserTransformer.php@@ -184,7 +184,7 @@ class UserTransformer extends TransformerAbstract{/** @var Role $role */$role = $user->roles()->first();- if (!is_null($role)) {+ if (null !== $role) {$role = $role->name;}@@ -193,7 +193,7 @@ class UserTransformer extends TransformerAbstract'updated_at' => $user->updated_at->toAtomString(),'created_at' => $user->created_at->toAtomString(),'email' => $user->email,- 'blocked' => intval($user->blocked) === 1,+ 'blocked' => (int)$user->blocked === 1,'blocked_code' => $user->blocked_code,'role' => $role,'links' => [diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.phpindex 061857c346..e72472c99d 100644--- a/app/Validation/FireflyValidator.php+++ b/app/Validation/FireflyValidator.php@@ -37,7 +37,6 @@ use FireflyIII\TransactionRules\Triggers\TriggerInterface;use FireflyIII\User;use Google2FA;use Illuminate\Contracts\Encryption\DecryptException;-use Illuminate\Contracts\Translation\Translator;use Illuminate\Validation\Validator;/**@@ -45,18 +44,6 @@ use Illuminate\Validation\Validator;*/class FireflyValidator extends Validator{- /**- * @param Translator $translator- * @param array $data- * @param array $rules- * @param array $messages- * @param array $customAttributes- */- public function __construct(Translator $translator, array $data, array $rules, array $messages = [], array $customAttributes = [])- {- parent::__construct($translator, $data, $rules, $messages, $customAttributes);- }-/*** @SuppressWarnings(PHPMD.UnusedFormalParameter)*@@ -89,7 +76,7 @@ class FireflyValidator extends Validator{$field = $parameters[1] ?? 'id';- if (0 === intval($value)) {+ if (0 === (int)$value) {return true;}$count = DB::table($parameters[0])->where('user_id', auth()->user()->id)->where($field, $value)->count();@@ -196,7 +183,7 @@ class FireflyValidator extends Validator$iban = str_replace($search, $replace, $iban);$checksum = bcmod($iban, '97');- return 1 === intval($checksum);+ return 1 === (int)$checksum;}/**@@ -209,9 +196,9 @@ class FireflyValidator extends Validator*/public function validateMore($attribute, $value, $parameters): bool{- $compare = strval($parameters[0] ?? '0');+ $compare = (string)$parameters[0] ?? '0';- return bccomp(strval($value), $compare) > 0;+ return bccomp((string)$value, $compare) > 0;}/**@@ -227,7 +214,7 @@ class FireflyValidator extends Validator{$field = $parameters[1] ?? 'id';- if (0 === intval($value)) {+ if (0 === (int)$value) {return true;}$count = DB::table($parameters[0])->where($field, $value)->count();@@ -333,7 +320,7 @@ class FireflyValidator extends Validator{$verify = false;if (isset($this->data['verify_password'])) {- $verify = 1 === intval($this->data['verify_password']);+ $verify = 1 === (int)$this->data['verify_password'];}if ($verify) {/** @var Verifier $service */@@ -389,9 +376,9 @@ class FireflyValidator extends Validator*/public function validateUniqueAccountNumberForUser($attribute, $value, $parameters): bool{- $accountId = $this->data['id'] ?? 0;+ $accountId = (int)($this->data['id'] ?? 0.0);if ($accountId === 0) {- $accountId = $parameters[0] ?? 0;+ $accountId = (int)($parameters[0] ?? 0.0);}$query = AccountMeta::leftJoin('accounts', 'accounts.id', '=', 'account_meta.account_id')@@ -399,9 +386,9 @@ class FireflyValidator extends Validator->where('accounts.user_id', auth()->user()->id)->where('account_meta.name', 'accountNumber');- if (intval($accountId) > 0) {+ if ((int)$accountId > 0) {// exclude current account from check.- $query->where('account_meta.account_id', '!=', intval($accountId));+ $query->where('account_meta.account_id', '!=', (int)$accountId);}$set = $query->get(['account_meta.*']);@@ -435,15 +422,15 @@ class FireflyValidator extends Validator// exclude?$table = $parameters[0];$field = $parameters[1];- $exclude = $parameters[2] ?? 0;+ $exclude = (int)($parameters[2] ?? 0.0);/** If other data (in $this->getData()) contains* ID field, set that field to be the $exclude.*/$data = $this->getData();- if (!isset($parameters[2]) && isset($data['id']) && intval($data['id']) > 0) {- $exclude = intval($data['id']);+ if (!isset($parameters[2]) && isset($data['id']) && (int)$data['id'] > 0) {+ $exclude = (int)$data['id'];}@@ -586,7 +573,7 @@ class FireflyValidator extends Validatorprivate function validateByAccountTypeId($value, $parameters): bool{$type = AccountType::find($this->data['account_type_id'])->first();- $ignore = $parameters[0] ?? 0;+ $ignore = (int)($parameters[0] ?? 0.0);$value = $this->tryDecrypt($value);$set = auth()->user()->accounts()->where('account_type_id', $type->id)->where('id', '!=', $ignore)->get();@@ -611,7 +598,7 @@ class FireflyValidator extends Validator{$search = Config::get('firefly.accountTypeByIdentifier.' . $type);$accountType = AccountType::whereType($search)->first();- $ignore = $parameters[0] ?? 0;+ $ignore = (int)($parameters[0] ?? 0.0);$set = auth()->user()->accounts()->where('account_type_id', $accountType->id)->where('id', '!=', $ignore)->get();/** @var Account $entry */