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

fix(phpstan): improve code clarity and formatting

1. Simplified condition checks for 'firstname' and 'lastname' using the 'empty()' function.
2. Refactored the type hinting of parameters for the 'addUserToCustomerGroup',
'removeUserFromCustomerGroup', and 'setAttributesToCustomer' methods.
3. Updated the type hinting for the 'getEntityTypeTitle' method, adding a possibility to receive
null.

Related: #67
Übergeordneter 905c5471
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
2 Merge Requests!58Update 'next-3.x' with latest changes from 'main',!57fix(phpstan): improve code clarity and formatting
Pipeline-Nr. 15242 mit Warnungen bestanden
......@@ -104,11 +104,11 @@ public function createCustomer($customerId, array $address = [], array $groupIds
$Address->save();
if (!$User->getAttribute('firstname') || $User->getAttribute('firstname') === '') {
if (empty($User->getAttribute('firstname'))) {
$User->setAttribute('firstname', $address['firstname']);
}
if (!$User->getAttribute('lastname') || $User->getAttribute('lastname') === '') {
if (empty($User->getAttribute('lastname'))) {
$User->setAttribute('lastname', $address['lastname']);
}
}
......@@ -221,8 +221,8 @@ public function getCustomerGroup(): ?QUI\Groups\Group
* @throws QUI\Users\Exception
*/
public function addUserToCustomerGroup(
bool|int|string $userId,
QUI\Interfaces\Users\User $PermissionUser = null
bool | int | string $userId,
null | QUI\Interfaces\Users\User $PermissionUser = null
): void {
if (!$userId) {
return;
......@@ -258,7 +258,7 @@ public function addUserToCustomerGroup(
* @throws QUI\Exception
* @throws QUI\Users\Exception
*/
public function removeUserFromCustomerGroup(bool|int|string $userId): void
public function removeUserFromCustomerGroup(bool | int | string $userId): void
{
$customerGroup = null;
......@@ -287,7 +287,7 @@ public function removeUserFromCustomerGroup(bool|int|string $userId): void
* @throws QUI\Permissions\Exception
* @throws QUI\Users\Exception
*/
public function setAttributesToCustomer(bool|int|string $userId, array $attributes): void
public function setAttributesToCustomer(bool | int | string $userId, array $attributes): void
{
$User = QUI::getUsers()->get($userId);
......
......@@ -37,7 +37,7 @@ public static function getEntityType(): string
* @param Locale|null $Locale $Locale (optional) - If ommitted use \QUI::getLocale()
* @return string
*/
public static function getEntityTypeTitle(Locale $Locale = null): string
public static function getEntityTypeTitle(null | Locale $Locale = null): string
{
if (empty($Locale)) {
$Locale = QUI::getLocale();
......
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren