diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index 82a3e570e5..81b14cc02c 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -99,7 +99,7 @@ class acp_language /** * Main handler for acp_language * - * @param int $id Module ID + * @param string $id Module ID * @param string $mode Module mode */ public function main($id, $mode) diff --git a/phpBB/includes/acp/acp_storage.php b/phpBB/includes/acp/acp_storage.php index 2f651f0e18..adde39baf3 100644 --- a/phpBB/includes/acp/acp_storage.php +++ b/phpBB/includes/acp/acp_storage.php @@ -55,7 +55,7 @@ class acp_storage public $u_action; /** - * @param string $id + * @param string $id * @param string $mode */ public function main($id, $mode) diff --git a/phpBB/includes/diff/diff.php b/phpBB/includes/diff/diff.php index bed16285a1..8b7d71020a 100644 --- a/phpBB/includes/diff/diff.php +++ b/phpBB/includes/diff/diff.php @@ -340,7 +340,7 @@ class mapped_diff extends diff { if (count($from_lines) != count($mapped_from_lines) || count($to_lines) != count($mapped_to_lines)) { - return false; + return; } parent::__construct($mapped_from_lines, $mapped_to_lines); @@ -760,11 +760,31 @@ class diff3 extends diff */ class diff3_op { + /** + * @var array|mixed + */ + protected $orig; + + /** + * @var array|mixed + */ + protected $final1; + + /** + * @var array|mixed + */ + protected $final2; + + /** + * @var false + */ + protected $_merged; + function __construct($orig = false, $final1 = false, $final2 = false) { - $this->orig = $orig ? $orig : array(); - $this->final1 = $final1 ? $final1 : array(); - $this->final2 = $final2 ? $final2 : array(); + $this->orig = $orig ?: array(); + $this->final1 = $final1 ?: array(); + $this->final2 = $final2 ?: array(); } function merged() @@ -1059,8 +1079,6 @@ class diff3_op return; } - - return; } } @@ -1074,7 +1092,7 @@ class diff3_op_copy extends diff3_op { function __construct($lines = false) { - $this->orig = $lines ? $lines : array(); + $this->orig = $lines ?: array(); $this->final1 = &$this->orig; $this->final2 = &$this->orig; } @@ -1098,6 +1116,21 @@ class diff3_op_copy extends diff3_op */ class diff3_block_builder { + /** + * @var array + */ + protected $orig; + + /** + * @var array + */ + protected $final1; + + /** + * @var array + */ + protected $final2; + function __construct() { $this->_init(); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 05ea03d446..58c142c740 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1694,6 +1694,7 @@ function generate_board_url($without_script_path = false) * @param string $url The url to redirect to * @param bool $return If true, do not redirect but return the sanitized URL. Default is no return. * @param bool $disable_cd_check If true, redirect() will redirect to an external domain. If false, the redirect point to the boards url if it does not match the current domain. Default is false. +* @return string|never */ function redirect($url, $return = false, $disable_cd_check = false) { diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 27f9292ac5..54ba46fb67 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2487,7 +2487,7 @@ function auto_prune($forum_id, $prune_mode, $prune_flags, $prune_days, $prune_fr * @param \phpbb\db\driver\driver_interface $db Database connection * @param \phpbb\cache\driver\driver_interface $cache Cache driver * @param \phpbb\auth\auth $auth Authentication object -* @return null +* @return void */ function phpbb_cache_moderators($db, $cache, $auth) { diff --git a/phpBB/includes/functions_compatibility.php b/phpBB/includes/functions_compatibility.php index 0783035e6c..dd56aa9622 100644 --- a/phpBB/includes/functions_compatibility.php +++ b/phpBB/includes/functions_compatibility.php @@ -122,12 +122,12 @@ function tz_select($default = '', $truncate = false) * must be carried through for the moderators table. * * @deprecated 3.1.0 (To be removed: 4.0.0) -* @return null +* @return void */ function cache_moderators() { global $db, $cache, $auth; - return phpbb_cache_moderators($db, $cache, $auth); + phpbb_cache_moderators($db, $cache, $auth); } /** @@ -249,7 +249,7 @@ function add_log() * if it changes too frequently (true) to be * efficiently cached. * - * @return null + * @return void * * @deprecated 3.1.0 (To be removed: 4.0.0) */ @@ -279,7 +279,7 @@ function set_config($config_name, $config_value, $is_dynamic = false, \phpbb\con * if it changes too frequently (true) to be * efficiently cached. * - * @return null + * @return void * * @deprecated 3.1.0 (To be removed: 4.0.0) */ @@ -336,7 +336,7 @@ function request_var($var_name, $default, $multibyte = false, $cookie = false, $ $static_request = $request; if (empty($var_name)) { - return; + return null; } } else if ($request === false) @@ -344,7 +344,7 @@ function request_var($var_name, $default, $multibyte = false, $cookie = false, $ $static_request = null; if (empty($var_name)) { - return; + return null; } } $tmp_request = $static_request; @@ -575,7 +575,7 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage * Supported types are: MX (default), A, AAAA, NS, TXT, CNAME * Other types may work or may not work * -* @return mixed true if entry found, +* @return bool|null true if entry found, * false if entry not found, * null if this function is not supported by this environment * @@ -615,7 +615,7 @@ function phpbb_inet_ntop($in_addr) * * @param string $address A human readable IPv4 or IPv6 address. * - * @return mixed false if address is invalid, + * @return false|string false if address is invalid, * in_addr representation of the given address otherwise (string) * * @deprecated 3.3.0-b2 (To be removed: 4.0.0) @@ -671,7 +671,7 @@ function phpbb_load_extensions_autoloaders($phpbb_root_path) * * @param array $param Parameter array, see $param_defaults array. * -* @return null +* @return void * * @deprecated 3.2.10 (To be removed 4.0.0) */ diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 783fa67044..349f3582c4 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -144,8 +144,6 @@ function gen_sort_selects(&$limit_days, &$sort_by_text, &$sort_days, &$sort_key, 'sorts', ); extract($phpbb_dispatcher->trigger_event('core.gen_sort_selects_after', compact($vars))); - - return; } /** @@ -283,8 +281,6 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list 'S_JUMPBOX_ACTION' => $action, 'HIDDEN_FIELDS_FOR_JUMPBOX' => build_hidden_fields($url_parts['params']), )); - - return; } /** @@ -441,6 +437,8 @@ function get_context($text, $words, $length = 400) { return str_replace($characters, $entities, ((utf8_strlen($text) >= $length + 3) ? utf8_substr($text, 0, $length) . '...' : $text)); } + + return ''; } /** @@ -468,7 +466,7 @@ function phpbb_clean_search_string($search_string) * * @param string &$message Original message, passed by reference * @param string $bbcode_uid BBCode UID -* @return null +* @return void */ function decode_message(&$message, $bbcode_uid = '') { @@ -961,7 +959,6 @@ function make_clickable($text, $server_url = false, string $class = 'postlink') if ($value == $static_class) { $element_exists = true; - return; } } ); diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 9a1f33db37..e274ae8476 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -843,8 +843,6 @@ function generate_forum_nav(&$forum_data_ary) $template->assign_block_vars_array('navlinks', $navlinks_parents); $template->assign_block_vars('navlinks', $navlinks); $template->assign_vars($forum_template_data); - - return; } /** @@ -966,8 +964,6 @@ function get_moderators(&$forum_moderators, $forum_id = false) } } $db->sql_freeresult($result); - - return; } /** @@ -999,8 +995,6 @@ function gen_forum_auth_level($mode, $forum_id, $forum_status) { $template->assign_block_vars('rules', array('RULE' => $rule)); } - - return; } /** @@ -1482,8 +1476,6 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $s_watching['title_toggle'] = $user->lang[((!$is_watching) ? 'STOP' : 'START') . '_WATCHING_' . strtoupper($mode)]; $s_watching['is_watching'] = $is_watching; } - - return; } /** diff --git a/phpBB/phpbb/auth/provider/base.php b/phpBB/phpbb/auth/provider/base.php index 97a8b8d4ad..98945a2ddf 100644 --- a/phpBB/phpbb/auth/provider/base.php +++ b/phpBB/phpbb/auth/provider/base.php @@ -79,6 +79,7 @@ abstract class base implements provider_interface */ public function login_link_has_necessary_data(array $login_link_data) { + return null; } /** diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php index 6925980c94..a9fd2783b6 100644 --- a/phpBB/phpbb/auth/provider/oauth/oauth.php +++ b/phpBB/phpbb/auth/provider/oauth/oauth.php @@ -424,6 +424,8 @@ class oauth extends base { return 'LOGIN_LINK_MISSING_DATA'; } + + return null; } /** @@ -475,8 +477,6 @@ class oauth extends base // Clear all tokens belonging to the user $storage = new token_storage($this->db, $this->user, $this->oauth_token_table, $this->oauth_state_table); $storage->clearAllTokens(); - - return; } /** @@ -617,7 +617,7 @@ class oauth extends base * @param array $link_data The same variable given to * {@see \phpbb\auth\provider\provider_interface::link_account} * @param string $service_name The name of the service being used in linking. - * @return array|string|false Returns a language constant (string) if an error is encountered, + * @return string|false|never Returns a language constant (string) if an error is encountered, * an array with error info or false on success. */ protected function link_account_auth_link(array $link_data, $service_name) @@ -661,7 +661,9 @@ class oauth extends base } else { - return $this->set_redirect($service); + $this->set_redirect($service); + + return false; // Not reached } } @@ -669,6 +671,7 @@ class oauth extends base * Performs the query that inserts an account link * * @param array $data This array is passed to db->sql_build_array + * @return void */ protected function link_account_perform_link(array $data) { @@ -852,6 +855,6 @@ class oauth extends base redirect($service->getAuthorizationUri($parameters), false, true); - return []; + return []; // Never reached } } diff --git a/phpBB/phpbb/auth/provider/provider_interface.php b/phpBB/phpbb/auth/provider/provider_interface.php index 43115892be..7e1f0a7a84 100644 --- a/phpBB/phpbb/auth/provider/provider_interface.php +++ b/phpBB/phpbb/auth/provider/provider_interface.php @@ -151,7 +151,7 @@ interface provider_interface * * @param array $login_link_data Any data needed to link a phpBB account to * an external account. - * @return string|void Returns a string with a language constant if there + * @return string|null Returns a string with a language constant if there * is data missing or void if there is no error. */ public function login_link_has_necessary_data(array $login_link_data); diff --git a/phpBB/phpbb/avatar/manager.php b/phpBB/phpbb/avatar/manager.php index 5de3caab10..17fbae09d9 100644 --- a/phpBB/phpbb/avatar/manager.php +++ b/phpBB/phpbb/avatar/manager.php @@ -311,7 +311,7 @@ class manager * avatar data * @param string $table Database table from which the avatar should be deleted * @param string $prefix Prefix of user data columns in database - * @return null + * @return void */ public function handle_avatar_delete(\phpbb\db\driver\driver_interface $db, \phpbb\user $user, $avatar_data, $table, $prefix) { diff --git a/phpBB/phpbb/captcha/plugins/qa.php b/phpBB/phpbb/captcha/plugins/qa.php index 811421a63c..b9bfac33f1 100644 --- a/phpBB/phpbb/captcha/plugins/qa.php +++ b/phpBB/phpbb/captcha/plugins/qa.php @@ -1037,7 +1037,8 @@ class qa { return true; } - return false; } + + return false; } } diff --git a/phpBB/phpbb/composer/installer.php b/phpBB/phpbb/composer/installer.php index 354c7ead28..28aaa4171b 100644 --- a/phpBB/phpbb/composer/installer.php +++ b/phpBB/phpbb/composer/installer.php @@ -150,6 +150,7 @@ class installer * @param io\io_interface|null $io IO object used for the output * * @throws runtime_exception + * @throws JsonValidationException */ protected function do_install(array $packages, $whitelist, io\io_interface $io = null) { @@ -501,6 +502,7 @@ class installer * * @param array $packages Packages to update. * Each entry may be a name or an array associating a version constraint to a name + * @throws JsonValidationException */ protected function generate_ext_json_file(array $packages) { diff --git a/phpBB/phpbb/config/config.php b/phpBB/phpbb/config/config.php index c1495a15f0..a63890caf7 100644 --- a/phpBB/phpbb/config/config.php +++ b/phpBB/phpbb/config/config.php @@ -106,7 +106,7 @@ class config implements \ArrayAccess, \IteratorAggregate, \Countable * @param String $key The configuration option's name * @param bool $use_cache Whether this variable should be cached or if it * changes too frequently to be efficiently cached - * @return null + * @return void */ public function delete($key, $use_cache = true) { diff --git a/phpBB/phpbb/cron/task/core/prune_shadow_topics.php b/phpBB/phpbb/cron/task/core/prune_shadow_topics.php index 81873a673b..d95f3e500e 100644 --- a/phpBB/phpbb/cron/task/core/prune_shadow_topics.php +++ b/phpBB/phpbb/cron/task/core/prune_shadow_topics.php @@ -72,7 +72,7 @@ class prune_shadow_topics extends \phpbb\cron\task\base implements \phpbb\cron\t /** * Runs this cron task. * - * @return null + * @return void */ public function run() { @@ -135,7 +135,7 @@ class prune_shadow_topics extends \phpbb\cron\task\base implements \phpbb\cron\t * * @param \phpbb\request\request_interface $request Request object. * - * @return null + * @return void */ public function parse_parameters(\phpbb\request\request_interface $request) { diff --git a/phpBB/phpbb/db/driver/driver.php b/phpBB/phpbb/db/driver/driver.php index b4220d6e6a..c9b4e8db01 100644 --- a/phpBB/phpbb/db/driver/driver.php +++ b/phpBB/phpbb/db/driver/driver.php @@ -1246,7 +1246,7 @@ abstract class driver implements driver_interface $this->html_hold .= ''; $class = 'row1'; - foreach (array_values($row) as $val) + foreach ($row as $val) { $class = ($class == 'row1') ? 'row2' : 'row1'; $this->html_hold .= '' . (($val) ? $val : ' ') . ''; diff --git a/phpBB/phpbb/db/driver/driver_interface.php b/phpBB/phpbb/db/driver/driver_interface.php index 69a22b3f41..54e3457d3f 100644 --- a/phpBB/phpbb/db/driver/driver_interface.php +++ b/phpBB/phpbb/db/driver/driver_interface.php @@ -365,7 +365,7 @@ interface driver_interface * * @param mixed $query_id Already executed query result, * if false, the last query will be used. - * @return null + * @return void */ public function sql_freeresult($query_id = false); diff --git a/phpBB/phpbb/db/driver/oracle.php b/phpBB/phpbb/db/driver/oracle.php index b777dcfc72..ee4ad9b5f5 100644 --- a/phpBB/phpbb/db/driver/oracle.php +++ b/phpBB/phpbb/db/driver/oracle.php @@ -780,8 +780,6 @@ class oracle extends \phpbb\db\driver\driver $success = @oci_execute($result, OCI_DEFAULT); if ($success) { - array(); - while ($row = oci_fetch_array($result, OCI_ASSOC + OCI_RETURN_NULLS)) { // Take the time spent on parsing rows into account diff --git a/phpBB/phpbb/db/extractor/mssql_extractor.php b/phpBB/phpbb/db/extractor/mssql_extractor.php index 1fa921bc3d..264312a4c4 100644 --- a/phpBB/phpbb/db/extractor/mssql_extractor.php +++ b/phpBB/phpbb/db/extractor/mssql_extractor.php @@ -20,7 +20,7 @@ class mssql_extractor extends base_extractor /** * Writes closing line(s) to database backup * - * @return null + * @return void * @throws extractor_not_initialized_exception when calling this function before init_extractor() */ public function write_end() @@ -310,7 +310,7 @@ class mssql_extractor extends base_extractor * Extracts data from database table (for ODBC driver) * * @param string $table_name name of the database table - * @return null + * @return void * @throws extractor_not_initialized_exception when calling this function before init_extractor() */ protected function write_data_odbc($table_name) diff --git a/phpBB/phpbb/db/extractor/postgres_extractor.php b/phpBB/phpbb/db/extractor/postgres_extractor.php index 2b271104e8..32267ead4a 100644 --- a/phpBB/phpbb/db/extractor/postgres_extractor.php +++ b/phpBB/phpbb/db/extractor/postgres_extractor.php @@ -323,7 +323,7 @@ class postgres_extractor extends base_extractor /** * Writes closing line(s) to database backup * - * @return null + * @return void * @throws extractor_not_initialized_exception when calling this function before init_extractor() */ public function write_end() diff --git a/phpBB/phpbb/db/extractor/sqlite3_extractor.php b/phpBB/phpbb/db/extractor/sqlite3_extractor.php index 92ce9bdcc6..86bb25edde 100644 --- a/phpBB/phpbb/db/extractor/sqlite3_extractor.php +++ b/phpBB/phpbb/db/extractor/sqlite3_extractor.php @@ -135,7 +135,7 @@ class sqlite3_extractor extends base_extractor /** * Writes closing line(s) to database backup * - * @return null + * @return void * @throws extractor_not_initialized_exception when calling this function before init_extractor() */ public function write_end() diff --git a/phpBB/phpbb/db/migration/tool/config.php b/phpBB/phpbb/db/migration/tool/config.php index b5404bdba5..77f1d7cfd1 100644 --- a/phpBB/phpbb/db/migration/tool/config.php +++ b/phpBB/phpbb/db/migration/tool/config.php @@ -161,5 +161,7 @@ class config implements \phpbb\db\migration\tool\tool_interface { return call_user_func_array(array(&$this, $call), $arguments); } + + return null; } } diff --git a/phpBB/phpbb/db/migration/tool/config_text.php b/phpBB/phpbb/db/migration/tool/config_text.php index eb3d5b3385..6080619dfa 100644 --- a/phpBB/phpbb/db/migration/tool/config_text.php +++ b/phpBB/phpbb/db/migration/tool/config_text.php @@ -126,5 +126,7 @@ class config_text implements \phpbb\db\migration\tool\tool_interface { return call_user_func_array(array(&$this, $call), $arguments); } + + return null; } } diff --git a/phpBB/phpbb/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php index 7c8f80444e..407945e6db 100644 --- a/phpBB/phpbb/db/migration/tool/module.php +++ b/phpBB/phpbb/db/migration/tool/module.php @@ -339,7 +339,7 @@ class module implements \phpbb\db\migration\tool\tool_interface * Use false to ignore the parent check and check class wide. * @param int|string $module The module id|module_langname * specify that here - * @return null + * @return void * @throws \phpbb\db\migration\exception */ public function remove($class, $parent = 0, $module = '') @@ -350,7 +350,8 @@ class module implements \phpbb\db\migration\tool\tool_interface if (isset($module['module_langname'])) { // Manual Method - return $this->remove($class, $parent, $module['module_langname']); + $this->remove($class, $parent, $module['module_langname']); + return; } // Failed. @@ -443,6 +444,8 @@ class module implements \phpbb\db\migration\tool\tool_interface { return call_user_func_array(array(&$this, $call), $arguments); } + + return null; } /** @@ -470,7 +473,7 @@ class module implements \phpbb\db\migration\tool\tool_interface * key - module_id * value - module_langname * - * @return null + * @return void */ protected function get_categories_list() { diff --git a/phpBB/phpbb/db/migration/tool/permission.php b/phpBB/phpbb/db/migration/tool/permission.php index ca070982bf..80d64b403a 100644 --- a/phpBB/phpbb/db/migration/tool/permission.php +++ b/phpBB/phpbb/db/migration/tool/permission.php @@ -411,7 +411,7 @@ class permission implements \phpbb\db\migration\tool\tool_interface * @param string $type The type (role|group) * @param bool $has_permission True if you want to give them permission, * false if you want to deny them permission - * @return null + * @return void * @throws \phpbb\db\migration\exception */ public function permission_set($name, $auth_option, $type = 'role', $has_permission = true) @@ -506,7 +506,8 @@ class permission implements \phpbb\db\migration\tool\tool_interface if (count($auth_option)) { - return $this->permission_set($role_name, $auth_option, 'role', $has_permission); + $this->permission_set($role_name, $auth_option, 'role', $has_permission); + return; } } @@ -570,7 +571,7 @@ class permission implements \phpbb\db\migration\tool\tool_interface * @param string|array $auth_option The auth_option or array of * auth_options you would like to set * @param string $type The type (role|group) - * @return null + * @return void * @throws \phpbb\db\migration\exception */ public function permission_unset($name, $auth_option, $type = 'role') @@ -643,7 +644,8 @@ class permission implements \phpbb\db\migration\tool\tool_interface throw new \phpbb\db\migration\exception('ROLE_ASSIGNED_NOT_EXIST', $name, $role_id); } - return $this->permission_unset($role_name, $auth_option, 'role'); + $this->permission_unset($role_name, $auth_option, 'role'); + return; } $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . ' diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php index 681dfbd735..60673ea9bc 100644 --- a/phpBB/phpbb/db/migrator.php +++ b/phpBB/phpbb/db/migrator.php @@ -15,6 +15,7 @@ namespace phpbb\db; use phpbb\config\config; use phpbb\db\driver\driver_interface; +use phpbb\db\migration\exception; use phpbb\db\migration\helper; use phpbb\db\output_handler\migrator_output_handler_interface; use phpbb\db\output_handler\null_migrator_output_handler; @@ -157,7 +158,7 @@ class migrator /** * Loads all migrations and their application state from the database. * - * @return null + * @return void */ public function load_migration_state() { @@ -203,7 +204,7 @@ class migrator * Sets the list of available migration class names to the given array. * * @param array $class_names An array of migration class names - * @return null + * @return void */ public function set_migrations($class_names) { @@ -256,7 +257,7 @@ class migrator * The update step can either be a schema or a (partial) data update. To * check if update() needs to be called again use the finished() method. * - * @return null + * @return void */ public function update() { @@ -329,7 +330,7 @@ class migrator * * @param string $name The class name of the migration * @return bool Whether any update step was successfully run - * @throws \phpbb\db\migration\exception + * @throws exception */ protected function try_apply($name) { @@ -365,7 +366,7 @@ class migrator $missing = $this->unfulfillable($depend); if ($missing !== false) { - throw new \phpbb\db\migration\exception('MIGRATION_NOT_FULFILLABLE', $name, $missing); + throw new exception('MIGRATION_NOT_FULFILLABLE', $name, $missing); } if (!isset($this->migration_state[$depend]) || @@ -480,7 +481,7 @@ class migrator $this->output_handler->write(array('MIGRATION_DATA_IN_PROGRESS', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_VERY_VERBOSE); } } - catch (\phpbb\db\migration\exception $e) + catch (exception $e) { // Reset data state and revert the schema changes $state['migration_data_state'] = ''; @@ -653,7 +654,7 @@ class migrator * @param bool $revert true to revert a data step * @return bool|array migration state. True if completed, serialized array if not finished * @psalm-return bool|array{result: mixed, step: int} - * @throws \phpbb\db\migration\exception + * @throws exception */ protected function process_data_step($steps, $state, $revert = false) { @@ -693,7 +694,7 @@ class migrator ); } } - catch (\phpbb\db\migration\exception $e) + catch (exception $e) { // We should try rolling back here foreach ($steps as $reverse_step_identifier => $reverse_step) @@ -715,15 +716,16 @@ class migrator } /** - * Run a single step - * - * An exception should be thrown if an error occurs - * - * @param mixed $step Data step from migration - * @param mixed $last_result Result to pass to the callable (only for 'custom' method) - * @param bool $reverse False to install, True to attempt uninstallation by reversing the call - * @return null - */ + * Run a single step + * + * An exception should be thrown if an error occurs + * + * @param mixed $step Data step from migration + * @param mixed $last_result Result to pass to the callable (only for 'custom' method) + * @param bool $reverse False to install, True to attempt uninstallation by reversing the call + * @return mixed + * @throws exception + */ protected function run_step($step, $last_result = 0, $reverse = false) { $callable_and_parameters = $this->get_callable_from_step($step, $last_result, $reverse); @@ -747,7 +749,7 @@ class migrator * @param bool $reverse False to install, True to attempt uninstallation by reversing the call * @return array|false Array with parameters for call_user_func_array(), 0 is the callable, 1 is parameters; * false if no callable can be created from data setp - * @throws \phpbb\db\migration\exception + * @throws exception */ protected function get_callable_from_step(array $step, $last_result = 0, $reverse = false) { @@ -769,12 +771,12 @@ class migrator case 'if': if (!isset($parameters[0])) { - throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_MISSING_CONDITION', $step); + throw new exception('MIGRATION_INVALID_DATA_MISSING_CONDITION', $step); } if (!isset($parameters[1])) { - throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_MISSING_STEP', $step); + throw new exception('MIGRATION_INVALID_DATA_MISSING_STEP', $step); } if ($reverse) @@ -799,7 +801,7 @@ class migrator case 'custom': if (!is_callable($parameters[0])) { - throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_CUSTOM_NOT_CALLABLE', $step); + throw new exception('MIGRATION_INVALID_DATA_CUSTOM_NOT_CALLABLE', $step); } if ($reverse) @@ -818,17 +820,17 @@ class migrator default: if (!$method) { - throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_UNKNOWN_TYPE', $step); + throw new exception('MIGRATION_INVALID_DATA_UNKNOWN_TYPE', $step); } if (!isset($this->tools[$class])) { - throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_UNDEFINED_TOOL', $step); + throw new exception('MIGRATION_INVALID_DATA_UNDEFINED_TOOL', $step); } if (!method_exists(get_class($this->tools[$class]), $method)) { - throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_UNDEFINED_METHOD', $step); + throw new exception('MIGRATION_INVALID_DATA_UNDEFINED_METHOD', $step); } // Attempt to reverse operations @@ -855,7 +857,7 @@ class migrator * * @param string $name Name of the migration * @param array $state - * @return null + * @return void */ protected function set_migration_state($name, $state) { @@ -993,7 +995,7 @@ class migrator * THIS WILL THROW ERRORS IF MIGRATIONS ALREADY EXIST IN THE TABLE, DO NOT CALL MORE THAN ONCE! * * @param array $migrations Array of migrations (names) to add to the migrations table - * @return null + * @return void */ public function populate_migrations($migrations) { @@ -1016,7 +1018,7 @@ class migrator /** * Creates the migrations table if it does not exist. - * @return null + * @return void */ public function create_migrations_table() { diff --git a/phpBB/phpbb/di/container_builder.php b/phpBB/phpbb/di/container_builder.php index b9dc8bba63..33852ba08c 100644 --- a/phpBB/phpbb/di/container_builder.php +++ b/phpBB/phpbb/di/container_builder.php @@ -143,6 +143,7 @@ class container_builder * Build and return a new Container respecting the current configuration * * @return \phpbb_cache_container|ContainerBuilder + * @throws \Exception */ public function get_container() { diff --git a/phpBB/phpbb/event/md_exporter.php b/phpBB/phpbb/event/md_exporter.php index 84e04133de..fcc5b78afc 100644 --- a/phpBB/phpbb/event/md_exporter.php +++ b/phpBB/phpbb/event/md_exporter.php @@ -429,7 +429,7 @@ class md_exporter * Validates a template event name * * @param $event_name - * @return null + * @return void * @throws \LogicException */ public function validate_event_name($event_name) diff --git a/phpBB/phpbb/event/php_exporter.php b/phpBB/phpbb/event/php_exporter.php index ba8ffbbe36..2dfb877fa6 100644 --- a/phpBB/phpbb/event/php_exporter.php +++ b/phpBB/phpbb/event/php_exporter.php @@ -84,7 +84,7 @@ class php_exporter * * @param string $name Name of the current event (used for error messages) * @param int $line Line where the current event is placed in - * @return null + * @return void */ public function set_current_event($name, $line) { @@ -96,7 +96,7 @@ class php_exporter * Set the content of this file * * @param array $content Array with the lines of the file - * @return null + * @return void */ public function set_content($content) { @@ -790,7 +790,7 @@ class php_exporter * * @param array $vars_array Variables found in the array line * @param array $vars_docblock Variables found in the doc block - * @return null + * @return void * @throws \LogicException */ public function validate_vars_docblock_array($vars_array, $vars_docblock) diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php index 27257239f6..24dfeb75b4 100644 --- a/phpBB/phpbb/extension/manager.php +++ b/phpBB/phpbb/extension/manager.php @@ -254,7 +254,7 @@ class manager * so never call this in a script that has a max_execution time. * * @param string $name The extension's name - * @return null + * @return void */ public function enable($name) { @@ -302,7 +302,7 @@ class manager * while so never call this in a script that has a max_execution time. * * @param string $name The extension's name - * @return null + * @return void */ public function disable($name) { @@ -357,7 +357,7 @@ class manager * so never call this in a script that has a max_execution time. * * @param string $name The extension's name - * @return null + * @return void */ public function purge($name) { diff --git a/phpBB/phpbb/file_downloader.php b/phpBB/phpbb/file_downloader.php index 75721b0f05..873bccc9e8 100644 --- a/phpBB/phpbb/file_downloader.php +++ b/phpBB/phpbb/file_downloader.php @@ -30,7 +30,7 @@ class file_downloader * @param int $port Port to connect to; default: 80 * @param int $timeout Connection timeout in seconds; default: 6 * - * @return mixed File data as string if file can be read and there is no + * @return false|string File data as string if file can be read and there is no * timeout, false if there were errors or the connection timed out * * @throws \phpbb\exception\runtime_exception If data can't be retrieved and no error diff --git a/phpBB/phpbb/groupposition/legend.php b/phpBB/phpbb/groupposition/legend.php index fb4ea44af6..fd20896473 100644 --- a/phpBB/phpbb/groupposition/legend.php +++ b/phpBB/phpbb/groupposition/legend.php @@ -110,12 +110,13 @@ class legend implements \phpbb\groupposition\groupposition_interface } /** - * Deletes a group by setting the field to self::GROUP_DISABLED and closing the gap in the list. - * - * @param int $group_id group_id of the group to be deleted - * @param bool $skip_group Skip setting the value for this group, to save the query, when you need to update it anyway. - * @return bool True if the group was deleted successfully - */ + * Deletes a group by setting the field to self::GROUP_DISABLED and closing the gap in the list. + * + * @param int $group_id group_id of the group to be deleted + * @param bool $skip_group Skip setting the value for this group, to save the query, when you need to update it anyway. + * @return bool True if the group was deleted successfully + * @throws exception + */ public function delete_group($group_id, $skip_group = false) { $current_value = $this->get_group_value($group_id); diff --git a/phpBB/phpbb/install/console/command/install/config/show.php b/phpBB/phpbb/install/console/command/install/config/show.php index 7daede1b04..138f74e74f 100644 --- a/phpBB/phpbb/install/console/command/install/config/show.php +++ b/phpBB/phpbb/install/console/command/install/config/show.php @@ -96,7 +96,7 @@ class show extends \phpbb\console\command\command try { - $config = Yaml::parse(file_get_contents($config_file), true, false); + $config = Yaml::parse(file_get_contents($config_file), true); } catch (ParseException $e) { @@ -119,7 +119,7 @@ class show extends \phpbb\console\command\command return Command::FAILURE; } - $style->block(Yaml::dump(array('installer' => $config), 10, 4, true, false)); + $style->block(Yaml::dump(array('installer' => $config), 10, 4, true)); return Command::SUCCESS; } diff --git a/phpBB/phpbb/install/console/command/install/config/validate.php b/phpBB/phpbb/install/console/command/install/config/validate.php index eb638ad387..2682756c13 100644 --- a/phpBB/phpbb/install/console/command/install/config/validate.php +++ b/phpBB/phpbb/install/console/command/install/config/validate.php @@ -96,7 +96,7 @@ class validate extends \phpbb\console\command\command try { - $config = Yaml::parse(file_get_contents($config_file), true, false); + $config = Yaml::parse(file_get_contents($config_file), true); } catch (ParseException $e) { diff --git a/phpBB/phpbb/install/console/command/install/install.php b/phpBB/phpbb/install/console/command/install/install.php index 1ad4ea8114..84c8aa688a 100644 --- a/phpBB/phpbb/install/console/command/install/install.php +++ b/phpBB/phpbb/install/console/command/install/install.php @@ -16,6 +16,7 @@ namespace phpbb\install\console\command\install; use phpbb\install\exception\installer_exception; use phpbb\install\helper\install_helper; use phpbb\install\helper\iohandler\cli_iohandler; +use phpbb\install\helper\iohandler\exception\iohandler_not_implemented_exception; use phpbb\install\helper\iohandler\factory; use phpbb\install\installer; use phpbb\install\installer_configuration; @@ -90,10 +91,11 @@ class install extends \phpbb\console\command\command * * Install the board * - * @param InputInterface $input An InputInterface instance + * @param InputInterface $input An InputInterface instance * @param OutputInterface $output An OutputInterface instance * * @return int 0 if everything went fine, or a non-zero exit code + * @throws iohandler_not_implemented_exception */ protected function execute(InputInterface $input, OutputInterface $output) { @@ -124,7 +126,7 @@ class install extends \phpbb\console\command\command try { - $config = Yaml::parse(file_get_contents($config_file), true, false); + $config = Yaml::parse(file_get_contents($config_file), true); } catch (ParseException $e) { diff --git a/phpBB/phpbb/install/console/command/update/config/show.php b/phpBB/phpbb/install/console/command/update/config/show.php index df7a69ed31..85f90e14aa 100644 --- a/phpBB/phpbb/install/console/command/update/config/show.php +++ b/phpBB/phpbb/install/console/command/update/config/show.php @@ -96,7 +96,7 @@ class show extends \phpbb\console\command\command try { - $config = Yaml::parse(file_get_contents($config_file), true, false); + $config = Yaml::parse(file_get_contents($config_file), true); } catch (ParseException $e) { @@ -119,7 +119,7 @@ class show extends \phpbb\console\command\command return Command::FAILURE; } - $style->block(Yaml::dump(array('updater' => $config), 10, 4, true, false)); + $style->block(Yaml::dump(array('updater' => $config), 10, 4, true)); return Command::SUCCESS; } diff --git a/phpBB/phpbb/install/console/command/update/config/validate.php b/phpBB/phpbb/install/console/command/update/config/validate.php index eb1a48546f..69fba0f7a8 100644 --- a/phpBB/phpbb/install/console/command/update/config/validate.php +++ b/phpBB/phpbb/install/console/command/update/config/validate.php @@ -96,7 +96,7 @@ class validate extends \phpbb\console\command\command try { - $config = Yaml::parse(file_get_contents($config_file), true, false); + $config = Yaml::parse(file_get_contents($config_file), true); } catch (ParseException $e) { diff --git a/phpBB/phpbb/install/console/command/update/update.php b/phpBB/phpbb/install/console/command/update/update.php index f3320d358b..3c70231c20 100644 --- a/phpBB/phpbb/install/console/command/update/update.php +++ b/phpBB/phpbb/install/console/command/update/update.php @@ -124,7 +124,7 @@ class update extends \phpbb\console\command\command try { - $config = Yaml::parse(file_get_contents($config_file), true, false); + $config = Yaml::parse(file_get_contents($config_file), true); } catch (ParseException $e) { diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php index 47acc2953f..df6da1e3db 100644 --- a/phpBB/phpbb/install/controller/install.php +++ b/phpBB/phpbb/install/controller/install.php @@ -99,6 +99,7 @@ class install * @return Response|StreamedResponse * * @throws http_exception When phpBB is already installed + * @throws \phpbb\install\helper\iohandler\exception\iohandler_not_implemented_exception * @psalm-suppress InvalidNullableReturnType */ public function handle() diff --git a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php index b150d7098e..62ef42108d 100644 --- a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php +++ b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php @@ -94,9 +94,9 @@ class ajax_iohandler extends iohandler_base * @param \phpbb\request\request_interface $request HTTP request interface * @param \phpbb\template\template $template Template engine * @param router $router Router - * @param string $root_path Path to phpBB's root + * @param string $root_path Path to phpBB's root */ - public function __construct(path_helper $path_helper, \phpbb\request\request_interface $request, \phpbb\template\template $template, router $router, $root_path) + public function __construct(path_helper $path_helper, \phpbb\request\request_interface $request, \phpbb\template\template $template, router $router, string $root_path) { $this->path_helper = $path_helper; $this->request = $request; diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php index 385251eaab..054e8bdda8 100644 --- a/phpBB/phpbb/log/log.php +++ b/phpBB/phpbb/log/log.php @@ -129,7 +129,7 @@ class log implements \phpbb\log\log_interface * in get_logs() * * @param bool $is_in_admin Are we called from within the acp? - * @return null + * @return void */ public function set_is_admin($is_in_admin) { @@ -150,7 +150,7 @@ class log implements \phpbb\log\log_interface * Set table name * * @param string $log_table Can overwrite the table to use for the logs - * @return null + * @return void */ public function set_log_table($log_table) { diff --git a/phpBB/phpbb/message/message.php b/phpBB/phpbb/message/message.php index 53821d5412..d77f56c73f 100644 --- a/phpBB/phpbb/message/message.php +++ b/phpBB/phpbb/message/message.php @@ -65,7 +65,7 @@ class message * Set the subject of the email * * @param string $subject - * @return null + * @return void */ public function set_subject($subject) { @@ -76,7 +76,7 @@ class message * Set the body of the email text * * @param string $body - * @return null + * @return void */ public function set_body($body) { @@ -87,7 +87,7 @@ class message * Set the name of the email template to use * * @param string $template - * @return null + * @return void */ public function set_template($template) { @@ -98,7 +98,7 @@ class message * Set the array with the "template" data for the email * * @param array $template_vars - * @return null + * @return void */ public function set_template_vars($template_vars) { @@ -109,7 +109,7 @@ class message * Add a recipient from \phpbb\user * * @param array $user - * @return null + * @return void */ public function add_recipient_from_user_row(array $user) { @@ -132,7 +132,7 @@ class message * @param int $recipient_notify_type Used notification methods (Jabber, Email, ...) * @param string $recipient_username User Name (used for AntiAbuse header) * @param string $recipient_jabber - * @return null + * @return void */ public function add_recipient($recipient_name, $recipient_address, $recipient_lang, $recipient_notify_type = NOTIFY_EMAIL, $recipient_username = '', $recipient_jabber = '') { @@ -151,7 +151,7 @@ class message * Set the senders data from \phpbb\user object * * @param \phpbb\user $user - * @return null + * @return void */ public function set_sender_from_user($user) { @@ -178,7 +178,7 @@ class message * @param int $sender_id User ID * @param string $sender_username User Name (used for AntiAbuse header) * @param string $sender_jabber - * @return null + * @return void */ public function set_sender($sender_ip, $sender_name, $sender_address, $sender_lang = '', $sender_id = 0, $sender_username = '', $sender_jabber = '') { @@ -195,7 +195,7 @@ class message * Which notification type should be used? Jabber, Email, ...? * * @param int $sender_notify_type - * @return null + * @return void */ public function set_sender_notify_type($sender_notify_type) { @@ -205,7 +205,7 @@ class message /** * Ok, now the same email if CC specified, but without exposing the user's email address * - * @return null + * @return void */ public function cc_sender() { diff --git a/phpBB/phpbb/notification/method/email.php b/phpBB/phpbb/notification/method/email.php index ce81c58185..cffd259c0e 100644 --- a/phpBB/phpbb/notification/method/email.php +++ b/phpBB/phpbb/notification/method/email.php @@ -117,7 +117,7 @@ class email extends \phpbb\notification\method\messenger_base $insert_buffer->flush(); - return $this->notify_using_messenger(NOTIFY_EMAIL); + $this->notify_using_messenger(NOTIFY_EMAIL); } /** diff --git a/phpBB/phpbb/notification/type/admin_activate_user.php b/phpBB/phpbb/notification/type/admin_activate_user.php index 1d8d5717f4..99a758c116 100644 --- a/phpBB/phpbb/notification/type/admin_activate_user.php +++ b/phpBB/phpbb/notification/type/admin_activate_user.php @@ -29,8 +29,10 @@ class admin_activate_user extends \phpbb\notification\type\base } /** - * {@inheritdoc} - */ + * Language key used to output the text + * + * @var string + */ protected $language_key = 'NOTIFICATION_ADMIN_ACTIVATE_USER'; /** diff --git a/phpBB/phpbb/notification/type/approve_post.php b/phpBB/phpbb/notification/type/approve_post.php index 98b04cc7cc..7c242b75da 100644 --- a/phpBB/phpbb/notification/type/approve_post.php +++ b/phpBB/phpbb/notification/type/approve_post.php @@ -128,9 +128,7 @@ class approve_post extends \phpbb\notification\type\post } /** - * Get email template - * - * @return string|bool + * {@inheritdoc} */ public function get_email_template() { diff --git a/phpBB/phpbb/notification/type/approve_topic.php b/phpBB/phpbb/notification/type/approve_topic.php index d072ff330a..c28d94e3f5 100644 --- a/phpBB/phpbb/notification/type/approve_topic.php +++ b/phpBB/phpbb/notification/type/approve_topic.php @@ -127,9 +127,7 @@ class approve_topic extends \phpbb\notification\type\topic } /** - * Get email template - * - * @return string|bool + * {@inheritdoc} */ public function get_email_template() { diff --git a/phpBB/phpbb/notification/type/base.php b/phpBB/phpbb/notification/type/base.php index 7c77154fe7..54a9319d26 100644 --- a/phpBB/phpbb/notification/type/base.php +++ b/phpBB/phpbb/notification/type/base.php @@ -129,7 +129,7 @@ abstract class base implements \phpbb\notification\type\type_interface */ public function __get($name) { - return (!isset($this->data[$name])) ? null : $this->data[$name]; + return $this->data[$name] ?? null; } @@ -139,13 +139,24 @@ abstract class base implements \phpbb\notification\type\type_interface * @param mixed $name * @param mixed $value * - * @return null + * @return void */ public function __set($name, $value) { $this->data[$name] = $value; } + /** + * Magic method check if a variable is defined and is not null + * + * @param mixed $name + * + * @return bool + */ + public function __isset($name) + { + return isset($this->data[$name]); + } /** * Magic method to get a string of this notification @@ -394,7 +405,6 @@ abstract class base implements \phpbb\notification\type\type_interface */ public function load_special($data, $notifications) { - return; } /** @@ -407,6 +417,14 @@ abstract class base implements \phpbb\notification\type\type_interface return true; } + /** + * {@inheritdoc} + */ + public function get_email_template() + { + return false; + } + /** * Pre create insert array function (fall back) * diff --git a/phpBB/phpbb/notification/type/bookmark.php b/phpBB/phpbb/notification/type/bookmark.php index 487e3a7543..98a759c300 100644 --- a/phpBB/phpbb/notification/type/bookmark.php +++ b/phpBB/phpbb/notification/type/bookmark.php @@ -57,13 +57,14 @@ class bookmark extends \phpbb\notification\type\post } /** - * Find the users who want to receive notifications - * - * @param array $type_data Data from submit_post - * @param array $options Options for finding users for notification - * - * @return array - */ + * Find the users who want to receive notifications + * + * @param array $type_data Data from submit_post + * @param array $options Options for finding users for notification + * + * @return array + * @throws \Exception + */ public function find_users_for_notification($type_data, $options = array()) { $options = array_merge(array( @@ -117,9 +118,7 @@ class bookmark extends \phpbb\notification\type\post } /** - * Get email template - * - * @return string|bool + * {@inheritdoc} */ public function get_email_template() { diff --git a/phpBB/phpbb/notification/type/disapprove_post.php b/phpBB/phpbb/notification/type/disapprove_post.php index a92a69cf03..b7805dd0ec 100644 --- a/phpBB/phpbb/notification/type/disapprove_post.php +++ b/phpBB/phpbb/notification/type/disapprove_post.php @@ -148,9 +148,7 @@ class disapprove_post extends \phpbb\notification\type\approve_post } /** - * Get email template - * - * @return string|bool + * {@inheritdoc} */ public function get_email_template() { diff --git a/phpBB/phpbb/notification/type/disapprove_topic.php b/phpBB/phpbb/notification/type/disapprove_topic.php index d5e9b64804..5b9d03d238 100644 --- a/phpBB/phpbb/notification/type/disapprove_topic.php +++ b/phpBB/phpbb/notification/type/disapprove_topic.php @@ -148,9 +148,7 @@ class disapprove_topic extends \phpbb\notification\type\approve_topic } /** - * Get email template - * - * @return string|bool + * {@inheritdoc} */ public function get_email_template() { diff --git a/phpBB/phpbb/notification/type/forum.php b/phpBB/phpbb/notification/type/forum.php index 2d196f013f..181316e922 100644 --- a/phpBB/phpbb/notification/type/forum.php +++ b/phpBB/phpbb/notification/type/forum.php @@ -104,9 +104,7 @@ class forum extends \phpbb\notification\type\post } /** - * Get email template - * - * @return string|bool + * {@inheritdoc} */ public function get_email_template() { diff --git a/phpBB/phpbb/notification/type/pm.php b/phpBB/phpbb/notification/type/pm.php index 8dffbc1bf4..276d1984fb 100644 --- a/phpBB/phpbb/notification/type/pm.php +++ b/phpBB/phpbb/notification/type/pm.php @@ -145,9 +145,7 @@ class pm extends \phpbb\notification\type\base } /** - * Get email template - * - * @return string|bool + * {@inheritdoc} */ public function get_email_template() { diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index 022e184110..be8c8d75e9 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -238,9 +238,7 @@ class post extends \phpbb\notification\type\base } /** - * Get email template - * - * @return string|bool + * {@inheritdoc} */ public function get_email_template() { diff --git a/phpBB/phpbb/notification/type/post_in_queue.php b/phpBB/phpbb/notification/type/post_in_queue.php index a02dd9684e..3d818a1b27 100644 --- a/phpBB/phpbb/notification/type/post_in_queue.php +++ b/phpBB/phpbb/notification/type/post_in_queue.php @@ -152,9 +152,7 @@ class post_in_queue extends \phpbb\notification\type\post } /** - * Get email template - * - * @return string|bool + * {@inheritdoc} */ public function get_email_template() { diff --git a/phpBB/phpbb/notification/type/quote.php b/phpBB/phpbb/notification/type/quote.php index f8fd8e4d81..98224917e9 100644 --- a/phpBB/phpbb/notification/type/quote.php +++ b/phpBB/phpbb/notification/type/quote.php @@ -149,9 +149,7 @@ class quote extends \phpbb\notification\type\post } /** - * Get email template - * - * @return string|bool + * {@inheritdoc} */ public function get_email_template() { diff --git a/phpBB/phpbb/notification/type/report_pm.php b/phpBB/phpbb/notification/type/report_pm.php index c8a1ccae69..f542eccf20 100644 --- a/phpBB/phpbb/notification/type/report_pm.php +++ b/phpBB/phpbb/notification/type/report_pm.php @@ -125,9 +125,7 @@ class report_pm extends \phpbb\notification\type\pm } /** - * Get email template - * - * @return string|bool + * {@inheritdoc} */ public function get_email_template() { diff --git a/phpBB/phpbb/notification/type/report_pm_closed.php b/phpBB/phpbb/notification/type/report_pm_closed.php index 083baeece8..06186a868c 100644 --- a/phpBB/phpbb/notification/type/report_pm_closed.php +++ b/phpBB/phpbb/notification/type/report_pm_closed.php @@ -84,9 +84,7 @@ class report_pm_closed extends \phpbb\notification\type\pm } /** - * Get email template - * - * @return string|bool + * {@inheritdoc} */ public function get_email_template() { diff --git a/phpBB/phpbb/notification/type/report_post.php b/phpBB/phpbb/notification/type/report_post.php index 730a6a12f4..1aeac139eb 100644 --- a/phpBB/phpbb/notification/type/report_post.php +++ b/phpBB/phpbb/notification/type/report_post.php @@ -91,9 +91,7 @@ class report_post extends \phpbb\notification\type\post_in_queue } /** - * Get email template - * - * @return string|bool + * {@inheritdoc} */ public function get_email_template() { diff --git a/phpBB/phpbb/notification/type/report_post_closed.php b/phpBB/phpbb/notification/type/report_post_closed.php index 9e05e4c9cd..e71901a61c 100644 --- a/phpBB/phpbb/notification/type/report_post_closed.php +++ b/phpBB/phpbb/notification/type/report_post_closed.php @@ -91,9 +91,7 @@ class report_post_closed extends \phpbb\notification\type\post } /** - * Get email template - * - * @return string|bool + * {@inheritdoc} */ public function get_email_template() { diff --git a/phpBB/phpbb/notification/type/topic.php b/phpBB/phpbb/notification/type/topic.php index 715e0d47ed..7ecb5e6e85 100644 --- a/phpBB/phpbb/notification/type/topic.php +++ b/phpBB/phpbb/notification/type/topic.php @@ -191,9 +191,7 @@ class topic extends \phpbb\notification\type\base } /** - * Get email template - * - * @return string|bool + * {@inheritdoc} */ public function get_email_template() { diff --git a/phpBB/phpbb/notification/type/topic_in_queue.php b/phpBB/phpbb/notification/type/topic_in_queue.php index 523b8eb5a3..bfdec5278b 100644 --- a/phpBB/phpbb/notification/type/topic_in_queue.php +++ b/phpBB/phpbb/notification/type/topic_in_queue.php @@ -144,9 +144,7 @@ class topic_in_queue extends \phpbb\notification\type\topic } /** - * Get email template - * - * @return string|bool + * {@inheritdoc} */ public function get_email_template() { diff --git a/phpBB/phpbb/plupload/plupload.php b/phpBB/phpbb/plupload/plupload.php index ed749fdbe0..aeb1bd87d2 100644 --- a/phpBB/phpbb/plupload/plupload.php +++ b/phpBB/phpbb/plupload/plupload.php @@ -100,7 +100,7 @@ class plupload // and handle the file as usual if ($chunks_expected < 2) { - return; + return null; } $file_name = $this->request->variable('name', ''); @@ -150,7 +150,7 @@ class plupload * @param int $forum_id The ID of the forum * @param int $max_files Maximum number of files allowed. 0 for unlimited. * - * @return null + * @return void */ public function configure(\phpbb\cache\service $cache, \phpbb\template\template $template, $s_action, $forum_id, $max_files) { @@ -200,7 +200,7 @@ class plupload * @param int $code The error code * @param string $msg The translation string of the message to be sent * - * @return null + * @return void */ public function emit_error($code, $msg) { @@ -331,7 +331,7 @@ class plupload * @param int $chunk Chunk number * @param string $file_path File path * - * @return null + * @return void */ protected function integrate_uploaded_file($form_name, $chunk, $file_path) { @@ -378,7 +378,7 @@ class plupload /** * Creates the temporary directory if it does not already exist. * - * @return null + * @return void */ protected function prepare_temporary_directory() { @@ -396,7 +396,7 @@ class plupload /** * Sets the default directories for uploads * - * @return null + * @return void */ protected function set_default_directories() { @@ -410,7 +410,7 @@ class plupload * @param string $upload_directory Upload directory * @param string $temporary_directory Temporary directory * - * @return null + * @return void */ public function set_upload_directories($upload_directory, $temporary_directory) { diff --git a/phpBB/phpbb/profilefields/type/type_base.php b/phpBB/phpbb/profilefields/type/type_base.php index 8fe4b38c46..80a535cb1f 100644 --- a/phpBB/phpbb/profilefields/type/type_base.php +++ b/phpBB/phpbb/profilefields/type/type_base.php @@ -179,7 +179,6 @@ abstract class type_base implements type_interface */ public function display_options(&$template_vars, &$field_data) { - return; } /** diff --git a/phpBB/phpbb/report/controller/report.php b/phpBB/phpbb/report/controller/report.php index 026f450d85..1af565e6a0 100644 --- a/phpBB/phpbb/report/controller/report.php +++ b/phpBB/phpbb/report/controller/report.php @@ -258,7 +258,7 @@ class report * @param array $error * @param string $s_hidden_fields * @param mixed $captcha - * @return null + * @return void */ protected function assign_template_data($mode, $id, $reason_id, $report_text, $user_notify, $error = array(), $s_hidden_fields = '', $captcha = false) { diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index d311f3758e..0d401c86e1 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -1068,8 +1068,6 @@ class session * @since 3.1.6-RC1 */ $phpbb_dispatcher->trigger_event('core.session_gc_after'); - - return; } /** @@ -1143,7 +1141,7 @@ class session if (defined('IN_CHECK_BAN') || defined('SKIP_CHECK_BAN')) { - return; + return false; } $banned = false; diff --git a/phpBB/phpbb/storage/controller/attachment.php b/phpBB/phpbb/storage/controller/attachment.php index 11d254f24a..08cd012290 100644 --- a/phpBB/phpbb/storage/controller/attachment.php +++ b/phpBB/phpbb/storage/controller/attachment.php @@ -289,7 +289,7 @@ class attachment extends controller */ protected function filenameFallback($filename) { - $filename = preg_replace(['/[^\x20-\x7e]/', '/%/', '/\//', '/\\\/'], '', $filename); + $filename = preg_replace(['/[^\x20-\x7e]/', '/%/', '/\//', '/\\\\/'], '', $filename); return (!empty($filename)) ?: 'File'; } diff --git a/phpBB/phpbb/template/twig/tokenparser/defineparser.php b/phpBB/phpbb/template/twig/tokenparser/defineparser.php index 14b885a902..ce394c0896 100644 --- a/phpBB/phpbb/template/twig/tokenparser/defineparser.php +++ b/phpBB/phpbb/template/twig/tokenparser/defineparser.php @@ -21,9 +21,8 @@ class defineparser extends \Twig\TokenParser\AbstractTokenParser * * @param \Twig\Token $token A Twig\Token instance * - * @return \Twig\Node\Node A Twig\Node instance * @throws \Twig\Error\SyntaxError - * @return \phpbb\template\twig\node\definenode + * @return \Twig\Node\Node A Twig\Node instance */ public function parse(\Twig\Token $token) { diff --git a/phpBB/phpbb/textformatter/s9e/renderer.php b/phpBB/phpbb/textformatter/s9e/renderer.php index 855e034b14..8328b65a95 100644 --- a/phpBB/phpbb/textformatter/s9e/renderer.php +++ b/phpBB/phpbb/textformatter/s9e/renderer.php @@ -148,7 +148,7 @@ class renderer implements \phpbb\textformatter\renderer_interface * * @param \phpbb\config\config $config * @param \phpbb\path_helper $path_helper - * @return null + * @return void */ public function configure_smilies_path(\phpbb\config\config $config, \phpbb\path_helper $path_helper) { diff --git a/phpBB/phpbb/textreparser/base.php b/phpBB/phpbb/textreparser/base.php index c4b344f8db..6ac30a0002 100644 --- a/phpBB/phpbb/textreparser/base.php +++ b/phpBB/phpbb/textreparser/base.php @@ -40,8 +40,11 @@ abstract class base implements reparser_interface abstract protected function get_records_by_range($min_id, $max_id); /** - * {@inheritdoc} - */ + * Save record + * + * @param array $record + * @return void + */ abstract protected function save_record(array $record); /** diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php index 2e7ab22651..52427d2915 100644 --- a/phpBB/phpbb/user.php +++ b/phpBB/phpbb/user.php @@ -470,14 +470,18 @@ class user extends \phpbb\session * @param $number int|float The number we want to get the plural case for. Float numbers are floored. * @param $force_rule mixed False to use the plural rule of the language package * or an integer to force a certain plural rule - * @return int|bool The plural-case we need to use for the number plural-rule combination, false if $force_rule + * @return int|false The plural-case we need to use for the number plural-rule combination, false if $force_rule * was invalid. * * @deprecated: 3.2.0-dev (To be removed: 4.0.0) */ function get_plural_form($number, $force_rule = false) { - return $this->language->get_plural_form($number, $force_rule); + try { + return $this->language->get_plural_form($number, $force_rule); + } catch (\phpbb\language\exception\invalid_plural_rule_exception $e) { + return false; + } } /** diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index fc24600799..9a06c06dc9 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -110,7 +110,7 @@ class phpbb_template_template_test_case extends phpbb_test_case 'autoescape' => false, ) ); - $this->template = new phpbb\template\twig\twig($path_helper, $config, $context, $twig, $cache_path, $this->user, array(new \phpbb\template\twig\extension($context, $twig, $this->user))); + $this->template = new phpbb\template\twig\twig($path_helper, $config, $context, $twig, $cache_path, $this->user, array(new \phpbb\template\twig\extension($context, $twig, $lang))); $twig->setLexer(new \phpbb\template\twig\lexer($twig)); $this->template->set_custom_style('tests', $this->template_path); } diff --git a/tests/text_formatter/s9e/factory_test.php b/tests/text_formatter/s9e/factory_test.php index 9ab32999d8..7e35c18332 100644 --- a/tests/text_formatter/s9e/factory_test.php +++ b/tests/text_formatter/s9e/factory_test.php @@ -15,6 +15,16 @@ require_once __DIR__ . '/../../test_framework/phpbb_database_test_case.php'; class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case { + /** + * @var phpbb_mock_cache + */ + private $cache; + + /** + * @var phpbb_mock_event_dispatcher + */ + private $dispatcher; + protected function setUp(): void { $this->cache = new phpbb_mock_cache;