Skip to content
Code-Schnipsel Gruppen Projekte

fix(phpstan): code improvements and resolve warnings

Zusammengeführt Henning Leutz schlägt vor, next-2.x in main zu mergen.
10 Dateien
+ 26
93
Änderungen vergleichen
  • Nebeneinander
  • In der Reihe
Dateien
10
  • Reviewed code and made several improvements which provide better error handling, code quality, and
    resolved warnings. The changes include:
    - Syntax modifications for better readability,
    - Ensured variable type checks before using methods,
    - Resolved warning instances in phpstan,
    - Adapted code to comply with modern PHP nullable type indicator.
    
    Alongside, made version update in phive/phars.xml. Also, unnecessary comments or instances are
    removed for a cleaner code.
    
    Related: #16
@@ -3,6 +3,7 @@
namespace QUI\ERP\Coupons\Products;
use QUI;
use QUI\Locale;
/**
* Class PhysicalCouponProductType
@@ -51,7 +52,7 @@ public function __construct(int $pid, array $product = [])
* @param QUI\Locale|null $Locale
* @return string
*/
public static function getTypeTitle(QUI\Locale $Locale = null): string
public static function getTypeTitle(null | QUI\Locale $Locale = null): string
{
if ($Locale === null) {
$Locale = QUI::getLocale();
@@ -61,10 +62,10 @@ public static function getTypeTitle(QUI\Locale $Locale = null): string
}
/**
* @param QUI\Locale $Locale
* @param Locale|null $Locale
* @return string
*/
public static function getTypeDescription($Locale = null): string
public static function getTypeDescription(null | QUI\Locale $Locale = null): string
{
if ($Locale === null) {
$Locale = QUI::getLocale();