From c23a81e778e5c2514b5c5fa79b5c0b6234f521c3 Mon Sep 17 00:00:00 2001
From: Henning <leutz@pcsg.de>
Date: Mon, 24 Mar 2025 15:20:52 +0100
Subject: [PATCH] refactor: improve code readability by formatting type
 declarations

In this commit, we've made minor changes to various PHP files in the project in order to improve
code readability. We've standardized the formatting for type declarations (bool, float, int,
string, array) to be separated by a whitespace character on either side of the `|` symbol where
more than one type is possible. No functionality has changed in this commit - this is purely for
ease of reading and maintaining the code base.
---
 src/QUI/ERP/Currency/AbstractCurrency.php | 10 +++++-----
 src/QUI/ERP/Currency/Calc.php             | 18 +++++++++---------
 src/QUI/ERP/Currency/Conf.php             |  2 +-
 src/QUI/ERP/Currency/Currency.php         |  2 +-
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/QUI/ERP/Currency/AbstractCurrency.php b/src/QUI/ERP/Currency/AbstractCurrency.php
index 429715a..1bc053c 100644
--- a/src/QUI/ERP/Currency/AbstractCurrency.php
+++ b/src/QUI/ERP/Currency/AbstractCurrency.php
@@ -46,7 +46,7 @@ abstract class AbstractCurrency implements CurrencyInterface
     /**
      * @var float|bool
      */
-    protected bool|float $exchangeRate = false;
+    protected bool | float $exchangeRate = false;
 
     /**
      * @var int
@@ -182,7 +182,7 @@ public function toArray(): array
      * @param null|QUI\Locale $Locale -optional
      * @return float
      */
-    public function amount($amount, null |QUI\Locale $Locale = null): float
+    public function amount($amount, null | QUI\Locale $Locale = null): float
     {
         if (is_float($amount) || is_int($amount)) {
             return $amount;
@@ -215,7 +215,7 @@ public function amount($amount, null |QUI\Locale $Locale = null): float
      * @param null|QUI\Locale $Locale - optional, locale object
      * @return string
      */
-    public function format($amount, null|QUI\Locale $Locale = null): string
+    public function format($amount, null | QUI\Locale $Locale = null): string
     {
         if (!$Locale) {
             $Locale = $this->Locale;
@@ -279,7 +279,7 @@ public function autoupdate(): bool
      *
      * @throws Exception
      */
-    public function convert($amount, $Currency): float|int|string
+    public function convert($amount, $Currency): float | int | string
     {
         if (!is_numeric($amount)) {
             QUI\System\Log::addError('Only numeric are allowed Currency->convert()', [
@@ -347,7 +347,7 @@ public function convertFormat($amount, $Currency): string
      * @param boolean|string|Currency $Currency - optional, default = false -> return own exchange rate
      * @return float|boolean
      */
-    public function getExchangeRate($Currency = false): float|bool
+    public function getExchangeRate($Currency = false): float | bool
     {
         if ($Currency === false) {
             return $this->exchangeRate;
diff --git a/src/QUI/ERP/Currency/Calc.php b/src/QUI/ERP/Currency/Calc.php
index 203012f..6123952 100644
--- a/src/QUI/ERP/Currency/Calc.php
+++ b/src/QUI/ERP/Currency/Calc.php
@@ -26,9 +26,9 @@ class Calc
      * @throws QUI\Exception
      */
     public static function convert(
-        float|int|string $amount,
-        Currency|array|string $currencyFrom,
-        Currency|array|string $currencyTo = 'EUR'
+        float | int | string $amount,
+        Currency | array | string $currencyFrom,
+        Currency | array | string $currencyTo = 'EUR'
     ): float {
         $From = Handler::getCurrency($currencyFrom);
         $To = Handler::getCurrency($currencyTo);
@@ -47,9 +47,9 @@ public static function convert(
      * @throws QUI\Exception
      */
     public static function convertWithSign(
-        float|int|string $amount,
-        Currency|array|string $currencyFrom,
-        Currency|array|string $currencyTo = 'EUR'
+        float | int | string $amount,
+        Currency | array | string $currencyFrom,
+        Currency | array | string $currencyTo = 'EUR'
     ): string {
         $From = Handler::getCurrency($currencyFrom);
         $To = Handler::getCurrency($currencyTo);
@@ -67,9 +67,9 @@ public static function convertWithSign(
      * @throws QUI\Exception
      */
     public static function getExchangeRateBetween(
-        Currency|array|string $currencyFrom,
-        Currency|array|string $currencyTo
-    ): float|bool {
+        Currency | array | string $currencyFrom,
+        Currency | array | string $currencyTo
+    ): float | bool {
         $From = Handler::getCurrency($currencyFrom);
         $To = Handler::getCurrency($currencyTo);
 
diff --git a/src/QUI/ERP/Currency/Conf.php b/src/QUI/ERP/Currency/Conf.php
index 1f15810..801e357 100644
--- a/src/QUI/ERP/Currency/Conf.php
+++ b/src/QUI/ERP/Currency/Conf.php
@@ -52,7 +52,7 @@ public static function getAccountingCurrency(): ?Currency
      *
      * @return array|bool|string
      */
-    public static function conf(string $section, ?string $key): bool|array|string
+    public static function conf(string $section, ?string $key): bool | array | string
     {
         try {
             $Package = QUI::getPackage('quiqqer/currency');
diff --git a/src/QUI/ERP/Currency/Currency.php b/src/QUI/ERP/Currency/Currency.php
index 52d55f3..a35ac79 100644
--- a/src/QUI/ERP/Currency/Currency.php
+++ b/src/QUI/ERP/Currency/Currency.php
@@ -23,7 +23,7 @@ class Currency extends AbstractCurrency
      * @param QUI\Locale|null $Locale
      * @return string
      */
-    public static function getCurrencyTypeTitle(?QUI\Locale $Locale = null): string
+    public static function getCurrencyTypeTitle(null | QUI\Locale $Locale = null): string
     {
         if (empty($Locale)) {
             $Locale = QUI::getLocale();
-- 
GitLab