diff --git a/.phive/phars.xml b/.phive/phars.xml index 083bf350f36452d4b16903de154e439c5bba4a7e..f67ea918e05290132fd03421244b4f0f7085ebdf 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -1,6 +1,6 @@ <?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="true"/> + <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="true"/> <phar name="phpcs" version="^3.10.1" installed="3.10.1" location="./tools/phpcs" copy="true"/> <phar name="phpcbf" version="^3.10.1" installed="3.10.1" location="./tools/phpcbf" copy="true"/> diff --git a/ajax/frontend/profile/save.php b/ajax/frontend/profile/save.php index 6e6bef0d0013caf265e01c6216f273a99058f63d..2297123161e8387335037c92d9d2324d2f45850d 100644 --- a/ajax/frontend/profile/save.php +++ b/ajax/frontend/profile/save.php @@ -28,7 +28,11 @@ function ($category, $settings, $data) { } $Control = QUI\FrontendUsers\Utils::getProfileSettingControl($category, $settings); - $Control->setAttribute('User', QUI::getUserBySession()); + + if (method_exists($Control, 'setAttribute')) { + $Control->setAttribute('User', QUI::getUserBySession()); + } + $Control->onSave(); }, ['category', 'settings', 'data'], diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 20484dddbb298ac0bbd7b3acee6b85779b575bc4..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,56 +0,0 @@ -parameters: - ignoreErrors: - - - message: "#^Call to an undefined method QUI\\\\FrontendUsers\\\\Controls\\\\Profile\\\\ControlInterface\\:\\:setAttribute\\(\\)\\.$#" - count: 1 - path: ajax/frontend/profile/save.php - - - - message: "#^Negated boolean expression is always true\\.$#" - count: 1 - path: src/QUI/FrontendUsers/Console/SendUserMails.php - - - - message: "#^Variable \\$Authenticator in PHPDoc tag @var does not exist\\.$#" - count: 1 - path: src/QUI/FrontendUsers/Controls/Login.php - - - - message: "#^Call to an undefined method QUI\\\\FrontendUsers\\\\Controls\\\\Profile\\\\ControlInterface\\:\\:setAttribute\\(\\)\\.$#" - count: 1 - path: src/QUI/FrontendUsers/Controls/Profile.php - - - - message: "#^Parameter \\#1 \\$maxWidth of method QUI\\\\Projects\\\\Media\\\\ExternalImage\\:\\:getSizeCacheUrl\\(\\) expects bool, int given\\.$#" - count: 1 - path: src/QUI/FrontendUsers/Controls/Profile/UserAvatar.php - - - - message: "#^Parameter \\#2 \\$maxHeight of method QUI\\\\Projects\\\\Media\\\\ExternalImage\\:\\:getSizeCacheUrl\\(\\) expects bool, int given\\.$#" - count: 1 - path: src/QUI/FrontendUsers/Controls/Profile/UserAvatar.php - - - - message: "#^Call to an undefined method QUI\\\\Interfaces\\\\Projects\\\\Media\\\\File\\:\\:setTitle\\(\\)\\.$#" - count: 1 - path: src/QUI/FrontendUsers/Controls/Profile/UserAvatarUpload.php - - - - message: "#^Parameter \\#1 \\$User of method QUI\\\\FrontendUsers\\\\Handler\\:\\:sendChangeEmailAddressMail\\(\\) expects QUI\\\\Users\\\\User, QUI\\\\Interfaces\\\\Users\\\\User given\\.$#" - count: 1 - path: src/QUI/FrontendUsers/Controls/Profile/UserData.php - - - - message: "#^Parameter \\#1 \\$maxWidth of method QUI\\\\Projects\\\\Media\\\\ExternalImage\\:\\:getSizeCacheUrl\\(\\) expects bool, int given\\.$#" - count: 1 - path: src/QUI/FrontendUsers/Controls/UserIcon.php - - - - message: "#^Parameter \\#2 \\$maxHeight of method QUI\\\\Projects\\\\Media\\\\ExternalImage\\:\\:getSizeCacheUrl\\(\\) expects bool, int given\\.$#" - count: 1 - path: src/QUI/FrontendUsers/Controls/UserIcon.php - - - - message: "#^Call to an undefined method QUI\\\\Interfaces\\\\Projects\\\\Site\\:\\:getLocation\\(\\)\\.$#" - count: 1 - path: src/QUI/FrontendUsers/Events.php diff --git a/src/QUI/FrontendUsers/AbstractRegistrar.php b/src/QUI/FrontendUsers/AbstractRegistrar.php index dc4b6f0477acd8a9968f2872fb56b3500f53edfc..98dcf6f53722e8c6a8bcfcff38d716a08315a226 100644 --- a/src/QUI/FrontendUsers/AbstractRegistrar.php +++ b/src/QUI/FrontendUsers/AbstractRegistrar.php @@ -56,7 +56,7 @@ abstract public function onRegistered(QUI\Interfaces\Users\User $User): void; * @param QUI\Locale|null $Locale (optional) - If omitted use QUI::getLocale() * @return string */ - abstract public function getTitle(QUI\Locale $Locale = null): string; + abstract public function getTitle(null | QUI\Locale $Locale = null): string; /** * Get description @@ -64,7 +64,7 @@ abstract public function getTitle(QUI\Locale $Locale = null): string; * @param QUI\Locale|null $Locale (optional) - If omitted use QUI::getLocale() * @return string */ - abstract public function getDescription(QUI\Locale $Locale = null): string; + abstract public function getDescription(null | QUI\Locale $Locale = null): string; /** * Return an icon for the registrar diff --git a/src/QUI/FrontendUsers/Console/SendUserMails.php b/src/QUI/FrontendUsers/Console/SendUserMails.php index 7fa403b912ba4a9022f16902496a7e2f0cd5c52c..f0027b3a4949ed5a7f5c1c543b7fde3cdeb2e10e 100644 --- a/src/QUI/FrontendUsers/Console/SendUserMails.php +++ b/src/QUI/FrontendUsers/Console/SendUserMails.php @@ -398,7 +398,7 @@ protected function setLimits(array $limits): void * * @return array|false - Limit config or false if limits not yet configured */ - protected function getLimits(): bool|array + protected function getLimits(): bool | array { try { $limitsFile = QUI::getPackage('quiqqer/frontend-users')->getVarDir() . 'send_user_mails_limits'; @@ -585,7 +585,7 @@ protected function isMailAllowed(): bool * @param string|null $testMailAddress (optional) - If set, a single test mail will be sent to this address * @return void */ - protected function sendMails(string $testMailAddress = null): void + protected function sendMails(null | string $testMailAddress = null): void { $Users = QUI::getUsers(); $SystemUser = $Users->getSystemUser(); @@ -630,7 +630,7 @@ protected function sendMails(string $testMailAddress = null): void ); sleep(60); - } while (!$mailAllowed); + } while (!$mailAllowed); // @phpstan-ignore-line } if (!empty($recipient['firstname']) && !empty($recipient['lastname'])) { diff --git a/src/QUI/FrontendUsers/Controls/Address/Address.php b/src/QUI/FrontendUsers/Controls/Address/Address.php index cf7b2f3f15e4384e313b1af7191e36add12cf2d2..0919d56c2cf85b63621e2be487cd99f8b8b68703 100644 --- a/src/QUI/FrontendUsers/Controls/Address/Address.php +++ b/src/QUI/FrontendUsers/Controls/Address/Address.php @@ -38,7 +38,7 @@ public function __construct(array $attributes = []) * @param null|QUI\Locale $Locale * @return string */ - public function getName(QUI\Locale $Locale = null): string + public function getName(null | QUI\Locale $Locale = null): string { return 'Address'; } @@ -463,10 +463,15 @@ protected function delete(): void * Validate if the order has an invoice address * * @param QUI\Users\Address $Address - * @throws QUI\ERP\Order\Exception + * @throws QUI\Exception */ public function validate(QUI\Users\Address $Address): void { + if (!class_exists('QUI\ERP\Order\Exception')) { + QUI\System\Log::addError('Class "QUI\ERP\Order\Exception" not found.'); + throw new QUI\Exception('An error occurred.'); + } + $exception = [ 'quiqqer/order', 'exception.missing.address.field' diff --git a/src/QUI/FrontendUsers/Controls/Login.php b/src/QUI/FrontendUsers/Controls/Login.php index 867cd042785707284981eb7d37773af49fa80426..18ad1861d8dafd5f5d023c2d70803fe93deb1bad 100644 --- a/src/QUI/FrontendUsers/Controls/Login.php +++ b/src/QUI/FrontendUsers/Controls/Login.php @@ -151,7 +151,6 @@ protected function getAuthenticators(): array } $authenticators = array_filter($authenticators, function ($authenticator) use ($allowed) { - /** @var QUI\Users\AuthenticatorInterface $authenticator */ return in_array($authenticator, $allowed); }); } catch (Exception $Exception) { @@ -163,7 +162,6 @@ protected function getAuthenticators(): array } return array_filter($authenticators, function ($authenticator) use ($filterRegistrars) { - /** @var QUI\Users\AuthenticatorInterface $Authenticator */ return in_array($authenticator, $filterRegistrars); }); } diff --git a/src/QUI/FrontendUsers/Controls/Profile.php b/src/QUI/FrontendUsers/Controls/Profile.php index 23706ac338f03823ae9ea5e215dc5e0e1164b16d..abdec5ed99aca5e57f3e1ace026533d792543ed0 100644 --- a/src/QUI/FrontendUsers/Controls/Profile.php +++ b/src/QUI/FrontendUsers/Controls/Profile.php @@ -36,8 +36,8 @@ public function __construct(array $attributes = []) parent::__construct($attributes); // if (!defined('QUIQQER_CONTROL_TEMPLATE_USE_BASIC') || QUIQQER_CONTROL_TEMPLATE_USE_BASIC !== true) { - $this->addCSSFile(dirname(__FILE__) . '/Profile.css'); - $this->addCSSClass('quiqqer-frontendUsers-controls-profile'); + $this->addCSSFile(dirname(__FILE__) . '/Profile.css'); + $this->addCSSClass('quiqqer-frontendUsers-controls-profile'); // } $this->setAttribute( @@ -84,7 +84,7 @@ public function getBody(): string * @param bool $category * @return bool */ - $getFirstCategorySetting = function ($array, bool|string|int $category = false) use ($getFirstCategory) { + $getFirstCategorySetting = function ($array, bool | string | int $category = false) use ($getFirstCategory) { if ($category === false) { $category = $getFirstCategory($array); } @@ -147,7 +147,9 @@ public function getBody(): string return ''; } - $Control->setAttribute('User', $this->getUser()); + if (method_exists($Control, 'setAttribute')) { + $Control->setAttribute('User', $this->getUser()); + } if ($Request->request->get('profile-save')) { try { diff --git a/src/QUI/FrontendUsers/Controls/Profile/UserAvatar.php b/src/QUI/FrontendUsers/Controls/Profile/UserAvatar.php index 80e6754d874725b247181622c40187c700a73e8e..0f047467fc021488ef80c87c7f9ca04535d532dc 100644 --- a/src/QUI/FrontendUsers/Controls/Profile/UserAvatar.php +++ b/src/QUI/FrontendUsers/Controls/Profile/UserAvatar.php @@ -59,7 +59,7 @@ public function getBody(): string if (!empty($userGravatarIcon) && $gravatarEnabled && !empty($userEmail)) { $userGravatarIcon = true; $AvatarImage = new ExternalImage(Utils::getGravatarUrl($userEmail, 100)); - $url = $AvatarImage->getSizeCacheUrl(100, 100); + $url = $AvatarImage->getSizeCacheUrl(); $Engine->assign([ 'avatarImageUrl' => ' style="background-image: url(\'' . $url . '\')"' diff --git a/src/QUI/FrontendUsers/Controls/Profile/UserAvatarUpload.php b/src/QUI/FrontendUsers/Controls/Profile/UserAvatarUpload.php index 324574ae5f993720e3aa7b9dc30f29e135dfb5e3..3a2850325e8b67ed7f8d1fb983f526713fc14cd8 100644 --- a/src/QUI/FrontendUsers/Controls/Profile/UserAvatarUpload.php +++ b/src/QUI/FrontendUsers/Controls/Profile/UserAvatarUpload.php @@ -114,7 +114,10 @@ public function onFileFinish($file, $params): void ); $File->activate(QUI::getUsers()->getSystemUser()); - $File->setTitle($SessionUser->getUsername()); + + if (method_exists($File, 'setTitle')) { + $File->setTitle($SessionUser->getUsername()); + } $SessionUser->setAttribute('avatar', $File->getUrl()); $SessionUser->save(); diff --git a/src/QUI/FrontendUsers/Controls/UserIcon.php b/src/QUI/FrontendUsers/Controls/UserIcon.php index 15646984d3bf9ead8f1cb15b3c20cc1cb5482620..a2813b232cf4a2f4fbeb219a34b475ef2ebe40da 100644 --- a/src/QUI/FrontendUsers/Controls/UserIcon.php +++ b/src/QUI/FrontendUsers/Controls/UserIcon.php @@ -81,7 +81,7 @@ public function getBody(): string $AvatarImage = new ExternalImage(Utils::getGravatarUrl($userEmail, $iconHeight)); $Engine->assign([ - 'avatarImageUrl' => $AvatarImage->getSizeCacheUrl($iconWidth, $iconHeight) + 'avatarImageUrl' => $AvatarImage->getSizeCacheUrl() ]); } else { $avatarMediaUrl = $User->getAttribute('avatar'); @@ -133,7 +133,7 @@ public function getBody(): string * * @return false|QUI\Projects\Media\Image|string */ - protected function getDefaultAvatarImage(): QUI\Projects\Media\Image|bool|string + protected function getDefaultAvatarImage(): QUI\Projects\Media\Image | bool | string { try { $Conf = QUI::getPackage('quiqqer/frontend-users')->getConfig(); diff --git a/src/QUI/FrontendUsers/Events.php b/src/QUI/FrontendUsers/Events.php index ad9541642820df56ec9397b732f879448e78cce5..2e695ccad0f09ec9160eb90498eb772dd7f49e1b 100644 --- a/src/QUI/FrontendUsers/Events.php +++ b/src/QUI/FrontendUsers/Events.php @@ -62,8 +62,9 @@ public static function onSiteSave(QUI\Interfaces\Projects\Site $Site): void { // register path if ( - $Site->getAttribute('active') && - $Site->getAttribute('type') == 'quiqqer/frontend-users:types/profile' + $Site->getAttribute('active') + && $Site->getAttribute('type') == 'quiqqer/frontend-users:types/profile' + && method_exists($Site, 'getLocation') ) { $url = $Site->getLocation(); $url = str_replace(QUI\Rewrite::URL_DEFAULT_SUFFIX, '', $url); diff --git a/src/QUI/FrontendUsers/Handler.php b/src/QUI/FrontendUsers/Handler.php index 276ea43f2557c14055c27268fb39315b4f10fd93..036f8d2849ed015b5e989a2e94cc94892e643038 100644 --- a/src/QUI/FrontendUsers/Handler.php +++ b/src/QUI/FrontendUsers/Handler.php @@ -141,7 +141,7 @@ public function getRegistrars(): RegistrarCollection * @param string $registrar - Registrar type * @return false|RegistrarInterface */ - public function getRegistrar(string $registrar): bool|RegistrarInterface + public function getRegistrar(string $registrar): bool | RegistrarInterface { /** @var RegistrarInterface $Registrar */ foreach ($this->getAvailableRegistrars() as $Registrar) { @@ -159,7 +159,7 @@ public function getRegistrar(string $registrar): bool|RegistrarInterface * @param QUI\Interfaces\Users\User $User * @return RegistrarInterface|false */ - public function getRegistrarByUser(QUI\Interfaces\Users\User $User): bool|RegistrarInterface + public function getRegistrarByUser(QUI\Interfaces\Users\User $User): bool | RegistrarInterface { $registrar = $User->getAttribute(self::USER_ATTR_REGISTRAR); @@ -176,7 +176,7 @@ public function getRegistrarByUser(QUI\Interfaces\Users\User $User): bool|Regist * @param string $hash * @return false|RegistrarInterface */ - public function getRegistrarByHash(string $hash): bool|RegistrarInterface + public function getRegistrarByHash(string $hash): bool | RegistrarInterface { /** @var RegistrarInterface $Registrar */ foreach ($this->getAvailableRegistrars() as $Registrar) { @@ -347,10 +347,10 @@ public function getMailSettings(): array /** * Get settings for one or all Registrars * - * @param string|null $registrarClass (optional) - Registar class path (namespace) + * @param string|null $registrarClass (optional) - Registrar class path (namespace) * @return array */ - public function getRegistrarSettings(string $registrarClass = null): array + public function getRegistrarSettings(null | string $registrarClass = null): array { try { $Conf = QUI::getPackage('quiqqer/frontend-users')->getConfig(); @@ -484,7 +484,7 @@ public function sendActivationMail(QUI\Interfaces\Users\User $User, RegistrarInt public function sendWelcomeMail( QUI\Interfaces\Users\User $User, QUI\Projects\Project $Project, - string $userPassword = null + null | string $userPassword = null ): void { $email = $User->getAttribute('email'); @@ -600,10 +600,10 @@ public function sendRegistrationNotice(QUI\Interfaces\Users\User $User, QUI\Proj } /** - * Send activtion mail for a user account + * Send deactivation mail for a user account * - * @param QUI\Users\User $User - * @param string $newEmail - New E-Mail-Adress + * @param QUI\Interfaces\Users\User $User + * @param string $newEmail - New E-Mail-Address * @param QUI\Projects\Project $Project - The QUIQQER Project where the change action took place * @return void * @throws QUI\Exception @@ -838,7 +838,7 @@ public function sendMail(array $mailData, array $recipients, string $templateFil * @return QUI\Projects\Site|false - Site object or false if no ACTIVE registration site found * @throws QUI\Exception */ - public function getRegistrationSite(QUI\Projects\Project $Project = null): bool|QUI\Projects\Site + public function getRegistrationSite(null | QUI\Projects\Project $Project = null): bool | QUI\Projects\Site { if (is_null($Project)) { $Project = QUI::getProjectManager()->getStandard(); @@ -865,7 +865,7 @@ public function getRegistrationSite(QUI\Projects\Project $Project = null): bool| * @return QUI\Projects\Site|false - Site object or false if no ACTIVE registration site found * @throws QUI\Exception */ - public function getRegistrationSignUpSite(QUI\Projects\Project $Project = null): bool|QUI\Projects\Site + public function getRegistrationSignUpSite(null | QUI\Projects\Project $Project = null): bool | QUI\Projects\Site { if (is_null($Project)) { $Project = QUI::getProjectManager()->getStandard(); @@ -892,7 +892,7 @@ public function getRegistrationSignUpSite(QUI\Projects\Project $Project = null): * @return QUI\Projects\Site|false - Site object or false if no ACTIVE login site found * @throws QUI\Exception */ - public function getLoginSite(QUI\Projects\Project $Project = null): bool|QUI\Projects\Site + public function getLoginSite(null | QUI\Projects\Project $Project = null): bool | QUI\Projects\Site { if (is_null($Project)) { $Project = QUI::getProjectManager()->getStandard(); @@ -919,7 +919,7 @@ public function getLoginSite(QUI\Projects\Project $Project = null): bool|QUI\Pro * @return QUI\Projects\Site|false - Site object or false if no ACTIVE profile site found * @throws QUI\Exception */ - public function getProfileSite(QUI\Projects\Project $Project = null): bool|QUI\Projects\Site + public function getProfileSite(null | QUI\Projects\Project $Project = null): bool | QUI\Projects\Site { if (is_null($Project)) { $Project = QUI::getProjectManager()->getStandard(); @@ -944,7 +944,7 @@ public function getProfileSite(QUI\Projects\Project $Project = null): bool|QUI\P * * @return false|QUI\Projects\Site */ - public function getRedirectOnActivationSite(): bool|QUI\Projects\Site + public function getRedirectOnActivationSite(): bool | QUI\Projects\Site { try { $registrationSettings = $this->getRegistrationSettings(); diff --git a/src/QUI/FrontendUsers/RegistrarInterface.php b/src/QUI/FrontendUsers/RegistrarInterface.php index e8b76bf1e2ab1b1a0e5643f67a5bbdbe2b923753..2a54cf8825e961ecb6d9b1141274978ad54ba00f 100644 --- a/src/QUI/FrontendUsers/RegistrarInterface.php +++ b/src/QUI/FrontendUsers/RegistrarInterface.php @@ -98,7 +98,7 @@ public function getControl(): Control; * @param ?QUI\Locale $Locale (optional) - If omitted use QUI::getLocale() * @return string */ - public function getTitle(QUI\Locale $Locale = null): string; + public function getTitle(null | QUI\Locale $Locale = null): string; /** * Get description @@ -106,7 +106,7 @@ public function getTitle(QUI\Locale $Locale = null): string; * @param ?QUI\Locale $Locale (optional) - If omitted use QUI::getLocale() * @return string */ - public function getDescription(QUI\Locale $Locale = null): string; + public function getDescription(null | QUI\Locale $Locale = null): string; /** * Set current Project the Registrar works for diff --git a/src/QUI/FrontendUsers/Registrars/Email/Registrar.php b/src/QUI/FrontendUsers/Registrars/Email/Registrar.php index 6e90350ac0a703825315127bb658018355410d8d..cb0f6a7c984c4a56de34dd93d234db9a387c1ead 100644 --- a/src/QUI/FrontendUsers/Registrars/Email/Registrar.php +++ b/src/QUI/FrontendUsers/Registrars/Email/Registrar.php @@ -37,7 +37,6 @@ public function onRegistered(QUI\Interfaces\Users\User $User): void $registrationSettings = $RegistrarHandler->getRegistrationSettings(); $useAddress = boolval($registrationSettings['addressInput']); - /** @var QUI\Users\User $User */ $firstname = $this->getAttribute('firstname'); $lastname = $this->getAttribute('lastname'); @@ -382,7 +381,7 @@ public function getTitle(?QUI\Locale $Locale = null): string * @param QUI\Locale|null $Locale (optional) - If omitted use QUI::getLocale() * @return string */ - public function getDescription(QUI\Locale $Locale = null): string + public function getDescription(null | QUI\Locale $Locale = null): string { if (is_null($Locale)) { $Locale = QUI::getLocale(); diff --git a/src/QUI/FrontendUsers/RegistrationUtils.php b/src/QUI/FrontendUsers/RegistrationUtils.php index 3b79a742672c4061bed00bc691b863838b205849..31fac37e77b741b3466bf15288dc0a5d3df8856f 100644 --- a/src/QUI/FrontendUsers/RegistrationUtils.php +++ b/src/QUI/FrontendUsers/RegistrationUtils.php @@ -19,7 +19,7 @@ class RegistrationUtils * @param Project|null $Project $Project (optional) - QUIQQER Project [default: QUI::getRewrite()->getProject()] * @return string */ - public static function getFurtherLinksText(Project $Project = null): string + public static function getFurtherLinksText(null | Project $Project = null): string { try { if (empty($Project)) { diff --git a/src/QUI/FrontendUsers/Rest/Routes/GetRegisterRequiredFields.php b/src/QUI/FrontendUsers/Rest/Routes/GetRegisterRequiredFields.php index 2ab20745d75822281b2f7e7f76eea4e5cfaf9bf0..a72d9bde0f8d64ea2cd4fe7d3f1187f2440956fd 100644 --- a/src/QUI/FrontendUsers/Rest/Routes/GetRegisterRequiredFields.php +++ b/src/QUI/FrontendUsers/Rest/Routes/GetRegisterRequiredFields.php @@ -22,6 +22,10 @@ class GetRegisterRequiredFields */ public static function call(SlimRequest $Request, SlimResponse $Response, array $args): SlimResponse { + if (!class_exists('QUI\REST\ResponseFactory')) { + throw new QUI\Exception('Class "QUI\REST\ResponseFactory" not found.'); + } + $ResponseFactory = new QUI\REST\ResponseFactory(); try { diff --git a/src/QUI/FrontendUsers/Utils.php b/src/QUI/FrontendUsers/Utils.php index 6d516c2dd09735ef056cb30d62cb1ef83976e265..393756dd5c136f52e658611500706d2fd3d93ae9 100644 --- a/src/QUI/FrontendUsers/Utils.php +++ b/src/QUI/FrontendUsers/Utils.php @@ -31,7 +31,6 @@ public static function getFrontendUsersPackages(): array $packages = QUI::getPackageManager()->getInstalled(); $list = []; - /* @var $Package <Package */ foreach ($packages as $package) { try { $Package = QUI::getPackage($package['name']); @@ -72,7 +71,6 @@ public static function getProfileCategories(): array $packages = self::getFrontendUsersPackages(); $Engine = QUI::getTemplateManager()->getEngine(); - /** @var Package $Package */ foreach ($packages as $Package) { $Parser = new QUI\Utils\XML\Settings(); $Parser->setXMLPath('//quiqqer/frontend-users/profile'); @@ -136,7 +134,7 @@ public static function getProfileCategories(): array * * @throws Exception */ - public static function getProfileSetting(string $category, bool|string $settings = false): array + public static function getProfileSetting(string $category, bool | string $settings = false): array { if ($category) { $categories = [self::getProfileCategory($category)]; @@ -167,8 +165,10 @@ public static function getProfileSetting(string $category, bool|string $settings * * @throws Exception */ - public static function getProfileSettingControl(string $category, bool|string $settings = false): ?ControlInterface - { + public static function getProfileSettingControl( + string $category, + bool | string $settings = false + ): ?ControlInterface { $setting = self::getProfileSetting($category, $settings); $Control = null; @@ -291,8 +291,8 @@ public static function getProfileBarCategorySettings(): array */ public static function hasPermissionToViewCategory( string $category, - bool|string $setting = false, - QUI\Interfaces\Users\User $User = null + bool | string $setting = false, + null | QUI\Interfaces\Users\User $User = null ): bool { if ($User === null) { $User = QUI::getUserBySession(); @@ -348,7 +348,7 @@ public static function loadTranslationForCategories(array $categories = []): arr */ public static function setUrlsToCategorySettings( array $categories = [], - QUI\Projects\Project $Project = null + null | QUI\Projects\Project $Project = null ): array { try { if ($Project === null) {