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

Merge branch 'next-2.x' into 'main'

fix(phpstan): improve code clarity and formatting

See merge request !57
Übergeordnete 26e87825 b0e75b59
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. 15245 mit Warnungen bestanden
......@@ -12,9 +12,11 @@
'package_quiqqer_customer_ajax_backend_customer_passwordMail',
function ($userId) {
$User = QUI::getUsers()->get($userId);
$Handler = QUI\Users\Auth\Handler::getInstance();
$Handler->sendPasswordResetVerificationMail($User);
if ($User instanceof QUI\Users\User) {
$Handler->sendPasswordResetVerificationMail($User);
}
QUI::getMessagesHandler()->addSuccess(
QUI::getLocale()->get('quiqqer/customer', 'message.customer.password.mail.send')
......
......@@ -15,11 +15,6 @@ parameters:
count: 1
path: ajax/backend/customer/getPagination.php
-
message: "#^Parameter \\#1 \\$User of method QUI\\\\Users\\\\Auth\\\\Handler\\:\\:sendPasswordResetVerificationMail\\(\\) expects QUI\\\\Users\\\\User, QUI\\\\Interfaces\\\\Users\\\\User given\\.$#"
count: 1
path: ajax/backend/customer/passwordMail.php
-
message: "#^Call to method addUrl\\(\\) on an unknown class QUI\\\\UserDownloads\\\\DownloadEntry\\.$#"
count: 1
......@@ -75,26 +70,6 @@ parameters:
count: 1
path: src/QUI/ERP/Customer/CustomerFiles.php
-
message: "#^Parameter \\#1 \\$code of method QUI\\\\Interfaces\\\\Users\\\\User\\:\\:activate\\(\\) expects string, false given\\.$#"
count: 2
path: src/QUI/ERP/Customer/Customers.php
-
message: "#^Result of && is always false\\.$#"
count: 1
path: src/QUI/ERP/Customer/Customers.php
-
message: "#^Strict comparison using \\=\\=\\= between mixed and '' will always evaluate to false\\.$#"
count: 2
path: src/QUI/ERP/Customer/Customers.php
-
message: "#^Strict comparison using \\=\\=\\= between mixed and null will always evaluate to false\\.$#"
count: 1
path: src/QUI/ERP/Customer/Customers.php
-
message: "#^Call to method getOrder\\(\\) on an unknown class QUI\\\\ERP\\\\Order\\\\Controls\\\\OrderProcess\\\\CustomerData\\.$#"
count: 1
......@@ -319,8 +294,3 @@ parameters:
message: "#^Parameter \\$Order of method QUI\\\\ERP\\\\Customer\\\\OpenItemsList\\\\Handler\\:\\:parseOrderToOpenItem\\(\\) has invalid type QUI\\\\ERP\\\\Order\\\\Order\\.$#"
count: 2
path: src/QUI/ERP/Customer/OpenItemsList/Handler.php
-
message: "#^Strict comparison using \\=\\=\\= between 'ad\\.firstname'\\|'ad\\.lastname'\\|'company'\\|'customerId'\\|'email'\\|'firstname'\\|'lastname'\\|'usergroup'\\|'userId'\\|'username' and 'users\\.customerId' will always evaluate to false\\.$#"
count: 1
path: src/QUI/ERP/Customer/Search.php
......@@ -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);
......@@ -343,8 +343,6 @@ public function setAttributesToCustomer(bool|int|string $userId, array $attribut
if (isset($attributes['group'])) {
$groups[] = $attributes['group'];
$User->setAttribute('mainGroup', $attributes['group']);
} elseif (isset($attributes['group']) && $attributes['group'] === null) {
$User->setAttribute('mainGroup', false);
}
if (!empty($attributes['groups'])) {
......@@ -385,7 +383,7 @@ public function setAttributesToCustomer(bool|int|string $userId, array $attribut
$SystemUser = QUI::getUsers()->getSystemUser();
try {
$User->activate(false, $SystemUser);
$User->activate('', $SystemUser);
} catch (QUI\Exception $Exception) {
// if no password, set a password
$userAttr = $User->getAttributes();
......@@ -396,7 +394,7 @@ public function setAttributesToCustomer(bool|int|string $userId, array $attribut
$SystemUser
);
$User->activate(false, $SystemUser);
$User->activate('', $SystemUser);
} else {
throw $Exception;
}
......
......@@ -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();
......
......@@ -332,7 +332,8 @@ protected function getQuery(bool $count = false): array
'company',
'customerId',
'ad.firstname',
'ad.lastname'
'ad.lastname',
'users.customerId'
];
$searchFilters = [];
......@@ -687,7 +688,7 @@ public function order(string $col, string $direction = 'ASC'): void
* @param integer|string $from - start
* @param integer|string $count - count of entries
*/
public function limit(int|string $from, int|string $count): void
public function limit(int | string $from, int | string $count): void
{
$this->limit = [(int)$from, (int)$count];
}
......@@ -702,7 +703,7 @@ public function limit(int|string $from, int|string $count): void
* @param string $filter
* @param array|string $value
*/
public function setFilter(string $filter, array|string $value): void
public function setFilter(string $filter, array | string $value): void
{
if ($filter === 'search') {
$this->search = $value;
......
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