@@ -132,10 +132,10 @@ public function load_user_by_username($username)
132
132
* @param bool $query Should we query the database if this user has not yet been loaded?
133
133
* Typically this should be left as false and you should make sure
134
134
* you load users ahead of time with load_users()
135
- * @return array|bool Row from the database of the user or Anonymous if the user wasn't loaded/does not exist
135
+ * @return array|false Row from the database of the user or Anonymous if the user wasn't loaded/does not exist
136
136
* or bool False if the anonymous user was not loaded
137
137
*/
138
- public function get_user ($ user_id , $ query = false )
138
+ public function get_user (int $ user_id , bool $ query = false )
139
139
{
140
140
if (isset ($ this ->users [$ user_id ]))
141
141
{
@@ -162,14 +162,14 @@ public function get_user($user_id, $query = false)
162
162
* colour (for obtaining the user colour)
163
163
* full (for obtaining a html string representing a coloured link to the users profile)
164
164
* no_profile (the same as full but forcing no profile link)
165
- * @param string $guest_username Optional parameter to specify the guest username. It will be used in favor of the GUEST language variable then.
166
- * @param string $custom_profile_url Optional parameter to specify a profile url. The user id get appended to this url as &u={user_id}
165
+ * @param string|bool $guest_username Optional parameter to specify the guest username. It will be used in favor of the GUEST language variable then.
166
+ * @param string|bool $custom_profile_url Optional parameter to specify a profile url. The user id get appended to this url as &u={user_id}
167
167
* @param bool $query Should we query the database if this user has not yet been loaded?
168
168
* Typically this should be left as false and you should make sure
169
169
* you load users ahead of time with load_users()
170
170
* @return string
171
171
*/
172
- public function get_username ($ user_id , $ mode , $ guest_username = false , $ custom_profile_url = false , $ query = false )
172
+ public function get_username (int $ user_id , string $ mode , $ guest_username = false , $ custom_profile_url = false , bool $ query = false ): string
173
173
{
174
174
if (!($ user = $ this ->get_user ($ user_id , $ query )))
175
175
{
@@ -215,11 +215,11 @@ public function get_avatar($user_id, $query = false, $lazy = false)
215
215
* you load users ahead of time with load_users()
216
216
* @return array Array with keys 'rank_title', 'rank_img', and 'rank_img_src'
217
217
*/
218
- public function get_rank ($ user_id , $ query = false )
218
+ public function get_rank (int $ user_id , bool $ query = false ): array
219
219
{
220
220
if (!($ user = $ this ->get_user ($ user_id , $ query )))
221
221
{
222
- return '' ;
222
+ return [] ;
223
223
}
224
224
225
225
if (!function_exists ('phpbb_get_user_rank ' ))
@@ -233,7 +233,7 @@ public function get_rank($user_id, $query = false)
233
233
'rank_img_src ' ,
234
234
);
235
235
236
- $ user_rank_data = phpbb_get_user_rank ($ user , (( $ user ['user_id ' ] == ANONYMOUS ) ? false : $ user ['user_posts ' ]));
236
+ $ user_rank_data = phpbb_get_user_rank ($ user , ($ user ['user_id ' ] == ANONYMOUS ? false : $ user ['user_posts ' ]));
237
237
$ rank ['rank_title ' ] = $ user_rank_data ['title ' ];
238
238
$ rank ['rank_img ' ] = $ user_rank_data ['img ' ];
239
239
$ rank ['rank_img_src ' ] = $ user_rank_data ['img_src ' ];
0 commit comments