[ticket/16955] Clean up avatar classes

PHPBB3-16955
This commit is contained in:
Marc Alexander 2022-12-27 16:22:34 +01:00
parent ba3a1389e6
commit 5756d4dd9b
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
3 changed files with 6 additions and 6 deletions

View file

@ -95,7 +95,7 @@ interface driver_interface
* an array that will be passed to vsprintf() with the language key in * an array that will be passed to vsprintf() with the language key in
* the first array key. * the first array key.
* *
* @return array Array containing the avatar data as follows: * @return array|false Array containing the avatar data as follows or false if processing failed:
* ['avatar'], ['avatar_width'], ['avatar_height'] * ['avatar'], ['avatar_width'], ['avatar_height']
*/ */
public function process_form($request, $template, $user, $row, &$error); public function process_form($request, $template, $user, $row, &$error);

View file

@ -284,6 +284,6 @@ class upload extends \phpbb\avatar\driver\driver
*/ */
protected function can_upload() protected function can_upload()
{ {
return $this->php_ini->getBool('file_uploads'); return (bool) $this->php_ini->getBool('file_uploads');
} }
} }

View file

@ -29,7 +29,7 @@ class manager
/** /**
* Array that contains a list of enabled drivers * Array that contains a list of enabled drivers
* @var array|bool * @var array|false
*/ */
protected static $enabled_drivers = false; protected static $enabled_drivers = false;
@ -87,7 +87,7 @@ class manager
* @param string $avatar_type Avatar type; by default an avatar's service container name * @param string $avatar_type Avatar type; by default an avatar's service container name
* @param bool $load_enabled Load only enabled avatars * @param bool $load_enabled Load only enabled avatars
* *
* @return object Avatar driver object * @return object|null Avatar driver object
*/ */
public function get_driver($avatar_type, $load_enabled = true) public function get_driver($avatar_type, $load_enabled = true)
{ {
@ -181,7 +181,7 @@ class manager
$this->load_enabled_drivers(); $this->load_enabled_drivers();
} }
return self::$enabled_drivers; return self::$enabled_drivers ?: [];
} }
/** /**
@ -254,7 +254,7 @@ class manager
{ {
$config_name = $driver->get_config_name(); $config_name = $driver->get_config_name();
return $this->config["allow_avatar_{$config_name}"]; return (bool) $this->config["allow_avatar_{$config_name}"];
} }
/** /**