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

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

chore: update phpstan version and remove redundant error logs

See merge request !64
Übergeordnete d9c34487 58156ac2
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
2 Merge Requests!64chore: update phpstan version and remove redundant error logs,!50Update 'next-3.x' with latest changes from 'main'
Pipeline-Nr. 15999 mit Warnungen bestanden
werden angezeigt mit 64 Ergänzungen und 104 Löschungen
<?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"/>
......
......@@ -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'],
......
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
......@@ -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
......
......@@ -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'])) {
......
......@@ -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'
......
......@@ -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);
});
}
......
......@@ -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 {
......
......@@ -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 . '\')"'
......
......@@ -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();
......
......@@ -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();
......
......@@ -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);
......
......@@ -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();
......
......@@ -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
......
......@@ -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();
......
......@@ -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)) {
......
......@@ -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 {
......
......@@ -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) {
......
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