diff --git a/lib/ycom.php b/lib/ycom.php index 785dec20..d2169e61 100644 --- a/lib/ycom.php +++ b/lib/ycom.php @@ -11,7 +11,7 @@ public static function addTable(string $table_name): void } /** - * @return string[] + * @return array */ public static function getTables(): array { diff --git a/lib/ycom_user.php b/lib/ycom_user.php index 5ee96b1a..56527e66 100644 --- a/lib/ycom_user.php +++ b/lib/ycom_user.php @@ -1,12 +1,12 @@ */ public function getGroups(): array { @@ -49,7 +49,7 @@ public function getGroups(): array /** * @param array $data - * @return null|rex_ycom_user|rex_yform_manager_dataset + * @return rex_ycom_user|rex_yform_manager_dataset|null */ public static function createUserByEmail(array $data) { diff --git a/plugins/auth/install.php b/plugins/auth/install.php index 6af7d865..e653d172 100644 --- a/plugins/auth/install.php +++ b/plugins/auth/install.php @@ -66,7 +66,6 @@ ->setQuery('delete from `' . rex_yform_manager_field::table() . '` where `table_name`="rex_ycom_user" and `type_id`="value" and `type_name`="checkbox" and `name`="termofuse_accepted"', []) ->setQuery('update `rex_config` set `key`="article_id_jump_termsofuse" where `key`="article_id_jump_termofuse" and `namespace`="ycom/auth"', []) ->setQuery('delete from `' . rex_yform_manager_field::table() . '` where `table_name`="rex_ycom_user" and `type_id`="value" and `type_name`="generate_key" and `name`="session_key"'); - } catch (rex_sql_exception $e) { dump($e); exit; diff --git a/plugins/auth/lib/ycom_auth.php b/plugins/auth/lib/ycom_auth.php index b901ecba..9df448d2 100644 --- a/plugins/auth/lib/ycom_auth.php +++ b/plugins/auth/lib/ycom_auth.php @@ -371,7 +371,7 @@ public static function login(array $params): int /** * @param array $params - * @return null|false|rex_ycom_user + * @return false|rex_ycom_user|null */ public static function loginWithParams($params, ?callable $filter = null) { @@ -428,13 +428,13 @@ public static function checkPassword(string $password, $user_id): bool public static function setUser(rex_ycom_user $me): void { - \rex_login::startSession(); + rex_login::startSession(); self::setSessionVar('UID', $me->getId()); self::$me = $me; } /** - * @return null|rex_ycom_user + * @return rex_ycom_user|null */ public static function getUser() { @@ -596,8 +596,8 @@ public static function cleanReferer(string $refererURL): string } /** - * @param string[] $returnTos - * @param string[] $allowedDomains + * @param array $returnTos + * @param array $allowedDomains */ public static function getReturnTo(array $returnTos, array $allowedDomains): string { diff --git a/plugins/auth/lib/ycom_auth_rules.php b/plugins/auth/lib/ycom_auth_rules.php index 83bb9efc..c90bcd36 100644 --- a/plugins/auth/lib/ycom_auth_rules.php +++ b/plugins/auth/lib/ycom_auth_rules.php @@ -97,7 +97,7 @@ public function check(rex_ycom_user $user, string $rule_name = 'login_try_5_paus } /** - * @return string[] + * @return array */ public function getOptions(): array { diff --git a/plugins/auth/lib/yform/trait_value_auth_extern.php b/plugins/auth/lib/yform/trait_value_auth_extern.php index 50889c56..a04c2645 100644 --- a/plugins/auth/lib/yform/trait_value_auth_extern.php +++ b/plugins/auth/lib/yform/trait_value_auth_extern.php @@ -4,7 +4,7 @@ trait rex_yform_trait_value_auth_extern { /** * @throws rex_exception - * @return array|string[] + * @return array|array */ private function auth_loadSettings(): array { diff --git a/plugins/auth/lib/yform/value/ycom_auth_cas.php b/plugins/auth/lib/yform/value/ycom_auth_cas.php index 2b95b7b6..49905447 100644 --- a/plugins/auth/lib/yform/value/ycom_auth_cas.php +++ b/plugins/auth/lib/yform/value/ycom_auth_cas.php @@ -11,7 +11,7 @@ class rex_yform_value_ycom_auth_cas extends rex_yform_value_abstract { - /** @var array|string[] */ + /** @var array|array */ private static array $requestAuthFunctions = ['auth', 'logout']; private string $casFile = 'cas.php'; @@ -19,7 +19,7 @@ public function enterObject(): void { rex_login::startSession(); - $casConfigPath = \rex_addon::get('ycom')->getDataPath($this->casFile); + $casConfigPath = rex_addon::get('ycom')->getDataPath($this->casFile); if (!file_exists($casConfigPath)) { throw new rex_exception('CAS Settings file not found [' . $casConfigPath . ']'); } @@ -112,16 +112,16 @@ public function enterObject(): void $params['ignorePassword'] = true; $params['loginPassword'] = ''; - $loginStatus = \rex_ycom_auth::login($params); + $loginStatus = rex_ycom_auth::login($params); if (rex_ycom_auth::STATUS_HAS_LOGGED_IN == $loginStatus) { // already logged in rex_ycom_user::updateUser($data); rex_response::sendCacheControl(); - \rex_response::sendRedirect($returnTo); + rex_response::sendRedirect($returnTo); } // if user not found, check if exists, but no permission - $user = \rex_ycom_user::query()->where('email', $data['email'])->findOne(); + $user = rex_ycom_user::query()->where('email', $data['email'])->findOne(); if ($user) { $this->params['warning_messages'][] = ('' != $this->getElement(2)) ? $this->getElement(2) : '{{ saml.error.ycom_login_failed }}'; return; @@ -142,7 +142,7 @@ public function enterObject(): void $params['loginStay'] = false; $params['filter'] = []; $params['loginPassword'] = ''; - $loginStatus = \rex_ycom_auth::login($params); + $loginStatus = rex_ycom_auth::login($params); if (rex_ycom_auth::STATUS_HAS_LOGGED_IN != $loginStatus) { if ($this->params['debug']) { diff --git a/plugins/auth/lib/yform/value/ycom_auth_oauth2.php b/plugins/auth/lib/yform/value/ycom_auth_oauth2.php index a1c70abd..39dccaf6 100644 --- a/plugins/auth/lib/yform/value/ycom_auth_oauth2.php +++ b/plugins/auth/lib/yform/value/ycom_auth_oauth2.php @@ -14,15 +14,16 @@ use League\OAuth2\Client\Provider\Exception\IdentityProviderException; use League\OAuth2\Client\Provider\GenericProvider; +use League\OAuth2\Client\Token\AccessToken; class rex_yform_value_ycom_auth_oauth2 extends rex_yform_value_abstract { use rex_yform_trait_value_auth_extern; - /** @var array|string[] */ + /** @var array|array */ private array $auth_requestFunctions = ['init', 'code', 'state']; private bool $auth_directLink = false; - /** @var array|string[] */ + /** @var array|array */ private array $auth_SessionVars = ['OAUTH2_oauth2state']; private string $auth_ClassKey = 'oauth2'; @@ -74,7 +75,7 @@ public function enterObject(): void $accessToken = null; try { - /** @var \League\OAuth2\Client\Token\AccessToken $accessToken */ + /** @var AccessToken $accessToken */ $accessToken = $provider->getAccessToken('authorization_code', [ 'code' => $code, ]); diff --git a/plugins/auth/lib/yform/value/ycom_auth_saml.php b/plugins/auth/lib/yform/value/ycom_auth_saml.php index 8c4f5498..4b155515 100644 --- a/plugins/auth/lib/yform/value/ycom_auth_saml.php +++ b/plugins/auth/lib/yform/value/ycom_auth_saml.php @@ -20,10 +20,10 @@ class rex_yform_value_ycom_auth_saml extends rex_yform_value_abstract { use rex_yform_trait_value_auth_extern; - /** @var array|string[] */ + /** @var array|array */ private array $auth_requestFunctions = ['auth', 'sso', 'acs', 'slo', 'sls']; private bool $auth_directLink = false; - /** @var array|string[] */ + /** @var array|array */ private array $auth_SessionVars = ['SAML_Userdata', 'SAML_NameId', 'SAML_SessionIndex', 'SAML_AuthNRequestID', 'SAML_LogoutRequestID', 'SAML_NameIdFormat', 'SAML_ssoDate']; private string $auth_ClassKey = 'saml'; diff --git a/plugins/group/lib/ycom_group.php b/plugins/group/lib/ycom_group.php index a928cfc8..b79576d0 100644 --- a/plugins/group/lib/ycom_group.php +++ b/plugins/group/lib/ycom_group.php @@ -4,7 +4,7 @@ class rex_ycom_group extends rex_yform_manager_dataset { - /** @var string[] */ + /** @var array */ public static array $perms = [ '0' => 'translate:ycom_group_forallgroups', '1' => 'translate:ycom_group_inallgroups', @@ -14,7 +14,7 @@ class rex_ycom_group extends rex_yform_manager_dataset /** * @throws rex_exception - * @return string[] + * @return array */ public static function getGroups(): array { diff --git a/plugins/media_auth/boot.php b/plugins/media_auth/boot.php index 3fdcfab3..2f822481 100644 --- a/plugins/media_auth/boot.php +++ b/plugins/media_auth/boot.php @@ -15,7 +15,7 @@ return false; } $rex_media = $ep->getParam('element'); - return \rex_ycom_media_auth::checkFrontendPerm($rex_media); + return rex_ycom_media_auth::checkFrontendPerm($rex_media); }); rex_extension::register(['MEDIA_MANAGER_BEFORE_SEND'], static function (rex_extension_point $ep) { diff --git a/plugins/media_auth/lib/ycom_media_auth.php b/plugins/media_auth/lib/ycom_media_auth.php index 939c6d66..4cffe33b 100644 --- a/plugins/media_auth/lib/ycom_media_auth.php +++ b/plugins/media_auth/lib/ycom_media_auth.php @@ -4,7 +4,7 @@ class rex_ycom_media_auth extends rex_yform_manager_dataset { - /** @var string[] */ + /** @var array */ public static array $perms = [ '0' => 'translate:ycom_perm_all', '1' => 'translate:ycom_perm_only_logged_in', diff --git a/plugins/media_auth/lib/ycom_media_auth_rules.php b/plugins/media_auth/lib/ycom_media_auth_rules.php index 41f419cd..340a34dc 100644 --- a/plugins/media_auth/lib/ycom_media_auth_rules.php +++ b/plugins/media_auth/lib/ycom_media_auth_rules.php @@ -6,7 +6,7 @@ class rex_ycom_media_auth_rules { - /** @var array */ + /** @var array}> */ private array $rules; public function __construct() @@ -84,7 +84,7 @@ public function check($rule_name): void } /** - * @return string[] + * @return array */ public function getOptions(): array { diff --git a/tests/unit/login_test.php b/tests/unit/login_test.php index 1b8d553f..9aae7510 100644 --- a/tests/unit/login_test.php +++ b/tests/unit/login_test.php @@ -18,7 +18,6 @@ public function testLogin() ]; $status = rex_ycom_auth::login($params); - static::assertEquals(rex_ycom_auth::STATUS_LOGIN_FAILED, $status); - + self::assertEquals(rex_ycom_auth::STATUS_LOGIN_FAILED, $status); } }