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

fix(phpstan): php8.4 null deprecated

Related: #103
Übergeordneter 1d048c81
No related branches found
No related tags found
2 Merge Requests!170Update 'next-4.x' with latest changes from 'main',!169fix(phpstan): added exception handling for missing html2pdf module in OutputTemplate
Pipeline #15502 mit Warnungen bestanden mit Phase
in 2 Minuten und 49 Sekunden
werden angezeigt mit 137 Ergänzungen und 476 Löschungen
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpstan" version="1.11.8" installed="1.11.8" location="./tools/phpstan" copy="false"/>
<phar name="phpstan" version="1.*" installed="1.12.13" location="./tools/phpstan" copy="false"/>
<phar name="phpunit" version="^10.5.20" installed="10.5.20" location="./tools/phpunit" copy="false"/>
<phar name="phpcs" version="^3.10.1" installed="3.10.1" location="./tools/phpcs" copy="false"/>
<phar name="phpcbf" version="^3.10.1" installed="3.10.1" location="./tools/phpcbf" copy="false"/>
......
parameters:
ignoreErrors:
-
message: "#^Else branch is unreachable because previous condition is always true\\.$#"
count: 1
path: ajax/calcBruttoPrice.php
-
message: "#^Elseif branch is unreachable because previous condition is always true\\.$#"
count: 1
path: ajax/calcBruttoPrice.php
-
message: "#^Instanceof between \\*NEVER\\* and QUI\\\\ERP\\\\Tax\\\\TaxEntry will always evaluate to false\\.$#"
count: 1
path: ajax/calcBruttoPrice.php
-
message: "#^Binary operation \"\\*\" between string and \\(float\\|int\\) results in an error\\.$#"
count: 1
path: ajax/calcNettoPrice.php
-
message: "#^Else branch is unreachable because previous condition is always true\\.$#"
count: 1
path: ajax/calcNettoPrice.php
-
message: "#^Elseif branch is unreachable because previous condition is always true\\.$#"
count: 1
path: ajax/calcNettoPrice.php
-
message: "#^Instanceof between \\*NEVER\\* and QUI\\\\ERP\\\\Tax\\\\TaxEntry will always evaluate to false\\.$#"
count: 1
path: ajax/calcNettoPrice.php
-
message: "#^Parameter \\#1 \\$string of function substr expects string, float given\\.$#"
count: 1
path: ajax/calcNettoPrice.php
-
message: "#^Parameter \\#2 \\$string of function explode expects string, float given\\.$#"
count: 1
path: ajax/calcNettoPrice.php
-
message: "#^Method QUI\\\\ERP\\\\ErpEntityInterface\\:\\:getCustomerFiles\\(\\) invoked with 1 parameter, 0 required\\.$#"
count: 1
path: ajax/customerFiles/getFiles.php
-
message: "#^Parameter \\#9 \\$attachedMediaFiles of static method QUI\\\\ERP\\\\Output\\\\Output\\:\\:sendPdfViaMail\\(\\) expects array\\<QUI\\\\Projects\\\\Media\\\\File\\|QUI\\\\Projects\\\\Media\\\\Image\\>, array\\<int\\<0, max\\>, QUI\\\\Interfaces\\\\Projects\\\\Media\\\\File\\> given\\.$#"
count: 1
path: ajax/output/sendMail.php
-
message: "#^Method QUI\\\\ERP\\\\Accounting\\\\ArticleList\\:\\:getOrder\\(\\) has invalid return type QUI\\\\ERP\\\\Order\\\\AbstractOrder\\.$#"
count: 2
path: src/QUI/ERP/Accounting/ArticleList.php
-
message: "#^Parameter \\$Order of method QUI\\\\ERP\\\\Accounting\\\\ArticleList\\:\\:setOrder\\(\\) has invalid type QUI\\\\ERP\\\\Order\\\\AbstractOrder\\.$#"
count: 2
path: src/QUI/ERP/Accounting/ArticleList.php
-
message: "#^Property QUI\\\\ERP\\\\Accounting\\\\ArticleList\\:\\:\\$Order has unknown class QUI\\\\ERP\\\\Order\\\\AbstractOrder as its type\\.$#"
count: 2
path: src/QUI/ERP/Accounting/ArticleList.php
-
message: "#^Call to method getAttribute\\(\\) on an unknown class QUI\\\\ERP\\\\Order\\\\AbstractOrder\\.$#"
count: 1
path: src/QUI/ERP/Accounting/Calc.php
-
message: "#^Call to method getDeliveryAddress\\(\\) on an unknown class QUI\\\\ERP\\\\Order\\\\AbstractOrder\\.$#"
count: 1
path: src/QUI/ERP/Accounting/Calc.php
-
message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Handler\\.$#"
count: 1
path: src/QUI/ERP/Accounting/Calc.php
-
message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Handler\\.$#"
count: 1
path: src/QUI/ERP/Accounting/Calc.php
-
message: "#^Class QUI\\\\ERP\\\\Order\\\\AbstractOrder not found\\.$#"
count: 1
path: src/QUI/ERP/Accounting/Calc.php
-
message: "#^Offset 0 on array\\<string, mixed\\> in isset\\(\\) does not exist\\.$#"
count: 1
path: src/QUI/ERP/Accounting/Calc.php
-
message: "#^Offset 0 on array\\<string, string\\> in isset\\(\\) does not exist\\.$#"
count: 1
path: src/QUI/ERP/Accounting/Calc.php
-
message: "#^Parameter \\$Invoice of method QUI\\\\ERP\\\\Accounting\\\\Calc\\:\\:calculateInvoicePayments\\(\\) has invalid type QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice\\.$#"
count: 2
path: src/QUI/ERP/Accounting/Calc.php
-
message: "#^Parameter \\$Transaction of method QUI\\\\ERP\\\\ErpTransactionsInterface\\:\\:addTransaction\\(\\) has invalid type QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Transaction\\.$#"
count: 1
path: src/QUI/ERP/ErpTransactionsInterface.php
-
message: "#^Parameter \\$Transaction of method QUI\\\\ERP\\\\ErpTransactionsInterface\\:\\:linkTransaction\\(\\) has invalid type QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Transaction\\.$#"
count: 1
path: src/QUI/ERP/ErpTransactionsInterface.php
-
message: "#^Parameter \\#1 \\$code of method QUI\\\\Interfaces\\\\Users\\\\User\\:\\:activate\\(\\) expects string, false given\\.$#"
count: 1
path: src/QUI/ERP/Manufacturers.php
-
message: "#^Strict comparison using \\=\\=\\= between mixed and '' will always evaluate to false\\.$#"
count: 2
path: src/QUI/ERP/Manufacturers.php
-
message: "#^Call to method createPDF\\(\\) on an unknown class QUI\\\\HtmlToPdf\\\\Document\\.$#"
count: 1
path: src/QUI/ERP/Output/Output.php
-
message: "#^Method QUI\\\\ERP\\\\Output\\\\Output\\:\\:getDocumentPdf\\(\\) has invalid return type QUI\\\\HtmlToPdf\\\\Document\\.$#"
count: 2
path: src/QUI/ERP/Output/Output.php
-
message: "#^Call to method setContentHTML\\(\\) on an unknown class QUI\\\\HtmlToPdf\\\\Document\\.$#"
count: 1
path: src/QUI/ERP/Output/OutputTemplate.php
-
message: "#^Call to method setFooterHTML\\(\\) on an unknown class QUI\\\\HtmlToPdf\\\\Document\\.$#"
count: 1
path: src/QUI/ERP/Output/OutputTemplate.php
-
message: "#^Call to method setHeaderHTML\\(\\) on an unknown class QUI\\\\HtmlToPdf\\\\Document\\.$#"
count: 1
path: src/QUI/ERP/Output/OutputTemplate.php
-
message: "#^Instantiated class QUI\\\\HtmlToPdf\\\\Document not found\\.$#"
count: 1
path: src/QUI/ERP/Output/OutputTemplate.php
-
message: "#^Method QUI\\\\ERP\\\\Output\\\\OutputTemplate\\:\\:getPDFDocument\\(\\) has invalid return type QUI\\\\HtmlToPdf\\\\Document\\.$#"
count: 2
path: src/QUI/ERP/Output/OutputTemplate.php
-
message: "#^Call to method getAmountFormatted\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Transaction\\.$#"
count: 1
path: src/QUI/ERP/Process.php
-
message: "#^Call to method getAttribute\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice\\.$#"
count: 1
path: src/QUI/ERP/Process.php
-
message: "#^Call to method getAttribute\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#"
count: 1
path: src/QUI/ERP/Process.php
-
message: "#^Call to method getAttribute\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\Offer\\.$#"
count: 1
path: src/QUI/ERP/Process.php
-
message: "#^Call to method getDate\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Transaction\\.$#"
count: 1
path: src/QUI/ERP/Process.php
-
message: "#^Call to method getHash\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\Offer\\.$#"
count: 3
path: src/QUI/ERP/Process.php
-
message: "#^Call to method getHash\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Transaction\\.$#"
count: 2
path: src/QUI/ERP/Process.php
-
message: "#^Call to method getHistory\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice\\.$#"
count: 1
path: src/QUI/ERP/Process.php
-
message: "#^Call to method getHistory\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#"
count: 1
path: src/QUI/ERP/Process.php
-
message: "#^Call to method getHistory\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\Offer\\.$#"
count: 1
path: src/QUI/ERP/Process.php
-
message: "#^Call to method getPrefixedNumber\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice\\.$#"
count: 1
path: src/QUI/ERP/Process.php
-
message: "#^Call to method getPrefixedNumber\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#"
count: 1
path: src/QUI/ERP/Process.php
-
message: "#^Call to method getUUID\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice\\.$#"
count: 2
path: src/QUI/ERP/Process.php
-
message: "#^Call to method getUUID\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#"
count: 2
path: src/QUI/ERP/Process.php
-
message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Handler\\.$#"
count: 1
path: src/QUI/ERP/Process.php
-
message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\Handler\\.$#"
count: 3
path: src/QUI/ERP/Process.php
-
message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Handler\\.$#"
count: 1
path: src/QUI/ERP/Process.php
-
message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Order\\\\Handler\\.$#"
count: 2
path: src/QUI/ERP/Process.php
-
message: "#^Call to static method getSalesOrder\\(\\) on an unknown class QUI\\\\ERP\\\\SalesOrders\\\\Handler\\.$#"
count: 2
path: src/QUI/ERP/Process.php
-
message: "#^Call to static method getTableSalesOrders\\(\\) on an unknown class QUI\\\\ERP\\\\SalesOrders\\\\Handler\\.$#"
count: 1
path: src/QUI/ERP/Process.php
-
message: "#^Class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice not found\\.$#"
count: 1
path: src/QUI/ERP/Process.php
-
message: "#^Class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary not found\\.$#"
count: 1
path: src/QUI/ERP/Process.php
-
message: "#^Method QUI\\\\ERP\\\\Process\\:\\:getInvoices\\(\\) has invalid return type QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Invoice\\.$#"
count: 1
path: src/QUI/ERP/Process.php
-
message: "#^Method QUI\\\\ERP\\\\Process\\:\\:getInvoices\\(\\) has invalid return type QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\InvoiceTemporary\\.$#"
count: 1
path: src/QUI/ERP/Process.php
-
message: "#^Method QUI\\\\ERP\\\\Process\\:\\:getOffers\\(\\) has invalid return type QUI\\\\ERP\\\\Accounting\\\\Offers\\\\Offer\\.$#"
count: 1
path: src/QUI/ERP/Process.php
-
message: "#^Method QUI\\\\ERP\\\\Process\\:\\:getOrder\\(\\) has invalid return type QUI\\\\ERP\\\\Order\\\\Order\\.$#"
count: 2
path: src/QUI/ERP/Process.php
-
message: "#^Method QUI\\\\ERP\\\\Process\\:\\:getOrder\\(\\) has invalid return type QUI\\\\ERP\\\\Order\\\\OrderInProcess\\.$#"
count: 2
path: src/QUI/ERP/Process.php
-
message: "#^Method QUI\\\\ERP\\\\Process\\:\\:getTransactions\\(\\) has invalid return type QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Transaction\\.$#"
count: 1
path: src/QUI/ERP/Process.php
-
message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Handler\\.$#"
count: 1
path: src/QUI/ERP/Processes.php
-
message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Offers\\\\Handler\\.$#"
count: 1
path: src/QUI/ERP/Processes.php
-
message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Order\\\\Handler\\.$#"
count: 1
path: src/QUI/ERP/Processes.php
-
message: "#^Call to static method getTableSalesOrders\\(\\) on an unknown class QUI\\\\ERP\\\\SalesOrders\\\\Handler\\.$#"
count: 1
path: src/QUI/ERP/Processes.php
-
message: "#^Call to static method table\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Factory\\.$#"
count: 1
path: src/QUI/ERP/Processes.php
-
message: "#^Dead catch \\- Exception is never thrown in the try block\\.$#"
count: 2
path: src/QUI/ERP/Processes.php
-
message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Payments\\\\Transactions\\\\Handler\\.$#"
count: 1
path: src/QUI/ERP/Utils/Process.php
-
message: "#^Call to static method getInstance\\(\\) on an unknown class QUI\\\\ERP\\\\Order\\\\Handler\\.$#"
count: 1
path: src/QUI/ERP/Utils/Process.php
-
message: "#^Call to static method getInvoiceByString\\(\\) on an unknown class QUI\\\\ERP\\\\Accounting\\\\Invoice\\\\Utils\\\\Invoice\\.$#"
count: 1
path: src/QUI/ERP/Utils/Process.php
......@@ -63,35 +63,35 @@ class Article implements ArticleInterface
/**
* @var float|int
*/
protected float|int $price;
protected float | int $price;
/**
* @var float|int
*/
protected float|int $basisPrice;
protected float | int $basisPrice;
/**
* @var float|int|null
*/
protected float|int|null $nettoPriceNotRounded = null;
protected float | int | null $nettoPriceNotRounded = null;
/**
* @var float|int
*/
protected float|int $sum;
protected float | int $sum;
/**
* The calculated netto sum with quantity and discount
* @var float|int
*/
protected float|int $nettoSum = 0;
protected float | int $nettoSum = 0;
/**
* Sum from the article, without discount and with quantity
*
* @var float|int
*/
protected float|int $nettoSubSum = 0;
protected float | int $nettoSubSum = 0;
/**
* The article netto price, without discount, without quantity
......@@ -99,7 +99,7 @@ class Article implements ArticleInterface
*
* @var float|int
*/
protected float|int $nettoPrice = 0;
protected float | int $nettoPrice = 0;
/**
* The article netto price, without discount, without quantity
......@@ -107,7 +107,7 @@ class Article implements ArticleInterface
*
* @var float|int
*/
protected float|int $nettoBasisPrice = 0;
protected float | int $nettoBasisPrice = 0;
/**
* @var array
......@@ -285,7 +285,7 @@ public function getProductSetParentUuid(): ?string
*
* @return int|string
*/
public function getArticleNo(): int|string
public function getArticleNo(): int | string
{
if (isset($this->attributes['articleNo'])) {
return $this->attributes['articleNo'];
......@@ -439,7 +439,7 @@ public function getSum(): Price
*
* @return float|int
*/
public function getVat(): float|int
public function getVat(): float | int
{
if (isset($this->attributes['vat']) && $this->attributes['vat'] !== '') {
return (float)$this->attributes['vat'];
......@@ -532,7 +532,7 @@ public function setCurrency(QUI\ERP\Currency\Currency $Currency): void
*
* @return float|int|bool
*/
public function getQuantity(): float|int|bool
public function getQuantity(): float | int | bool
{
if (isset($this->attributes['quantity'])) {
return $this->attributes['quantity'];
......@@ -547,7 +547,7 @@ public function getQuantity(): float|int|bool
* @param null|QUI\Locale $Locale
* @return string
*/
public function getQuantityUnit(QUI\Locale $Locale = null): string
public function getQuantityUnit(null | QUI\Locale $Locale = null): string
{
if ($Locale === null) {
$Locale = QUI::getLocale();
......@@ -607,7 +607,7 @@ public function displayPrice(): bool
*
* @todo überdenken, ganzer artikel ist eigentlich nicht änderbar
*/
public function setDiscount(float|int $discount, int $discountType = Calc::CALCULATION_COMPLEMENT): void
public function setDiscount(float | int $discount, int $discountType = Calc::CALCULATION_COMPLEMENT): void
{
switch ($discountType) {
case Calc::CALCULATION_PERCENTAGE:
......@@ -649,7 +649,7 @@ public function hasDiscount(): bool
* @param null|Calc|QUI\ERP\User $Instance
* @return self
*/
public function calc(Calc|QUI\ERP\User $Instance = null): Article
public function calc(null | Calc | QUI\ERP\User $Instance = null): Article
{
if ($this->calculated) {
return $this;
......
......@@ -86,7 +86,7 @@ class ArticleListUnique implements IteratorAggregate
* @param ?QUI\Interfaces\Users\User $User
* @throws QUI\ERP\Exception|QUI\Exception
*/
public function __construct(array $attributes = [], QUI\Interfaces\Users\User $User = null)
public function __construct(array $attributes = [], null | QUI\Interfaces\Users\User $User = null)
{
$this->Locale = QUI::getLocale();
......@@ -271,7 +271,7 @@ public function setLocale(QUI\Locale $Locale): void
*
* @throws QUI\Exception
*/
public static function unserialize(array|string $data): ArticleListUnique
public static function unserialize(array | string $data): ArticleListUnique
{
if (is_string($data)) {
$data = json_decode($data, true);
......@@ -391,8 +391,8 @@ public function setExchangeRate(float $rate): void
* @throws Exception
*/
public function toHTML(
bool|string $template = false,
bool|string $articleTemplate = false,
bool | string $template = false,
bool | string $articleTemplate = false,
?QUI\Interfaces\Template\EngineInterface $Engine = null
): string {
if ($Engine === null) {
......@@ -556,8 +556,8 @@ public function toMailHTML(): string
* @throws Exception
*/
public function toHTMLWithCSS(
bool|string $template = false,
bool|string $articleTemplate = false,
bool | string $template = false,
bool | string $articleTemplate = false,
?QUI\Interfaces\Template\EngineInterface $Engine = null
): string {
$style = '<style>';
......@@ -577,8 +577,8 @@ public function toHTMLWithCSS(
* @throws Exception
*/
public function render(
bool|string $template = false,
bool|string $articleTemplate = false
bool | string $template = false,
bool | string $articleTemplate = false
): string {
return $this->toHTMLWithCSS($template, $articleTemplate);
}
......@@ -620,7 +620,7 @@ public function getPriceFactors(): ErpFactorList
*
* @return ArrayIterator|Traversable
*/
public function getIterator(): Traversable|ArrayIterator
public function getIterator(): Traversable | ArrayIterator
{
return new ArrayIterator($this->articles);
}
......
......@@ -126,7 +126,7 @@ public function __construct(?UserInterface $User = null)
* @param UserInterface|null $User - optional
* @return Calc
*/
public static function getInstance(UserInterface $User = null): Calc
public static function getInstance(null | UserInterface $User = null): Calc
{
if (!$User && QUI::isBackend()) {
$User = QUI::getUsers()->getSystemUser();
......@@ -200,7 +200,7 @@ public function getCurrency(): ?QUI\ERP\Currency\Currency
* @param callable|boolean $callback - optional, callback function for the data array
* @return ArticleList
*/
public function calcArticleList(ArticleList $List, callable|bool $callback = false): ArticleList
public function calcArticleList(ArticleList $List, callable | bool $callback = false): ArticleList
{
// calc data
if (!is_callable($callback)) {
......@@ -687,25 +687,28 @@ public function calcArticlePrice(Article $Article, $callback = false)
* @param string|int|float $value
* @return float
*/
public function round($value): float
public function round(string | int | float $value): float
{
$decimalSeparator = $this->getUser()->getLocale()->getDecimalSeparator();
$groupingSeparator = $this->getUser()->getLocale()->getGroupingSeparator();
$precision = QUI\ERP\Defaults::getPrecision();
if (is_int($value) || is_float($value)) {
return round($value, $precision);
}
if (strpos($value, $decimalSeparator) && $decimalSeparator != '.') {
$value = str_replace($groupingSeparator, '', $value);
}
$value = str_replace(',', '.', $value);
$value = floatval($value);
$value = round($value, $precision);
return $value;
return round($value, $precision);
}
/**
* Return the tax message for an user
* Return the tax message for a user
*
* @return string
*/
......@@ -731,9 +734,9 @@ public function getVatTextByUser(): string
* @return string
*/
public static function getVatText(
float|int $vat,
float | int $vat,
UserInterface $User,
QUI\Locale $Locale = null
null | QUI\Locale $Locale = null
): string {
if ($Locale === null) {
$Locale = QUI::getLocale();
......@@ -1071,13 +1074,13 @@ public static function isAllowedForCalculation(mixed $ToCalculate): bool
* @param QUI\ERP\Currency\Currency|null $Currency
* @return array
*/
public static function calculateTotal(array $invoiceList, QUI\ERP\Currency\Currency $Currency = null): array
public static function calculateTotal(array $invoiceList, null | QUI\ERP\Currency\Currency $Currency = null): array
{
if ($Currency === null) {
try {
$currency = json_decode($invoiceList[0]['currency_data'], true);
$Currency = QUI\ERP\Currency\Handler::getCurrency($currency['code']);
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
$Currency = QUI\ERP\Defaults::getCurrency();
}
}
......
......@@ -21,9 +21,9 @@ class CalculationValue
{
protected QUI\ERP\Currency\Currency $Currency;
protected int|float $number = 0;
protected int | float $number = 0;
protected int|float $precision = 8;
protected int | float $precision = 8;
/**
* CalculationValue constructor.
......@@ -32,8 +32,11 @@ class CalculationValue
* @param QUI\ERP\Currency\Currency|null $Currency
* @param bool|int $precision - The optional number of decimal digits to round to.
*/
public function __construct($number, QUI\ERP\Currency\Currency $Currency = null, bool|int $precision = false)
{
public function __construct(
$number,
null | QUI\ERP\Currency\Currency $Currency = null,
bool | int $precision = false
) {
if (!is_numeric($number)) {
return;
}
......@@ -60,7 +63,7 @@ public function __construct($number, QUI\ERP\Currency\Currency $Currency = null,
/**
* @return float|int
*/
public function value(): float|int
public function value(): float | int
{
return $this->number;
}
......@@ -90,7 +93,7 @@ public function precision(bool $precision = false): CalculationValue
* @param null|QUI\Locale $Locale - optional, Locale object for the formatting
* @return string
*/
public function formatted(QUI\Locale $Locale = null): string
public function formatted(null | QUI\Locale $Locale = null): string
{
return $this->Currency->format($this->number, $Locale);
}
......
......@@ -38,11 +38,11 @@ class CalculationVatValue extends CalculationValue
* @param bool|int $precision - The optional number of decimal digits to round to.
*/
public function __construct(
int|float $number,
int | float $number,
string $text,
float|int $vat,
QUI\ERP\Currency\Currency $Currency = null,
bool|int $precision = false
float | int $vat,
null | QUI\ERP\Currency\Currency $Currency = null,
bool | int $precision = false
) {
parent::__construct($number, $Currency, $precision);
......
......@@ -26,7 +26,7 @@ class Address extends QUI\Users\Address
* @param array|null $data
* @param QUIUserInterface|null $User
*/
public function __construct(?array $data = [], QUI\Interfaces\Users\User $User = null)
public function __construct(?array $data = [], null | QUI\Interfaces\Users\User $User = null)
{
if ($User) {
$this->User = $User;
......
......@@ -21,7 +21,7 @@ interface NumberRangeInterface
* @param null|QUI\Locale $Locale
* @return string
*/
public function getTitle(QUI\Locale $Locale = null): string;
public function getTitle(null | QUI\Locale $Locale = null): string;
/**
* Return the current start of the range
......
......@@ -17,7 +17,7 @@ class ErpDashboard implements DashboardInterface
* @param Locale|null $Locale
* @return string
*/
public function getTitle(QUI\Locale $Locale = null): string
public function getTitle(null | QUI\Locale $Locale = null): string
{
if ($Locale === null) {
$Locale = QUI::getLocale();
......
......@@ -38,7 +38,7 @@ class Defaults
* @param string $key
* @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/erp');
......@@ -110,7 +110,7 @@ public static function getCurrency(): Currency\Currency
* @param QUI\Interfaces\Users\User|null $User
* @return Currency\Currency|null
*/
public static function getUserCurrency(QUI\Interfaces\Users\User $User = null): ?Currency\Currency
public static function getUserCurrency(null | QUI\Interfaces\Users\User $User = null): ?Currency\Currency
{
if (self::$userRelatedCurrency !== null) {
if (self::$userRelatedCurrency) {
......@@ -191,7 +191,7 @@ public static function getPrecision(): int
* @param bool|string $lang - language of the wanted timestamp
* @return int|null|string
*/
public static function getTimestampFormat(bool|string $lang = false): int|string|null
public static function getTimestampFormat(bool | string $lang = false): int | string | null
{
if ($lang === false) {
$lang = QUI::getLocale()->getCurrent();
......@@ -227,7 +227,7 @@ public static function getTimestampFormat(bool|string $lang = false): int|string
* @param bool|string $lang
* @return string
*/
public static function getDateFormat(bool|string $lang = false): string
public static function getDateFormat(bool | string $lang = false): string
{
if ($lang === false) {
$lang = QUI::getLocale()->getCurrent();
......
......@@ -20,7 +20,7 @@ interface ErpCopyInterface
* @return ErpEntityInterface
*/
public function copy(
User $PermissionUser = null,
bool|string $globalProcessId = false
null | User $PermissionUser = null,
bool | string $globalProcessId = false
): ErpEntityInterface;
}
......@@ -70,7 +70,7 @@ public function getCurrency(): QUI\ERP\Currency\Currency;
*
* @return ArticleList|ArticleListUnique
*/
public function getArticles(): ArticleList|ArticleListUnique;
public function getArticles(): ArticleList | ArticleListUnique;
/**
* Get the price calculation object of the erp entity
......@@ -91,7 +91,7 @@ public function getDeliveryAddress(): ?ErpAddress;
*
* @param array|User $User
*/
public function setCustomer(array|QUI\Interfaces\Users\User $User);
public function setCustomer(array | QUI\Interfaces\Users\User $User);
/**
* Returns the erp entity as an array
......@@ -110,7 +110,7 @@ public function toArray(): array;
*/
public function reversal(
string $reason = '',
QUI\Interfaces\Users\User $PermissionUser = null
null | QUI\Interfaces\Users\User $PermissionUser = null
): ?ErpEntityInterface;
public function addCustomerFile(string $fileHash, array $options = []): void;
......
......@@ -31,7 +31,7 @@ class Price
* Netto Price
* @var float|int
*/
protected float|int $price;
protected float | int $price;
/**
* Price currency
......@@ -64,9 +64,9 @@ class Price
* @param User|null $User - optional, if no user, session user are used
*/
public function __construct(
float|int|null $price,
float | int | null $price,
QUI\ERP\Currency\Currency $Currency,
QUI\Interfaces\Users\User $User = null
null | QUI\Interfaces\Users\User $User = null
) {
if (!$price) {
$price = 0;
......@@ -102,7 +102,7 @@ public function toArray(): array
*
* @return float|int|null
*/
public function getPrice(): float|int|null
public function getPrice(): float | int | null
{
return $this->validatePrice($this->price);
}
......@@ -112,7 +112,7 @@ public function getPrice(): float|int|null
*
* @return float|int|null
*/
public function value(): float|int|null
public function value(): float | int | null
{
return $this->getPrice();
}
......@@ -122,7 +122,7 @@ public function value(): float|int|null
*
* @return float|int|null
*/
public function getValue(): float|int|null
public function getValue(): float | int | null
{
return $this->getPrice();
}
......@@ -198,7 +198,7 @@ public function getCurrency(): QUI\ERP\Currency\Currency
* @param QUI\Locale|null $Locale - based locale, in which the price is
* @return float|int|null
*/
public static function validatePrice(mixed $value, QUI\Locale $Locale = null): float|int|null
public static function validatePrice(mixed $value, null | QUI\Locale $Locale = null): float | int | null
{
if (is_float($value) || is_int($value)) {
return round($value, QUI\ERP\Defaults::getPrecision());
......
......@@ -32,7 +32,7 @@ class Output
* @param string $package
* @return OutputProviderInterface|false - OutputProvider class (static) or false if none found
*/
public static function getOutputProviderByPackage(string $package): bool|OutputProviderInterface
public static function getOutputProviderByPackage(string $package): bool | OutputProviderInterface
{
foreach (self::getAllOutputProviders() as $outputProvider) {
if ($outputProvider['package'] === $package) {
......@@ -49,7 +49,7 @@ public static function getOutputProviderByPackage(string $package): bool|OutputP
* @param string $entityType
* @return string|false - OutputProvider class (static) or false if none found
*/
public static function getOutputProviderByEntityType(string $entityType): bool|string
public static function getOutputProviderByEntityType(string $entityType): bool | string
{
foreach (self::getAllOutputProviders() as $outputProvider) {
$class = $outputProvider['class'];
......@@ -77,11 +77,11 @@ public static function getOutputProviderByEntityType(string $entityType): bool|s
* @throws QUI\Exception
*/
public static function getDocumentHtml(
int|string $entityId,
int | string $entityId,
string $entityType,
OutputProviderInterface $OutputProvider = null,
OutputTemplateProviderInterface $TemplateProvider = null,
string $template = null,
null | OutputProviderInterface $OutputProvider = null,
null | OutputTemplateProviderInterface $TemplateProvider = null,
null | string $template = null,
bool $preview = false
): string {
if (empty($OutputProvider)) {
......@@ -125,11 +125,11 @@ public static function getDocumentHtml(
* @throws QUI\Exception
*/
public static function getDocumentPdf(
int|string $entityId,
int | string $entityId,
string $entityType,
OutputProviderInterface $OutputProvider = null,
OutputTemplateProviderInterface $TemplateProvider = null,
string $template = null
null | OutputProviderInterface $OutputProvider = null,
null | OutputTemplateProviderInterface $TemplateProvider = null,
null | string $template = null
): QUI\HtmlToPdf\Document {
if (empty($OutputProvider)) {
$OutputProvider = self::getOutputProviderByEntityType($entityType);
......@@ -158,7 +158,7 @@ public static function getDocumentPdf(
*
* @return string
*/
public static function getDocumentPdfDownloadUrl(int|string $entityId, string $entityType): string
public static function getDocumentPdfDownloadUrl(int | string $entityId, string $entityType): string
{
$url = URL_OPT_DIR . 'quiqqer/erp/bin/output/frontend/download.php?';
$url .= http_build_query([
......@@ -187,14 +187,14 @@ public static function getDocumentPdfDownloadUrl(int|string $entityId, string $e
* @throws QUI\Exception|\PHPMailer\PHPMailer\Exception
*/
public static function sendPdfViaMail(
int|string $entityId,
int | string $entityId,
string $entityType,
OutputProviderInterface $OutputProvider = null,
OutputTemplateProviderInterface $TemplateProvider = null,
string $template = null,
string $recipientEmail = null,
string $mailSubject = null,
string $mailContent = null,
null | OutputProviderInterface $OutputProvider = null,
null | OutputTemplateProviderInterface $TemplateProvider = null,
null | string $template = null,
null | string $recipientEmail = null,
null | string $mailSubject = null,
null | string $mailContent = null,
array $attachedMediaFiles = []
): void {
if (empty($OutputProvider)) {
......@@ -310,7 +310,7 @@ public static function getOutputTemplateProviderByPackage(string $package): ?Out
* @param string|null $entityType (optional) - Restrict to templates of $entityType [default: fetch templates for all entity types]
* @return array
*/
public static function getTemplates(string $entityType = null): array
public static function getTemplates(null | string $entityType = null): array
{
$templates = [];
$outputProviders = [];
......@@ -419,7 +419,7 @@ public static function getDefaultOutputTemplateForEntityType(string $entityType)
* @param string $entityType
* @return string|false
*/
public static function getDefaultOutputTemplateProviderForEntityType(string $entityType): string|bool
public static function getDefaultOutputTemplateProviderForEntityType(string $entityType): string | bool
{
$defaultEntityTypeTemplate = self::getDefaultOutputTemplateForEntityType($entityType);
......
......@@ -28,7 +28,7 @@ public static function getEntityType(): string;
* @param Locale|null $Locale $Locale (optional) - If omitted use \QUI::getLocale()
* @return mixed
*/
public static function getEntityTypeTitle(Locale $Locale = null): mixed;
public static function getEntityTypeTitle(null | Locale $Locale = null): mixed;
/**
* Get the entity the output is created for
......@@ -36,7 +36,7 @@ public static function getEntityTypeTitle(Locale $Locale = null): mixed;
* @param int|string $entityId
* @return mixed
*/
public static function getEntity(int|string $entityId): mixed;
public static function getEntity(int | string $entityId): mixed;
/**
* Get download filename (without file extension)
......@@ -44,7 +44,7 @@ public static function getEntity(int|string $entityId): mixed;
* @param int|string $entityId
* @return string
*/
public static function getDownloadFileName(int|string $entityId): string;
public static function getDownloadFileName(int | string $entityId): string;
/**
* Get output Locale by entity
......@@ -52,7 +52,7 @@ public static function getDownloadFileName(int|string $entityId): string;
* @param int|string $entityId
* @return Locale
*/
public static function getLocale(int|string $entityId): Locale;
public static function getLocale(int | string $entityId): Locale;
/**
* Fill the OutputTemplate with appropriate entity data
......@@ -60,7 +60,7 @@ public static function getLocale(int|string $entityId): Locale;
* @param int|string $entityId
* @return array
*/
public static function getTemplateData(int|string $entityId): array;
public static function getTemplateData(int | string $entityId): array;
/**
* Checks if $User has permission to download the document of $entityId
......@@ -69,7 +69,7 @@ public static function getTemplateData(int|string $entityId): array;
* @param User $User
* @return bool
*/
public static function hasDownloadPermission(int|string $entityId, User $User): bool;
public static function hasDownloadPermission(int | string $entityId, User $User): bool;
/**
* Get e-mail address of the document recipient
......@@ -77,7 +77,7 @@ public static function hasDownloadPermission(int|string $entityId, User $User):
* @param int|string $entityId
* @return string|false - E-Mail address or false if no e-mail address available
*/
public static function getEmailAddress(int|string $entityId): bool|string;
public static function getEmailAddress(int | string $entityId): bool | string;
/**
* Get e-mail subject when document is sent via mail
......@@ -85,7 +85,7 @@ public static function getEmailAddress(int|string $entityId): bool|string;
* @param int|string $entityId
* @return string
*/
public static function getMailSubject(int|string $entityId): string;
public static function getMailSubject(int | string $entityId): string;
/**
* Get e-mail body when document is sent via mail
......@@ -93,5 +93,5 @@ public static function getMailSubject(int|string $entityId): string;
* @param int|string $entityId
* @return string
*/
public static function getMailBody(int|string $entityId): string;
public static function getMailBody(int | string $entityId): string;
}
......@@ -17,17 +17,17 @@ class OutputTemplate
/**
* @var string|OutputTemplateProviderInterface
*/
protected string|OutputTemplateProviderInterface $TemplateProvider;
protected string | OutputTemplateProviderInterface $TemplateProvider;
/**
* @var string|OutputProviderInterface
*/
protected string|OutputProviderInterface $OutputProvider;
protected string | OutputProviderInterface $OutputProvider;
/**
* @var string|null
*/
protected string|null $template;
protected string | null $template;
/**
* @var QUI\Interfaces\Template\EngineInterface
......@@ -42,7 +42,7 @@ class OutputTemplate
/**
* @var string|int
*/
protected string|int $entityId;
protected string | int $entityId;
/**
* The entity the output is created for
......@@ -66,11 +66,11 @@ class OutputTemplate
* @param string|null $template (optional) - Template identifier (from template provider)
*/
public function __construct(
OutputTemplateProviderInterface|string $TemplateProvider,
OutputProviderInterface|string $OutputProvider,
int|string $entityId,
OutputTemplateProviderInterface | string $TemplateProvider,
OutputProviderInterface | string $OutputProvider,
int | string $entityId,
string $entityType,
string $template = null
null | string $template = null
) {
$this->Engine = QUI::getTemplateManager()->getEngine();
$this->TemplateProvider = $TemplateProvider;
......@@ -224,7 +224,7 @@ public function getEngine(): QUI\Interfaces\Template\EngineInterface
/**
* @return OutputTemplateProviderInterface|string
*/
public function getTemplateProvider(): OutputTemplateProviderInterface|string
public function getTemplateProvider(): OutputTemplateProviderInterface | string
{
if (is_string($this->TemplateProvider)) {
return $this->TemplateProvider;
......
......@@ -34,7 +34,10 @@ public static function getTemplates(string $entityType): array;
* @param Locale|null $Locale $Locale (optional) - If omitted use \QUI::getLocale()
* @return string
*/
public static function getTemplateTitle(int|string $templateId, Locale $Locale = null): string;
public static function getTemplateTitle(
int | string $templateId,
null | Locale $Locale = null
): string;
/**
* Get HTML for document header area
......@@ -46,11 +49,11 @@ public static function getTemplateTitle(int|string $templateId, Locale $Locale =
* @return string|false
*/
public static function getHeaderHtml(
int|string $templateId,
int | string $templateId,
string $entityType,
EngineInterface $Engine,
mixed $Entity
): bool|string;
): bool | string;
/**
* Get HTML for document body area
......@@ -62,11 +65,11 @@ public static function getHeaderHtml(
* @return string|false
*/
public static function getBodyHtml(
int|string $templateId,
int | string $templateId,
string $entityType,
EngineInterface $Engine,
mixed $Entity
): bool|string;
): bool | string;
/**
* Get HTML for document footer area
......@@ -78,9 +81,9 @@ public static function getBodyHtml(
* @return string|false
*/
public static function getFooterHtml(
int|string $templateId,
int | string $templateId,
string $entityType,
EngineInterface $Engine,
mixed $Entity
): bool|string;
): bool | string;
}
......@@ -292,7 +292,7 @@ public static function convertUserDataToErpUser(array $user): User
/**
* @deprecated use getUUID()
*/
public function getId(): int|false
public function getId(): int | false
{
return $this->id;
}
......@@ -433,7 +433,7 @@ public function getStatus(): int
* @param int|string $id - only for the interface, has no effect
* @return Address
*/
public function getAddress(int|string $id = 0): QUI\Users\Address
public function getAddress(int | string $id = 0): QUI\Users\Address
{
return new Address($this->address, $this);
}
......@@ -514,7 +514,7 @@ public function isSU(): bool
return false;
}
public function isInGroup(int|string $groupId): bool
public function isInGroup(int | string $groupId): bool
{
return false;
}
......@@ -541,7 +541,7 @@ public function deactivate(?UserInterface $PermissionUser = null): bool
return true;
}
public function disable(UserInterface|null $PermissionUser = null): bool
public function disable(UserInterface | null $PermissionUser = null): bool
{
return true;
}
......@@ -561,7 +561,7 @@ public function delete(?UserInterface $PermissionUser = null): bool
/**
* This user has nowhere permissions
*/
public function getPermission(string $right, bool|array|string|callable $ruleset = false): bool
public function getPermission(string $right, bool | array | string | callable $ruleset = false): bool
{
return false;
}
......@@ -571,7 +571,7 @@ public function getStandardAddress(): Address
return $this->getAddress();
}
public function addAddress(array $params = [], QUI\Interfaces\Users\User $ParentUser = null): ?Address
public function addAddress(array $params = [], null | QUI\Interfaces\Users\User $ParentUser = null): ?Address
{
return null;
}
......@@ -579,7 +579,7 @@ public function addAddress(array $params = [], QUI\Interfaces\Users\User $Parent
/**
* Does nothing
*/
public function setGroups(array|string $groups)
public function setGroups(array | string $groups)
{
}
......@@ -632,12 +632,15 @@ public function getAvatar(): ?QUI\Projects\Media\Image
/**
* Does nothing
*/
public function setPassword(string $new, ?UserInterface $PermissionUser = null)
public function setPassword(string $new, null | UserInterface $PermissionUser = null)
{
}
public function changePassword(string $newPassword, string $oldPassword, UserInterface $ParentUser = null): void
{
public function changePassword(
string $newPassword,
string $oldPassword,
null | UserInterface $ParentUser = null
): void {
}
/**
......@@ -672,14 +675,14 @@ public function setCompanyStatus(bool $status)
/**
* Does nothing
*/
public function addToGroup(int|string $groupId)
public function addToGroup(int | string $groupId)
{
}
/**
* Does nothing
*/
public function removeGroup(Group|int|string $Group)
public function removeGroup(Group | int | string $Group)
{
}
......@@ -743,7 +746,7 @@ public function getAuthenticator(string $authenticator): AuthenticatorInterface
);
}
public function enableAuthenticator(string $authenticator, UserInterface $ParentUser = null): void
public function enableAuthenticator(string $authenticator, null | UserInterface $ParentUser = null): void
{
throw new QUI\Users\Exception(
['quiqqer/core', 'exception.authenticator.not.found'],
......@@ -751,7 +754,7 @@ public function enableAuthenticator(string $authenticator, UserInterface $Parent
);
}
public function disableAuthenticator(string $authenticator, UserInterface $ParentUser = null): void
public function disableAuthenticator(string $authenticator, null | UserInterface $ParentUser = null): void
{
throw new QUI\Users\Exception(
['quiqqer/core', 'exception.authenticator.not.found'],
......
......@@ -15,7 +15,7 @@ class Sites
* @param QUI\Locale|null $Locale - in which language the page should be
* @return QUI\Projects\Site|null
*/
public static function getTermsAndConditions(QUI\Locale $Locale = null): ?QUI\Projects\Site
public static function getTermsAndConditions(null | QUI\Locale $Locale = null): ?QUI\Projects\Site
{
if ($Locale === null) {
$Locale = QUI::getLocale();
......@@ -43,7 +43,7 @@ public static function getTermsAndConditions(QUI\Locale $Locale = null): ?QUI\Pr
* @param QUI\Locale|null $Locale - in which language the page should be
* @return QUI\Projects\Site|null
*/
public static function getRevocation(QUI\Locale $Locale = null): ?QUI\Projects\Site
public static function getRevocation(null | QUI\Locale $Locale = null): ?QUI\Projects\Site
{
if ($Locale === null) {
$Locale = QUI::getLocale();
......@@ -71,7 +71,7 @@ public static function getRevocation(QUI\Locale $Locale = null): ?QUI\Projects\S
* @param QUI\Locale|null $Locale - in which language the page should be
* @return QUI\Projects\Site|null
*/
public static function getPrivacyPolicy(QUI\Locale $Locale = null): ?QUI\Projects\Site
public static function getPrivacyPolicy(null | QUI\Locale $Locale = null): ?QUI\Projects\Site
{
if ($Locale === null) {
$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