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

fix(phpstan): handle non-existing classes in abstractOrder.php

This commit fixes the errors arising from non-existing classes in the AbstractOrder.php

Changes include:
- Added a comment on the shipping validation
- Corrected type declaration in the reversal function signature to include the possibility of the
parameter being null.
- Checked for the existence of ShippingStatus and ShippingEntry classes before attempting to get
Shipping status and Shipping Ids, respectively. This prevents errors if these classes do not exist.

Related: #172
Übergeordneter 088220b6
No related branches found
No related tags found
2 Merge Requests!146fix: update `getCustomerFiles` method signature in `AbstractOrder`,!145Update 'next-3.x' with latest changes from 'main'
Pipeline #15532 fehlgeschlagen mit Phase
in 2 Minuten und 23 Sekunden
......@@ -439,6 +439,7 @@ protected function setDataBaseData(array $data): void
// validate shipping
try {
// @phpstan-ignore-next-line
$this->validateShipping($this->getShipping());
} catch (QUI\Exception) {
$this->shippingId = null;
......@@ -473,7 +474,7 @@ protected function setDataBaseData(array $data): void
* @param QUI\Interfaces\Users\User|null $PermissionUser
* @return ErpEntityInterface|null
*/
public function reversal(string $reason = '', QUI\Interfaces\Users\User $PermissionUser = null): ?ErpEntityInterface
public function reversal(string $reason = '', null | QUI\Interfaces\Users\User $PermissionUser = null): ?ErpEntityInterface
{
$this->delete($PermissionUser);
return null;
......@@ -673,13 +674,13 @@ public function toArray(): array
QUI\System\Log::writeDebugException($Exception);
}
if ($this->getShippingStatus()) {
if (class_exists('QUI\ERP\Shipping\ShippingStatus\Status') && $this->getShippingStatus()) {
$shippingStatus = $this->getShippingStatus()->getId();
}
$shipping = '';
if ($this->getShipping()) {
if (class_exists('QUI\ERP\Shipping\Types\ShippingEntry') && $this->getShipping()) {
$shipping = $this->getShipping()->getId();
}
......
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