Skip to content
Code-Schnipsel Gruppen Projekte
Commit c23a81e7 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

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.
Übergeordneter a9242ad2
No related branches found
No related tags found
2 Merge Requests!54Update 'next-3.x' with latest changes from 'main',!53feat(Currency.js): get default currency
Pipeline #16540 bestanden mit Phase
in 2 Minuten und 37 Sekunden
......@@ -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;
......
......@@ -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);
......
......@@ -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');
......
......@@ -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();
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren