From daa2dd280ca6139e9c50b556814ea2cd825dea64 Mon Sep 17 00:00:00 2001
From: Ruben Calvo <rubencm@gmail.com>
Date: Sun, 1 Jan 2023 22:01:52 +0100
Subject: [PATCH] [ticket/16955] Fix most return types in phpdoc

PHPBB3-16955
---
 phpBB/includes/acp/acp_attachments.php        |  4 +-
 phpBB/includes/acp/acp_extensions.php         |  8 ++--
 phpBB/includes/acp/acp_language.php           |  2 +-
 phpBB/includes/acp/acp_storage.php            |  4 +-
 phpBB/includes/bbcode.php                     |  2 +-
 phpBB/includes/diff/diff.php                  |  4 +-
 phpBB/includes/diff/renderer.php              |  2 +-
 phpBB/includes/functions.php                  | 41 ++++++++++---------
 phpBB/includes/functions_admin.php            | 10 +++--
 phpBB/includes/functions_compatibility.php    |  2 +-
 phpBB/includes/functions_database_helper.php  |  2 +-
 phpBB/includes/functions_mcp.php              |  6 +--
 phpBB/includes/functions_messenger.php        |  2 +
 phpBB/includes/functions_posting.php          |  5 ++-
 phpBB/includes/functions_user.php             |  7 +++-
 phpBB/includes/mcp/mcp_queue.php              |  6 +--
 phpBB/includes/message_parser.php             |  2 +-
 .../includes/questionnaire/questionnaire.php  |  2 +-
 .../install/convertors/functions_phpbb20.php  |  2 +-
 phpBB/install/startup.php                     |  4 +-
 .../captcha/plugins/captcha_abstract.php      |  2 +-
 phpBB/phpbb/config/db_text.php                |  8 ++--
 phpBB/phpbb/config_php_file.php               |  2 +-
 phpBB/phpbb/console/command/cron/run.php      |  2 +-
 .../console/command/extension/install.php     |  2 +-
 .../command/extension/list_available.php      |  2 +-
 .../console/command/extension/manage.php      |  2 +-
 .../console/command/extension/remove.php      |  2 +-
 .../console/command/extension/update.php      |  2 +-
 .../console/command/reparser/list_all.php     |  2 +-
 .../console/command/reparser/reparse.php      |  2 +-
 .../console/command/thumbnail/delete.php      |  2 +-
 .../console/command/thumbnail/generate.php    |  2 +-
 .../console/command/thumbnail/recreate.php    |  2 +-
 phpBB/phpbb/console/command/update/check.php  |  2 +-
 phpBB/phpbb/console/command/user/activate.php |  4 +-
 phpBB/phpbb/console/command/user/add.php      |  6 +--
 phpBB/phpbb/console/command/user/delete.php   |  2 +-
 phpBB/phpbb/console/command/user/reclean.php  |  2 +-
 phpBB/phpbb/content_visibility.php            |  6 +--
 phpBB/phpbb/controller/resolver.php           |  2 +-
 .../phpbb/cron/task/core/prune_all_forums.php |  2 +-
 phpBB/phpbb/cron/task/core/prune_forum.php    |  4 +-
 phpBB/phpbb/cron/task/core/queue.php          |  2 +-
 phpBB/phpbb/cron/task/core/tidy_cache.php     |  2 +-
 phpBB/phpbb/cron/task/core/tidy_database.php  |  2 +-
 phpBB/phpbb/cron/task/core/tidy_search.php    |  2 +-
 phpBB/phpbb/cron/task/core/tidy_sessions.php  |  2 +-
 phpBB/phpbb/cron/task/core/tidy_warnings.php  |  2 +-
 phpBB/phpbb/db/extractor/mysql_extractor.php  |  6 +--
 .../migration/profilefield_base_migration.php |  6 +--
 phpBB/phpbb/db/migration/tool/config_text.php |  2 +-
 phpBB/phpbb/db/migrator.php                   |  2 +-
 phpBB/phpbb/di/pass/collection_pass.php       |  2 +-
 .../event/kernel_exception_subscriber.php     |  2 +-
 phpBB/phpbb/extension/di/extension_base.php   |  1 +
 phpBB/phpbb/help/controller/help.php          |  2 +-
 phpBB/phpbb/message/form.php                  |  6 +--
 phpBB/phpbb/plupload/plupload.php             |  1 +
 .../report/report_reason_list_provider.php    |  2 +-
 .../default_resources_locator.php             |  6 +--
 .../search/backend/fulltext_postgres.php      |  2 +-
 phpBB/phpbb/storage/exception/exception.php   | 10 ++---
 phpBB/phpbb/template/context.php              |  4 +-
 phpBB/phpbb/template/twig/environment.php     | 10 ++---
 phpBB/phpbb/tree/nestedset.php                |  2 +-
 66 files changed, 135 insertions(+), 124 deletions(-)

diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php
index a7e10617fe..0f1fc3f6a8 100644
--- a/phpBB/includes/acp/acp_attachments.php
+++ b/phpBB/includes/acp/acp_attachments.php
@@ -1349,7 +1349,7 @@ class acp_attachments
 	* Set config attachment stat values
 	*
 	* @param $stats array	Array of config key => value pairs to set.
-	* @return null
+	* @return void
 	*/
 	public function set_attachment_stats($stats)
 	{
@@ -1392,7 +1392,7 @@ class acp_attachments
 	/**
 	* Handle stats resync.
 	*
-	* @return null
+	* @return void
 	*/
 	public function handle_stats_resync()
 	{
diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php
index 3a29d16ec6..1a30d38d61 100644
--- a/phpBB/includes/acp/acp_extensions.php
+++ b/phpBB/includes/acp/acp_extensions.php
@@ -767,7 +767,7 @@ class acp_extensions
 	 * @param \phpbb\extension\manager  $phpbb_extension_manager     An instance of the extension manager
 	 * @param array                     $managed_packages            List of managed packages
 	 *
-	 * @return null
+	 * @return void
 	 */
 	public function list_enabled_exts(\phpbb\extension\manager $phpbb_extension_manager, array $managed_packages)
 	{
@@ -850,7 +850,7 @@ class acp_extensions
 	 * @param \phpbb\extension\manager  $phpbb_extension_manager     An instance of the extension manager
 	 * @param array                     $managed_packages            List of managed packages
 	 *
-	 * @return null
+	 * @return void
 	 */
 	public function list_disabled_exts(\phpbb\extension\manager $phpbb_extension_manager, array $managed_packages)
 	{
@@ -930,7 +930,7 @@ class acp_extensions
 	 *
 	 * @param array                     $managed_packages            List of managed packages
 	 *
-	 * @return null
+	 * @return void
 	 */
 	public function list_available_exts(array $managed_packages)
 	{
@@ -1026,7 +1026,7 @@ class acp_extensions
 	* Outputs extension metadata into the template
 	*
 	* @param array $metadata Array with all metadata for the extension
-	* @return null
+	* @return void
 	*/
 	public function output_metadata_to_template($metadata)
 	{
diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php
index 81b14cc02c..4584be632f 100644
--- a/phpBB/includes/acp/acp_language.php
+++ b/phpBB/includes/acp/acp_language.php
@@ -224,7 +224,7 @@ class acp_language
 					}
 					catch (\Exception $e)
 					{
-						return array();
+						return;
 					}
 
 					foreach ($iterator as $file_info)
diff --git a/phpBB/includes/acp/acp_storage.php b/phpBB/includes/acp/acp_storage.php
index adde39baf3..3ea1036167 100644
--- a/phpBB/includes/acp/acp_storage.php
+++ b/phpBB/includes/acp/acp_storage.php
@@ -356,8 +356,8 @@ class acp_storage
 	 *
 	 * @param string $storage_name Storage name
 	 * @param array $options Storage provider configuration keys
-	 * @param array $messages Error messages array
-	 * @return array $messages Reference to messages array
+	 * @param array $messages Reference to error messages array
+	 * @return void
 	 */
 	protected function validate_path($storage_name, $options, &$messages)
 	{
diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php
index 736c680316..68621b4245 100644
--- a/phpBB/includes/bbcode.php
+++ b/phpBB/includes/bbcode.php
@@ -658,7 +658,7 @@ class bbcode
 	*
 	* Accepts variable number of parameters
 	*
-	* @return mixed Second pass result
+	* @return bool Second pass result
 	*
 	* @deprecated 3.2.10 (To be removed 4.0.0)
 	*/
diff --git a/phpBB/includes/diff/diff.php b/phpBB/includes/diff/diff.php
index 8b7d71020a..7c92d37570 100644
--- a/phpBB/includes/diff/diff.php
+++ b/phpBB/includes/diff/diff.php
@@ -544,7 +544,7 @@ class diff3 extends diff
 	* @param string $label2 the cvs file version/label from the new set of lines
 	* @param string $label_sep the explanation between label1 and label2 - more of a helper for the user
 	*
-	* @return mixed the merged output
+	* @return array the merged output
 	*/
 	function get_conflicts_content($label1 = 'CURRENT_FILE', $label2 = 'NEW_FILE', $label_sep = 'DIFF_SEP_EXPLAIN')
 	{
@@ -582,7 +582,7 @@ class diff3 extends diff
 	/**
 	* Return merged output (used by the renderer)
 	*
-	* @return mixed the merged output
+	* @return array the merged output
 	*/
 	function merged_output()
 	{
diff --git a/phpBB/includes/diff/renderer.php b/phpBB/includes/diff/renderer.php
index 0c8438ff17..4f00fccfe8 100644
--- a/phpBB/includes/diff/renderer.php
+++ b/phpBB/includes/diff/renderer.php
@@ -793,7 +793,7 @@ class diff_renderer_side_by_side extends diff_renderer
 	{
 		if ($this->state == 'empty')
 		{
-			return '';
+			return;
 		}
 
 		// This is just an addition line.
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 58c142c740..27ead08d9c 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -115,14 +115,14 @@ function phpbb_gmgetdate($time = false)
 /**
 * Return formatted string for filesizes
 *
-* @param mixed	$value			filesize in bytes
+* @param mixed		$value			filesize in bytes
 *								(non-negative number; int, float or string)
-* @param bool	$string_only	true if language string should be returned
-* @param array	$allowed_units	only allow these units (data array indexes)
+* @param bool		$string_only	true if language string should be returned
+* @param array|null $allowed_units	only allow these units (data array indexes)
 *
-* @return mixed					data array if $string_only is false
+* @return array|string                    data array if $string_only is false
 */
-function get_formatted_filesize($value, $string_only = true, $allowed_units = false)
+function get_formatted_filesize($value, bool $string_only = true, array $allowed_units = null)
 {
 	global $user;
 
@@ -161,7 +161,7 @@ function get_formatted_filesize($value, $string_only = true, $allowed_units = fa
 
 	foreach ($available_units as $si_identifier => $unit_info)
 	{
-		if (!empty($allowed_units) && $si_identifier != 'b' && !in_array($si_identifier, $allowed_units))
+		if (is_array($allowed_units) && $si_identifier != 'b' && !in_array($si_identifier, $allowed_units))
 		{
 			continue;
 		}
@@ -238,14 +238,14 @@ function still_on_time($extra_time = 15)
 *
 * See http://www.php.net/manual/en/function.version-compare.php
 *
-* @param string $version1		First version number
-* @param string $version2		Second version number
-* @param string $operator		Comparison operator (optional)
+* @param string			$version1		First version number
+* @param string			$version2		Second version number
+* @param string|null	$operator		Comparison operator (optional)
 *
-* @return mixed					Boolean (true, false) if comparison operator is specified.
-*								Integer (-1, 0, 1) otherwise.
+* @return mixed				Boolean (true, false) if comparison operator is specified.
+*							Integer (-1, 0, 1) otherwise.
 */
-function phpbb_version_compare($version1, $version2, $operator = null)
+function phpbb_version_compare(string $version1, string $version2, string $operator = null)
 {
 	$version1 = strtolower($version1);
 	$version2 = strtolower($version2);
@@ -447,7 +447,7 @@ function phpbb_get_timezone_identifiers($selected_timezone)
 * @param	string		$default			A timezone to select
 * @param	boolean		$truncate			Shall we truncate the options text
 *
-* @return		array		Returns an array containing the options for the time selector.
+* @return	string		Returns an array containing the options for the time selector.
 */
 function phpbb_timezone_select($template, $user, $default = '', $truncate = false)
 {
@@ -1908,7 +1908,7 @@ function meta_refresh($time, $url, $disable_cd_check = false)
 *
 * @param int $code HTTP status code
 * @param string $message Message for the status code
-* @return null
+* @return void
 */
 function send_status_line($code, $message)
 {
@@ -2893,8 +2893,8 @@ function short_ipv6($ip, $length)
 *
 * @param string $address	IP address
 *
-* @return mixed		false if specified address is not valid,
-*					string otherwise
+* @return string|false	false if specified address is not valid,
+*						string otherwise
 */
 function phpbb_ip_normalise(string $address)
 {
@@ -2922,8 +2922,9 @@ function phpbb_ip_normalise(string $address)
 
 /**
 * Error and message handler, call with trigger_error if read
+* @return bool true to bypass internal error handler, false otherwise
 */
-function msg_handler($errno, $msg_text, $errfile, $errline)
+function msg_handler($errno, $msg_text, $errfile, $errline): bool
 {
 	global $cache, $db, $auth, $template, $config, $user, $request;
 	global $phpbb_root_path, $msg_title, $msg_long_text, $phpbb_log;
@@ -2932,7 +2933,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
 	// Do not display notices if we suppress them via @
 	if (error_reporting() == 0 && $errno != E_USER_ERROR && $errno != E_USER_WARNING && $errno != E_USER_NOTICE)
 	{
-		return;
+		return true;
 	}
 
 	// Message handler is stripping text. In case we need it, we are possible to define long text...
@@ -2950,7 +2951,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
 			// If DEBUG is defined the default level is E_ALL
 			if (($errno & ($phpbb_container != null && $phpbb_container->getParameter('debug.show_errors') ? E_ALL : error_reporting())) == 0)
 			{
-				return;
+				return true;
 			}
 
 			if (strpos($errfile, 'cache') === false && strpos($errfile, 'template.') === false)
@@ -2968,7 +2969,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
 				// echo '<br /><br />BACKTRACE<br />' . get_backtrace() . '<br />' . "\n";
 			}
 
-			return;
+			return true;
 
 		break;
 
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 54ba46fb67..621d1a284e 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -761,6 +761,7 @@ function move_posts($post_ids, $topic_id, $auto_sync = true)
 
 /**
 * Remove topic(s)
+* @return array with topics and posts affected
 */
 function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_sync = true, $call_delete_posts = true)
 {
@@ -1202,7 +1203,7 @@ function delete_topic_shadows($forum_id, $sql_more = '', $auto_sync = true)
 	if (!$forum_id)
 	{
 		// Nothing to do.
-		return;
+		return [];
 	}
 
 	// Set of affected forums we have to resync
@@ -2325,6 +2326,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
 
 /**
 * Prune function
+* @return array with topics and posts affected
 */
 function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync = true, $prune_limit = 0)
 {
@@ -2337,7 +2339,7 @@ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync
 
 	if (!count($forum_id))
 	{
-		return;
+		return ['topics' => 0, 'posts' => 0];
 	}
 
 	$sql_and = '';
@@ -2697,7 +2699,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
 * @param \phpbb\auth\auth $auth Authentication object
 * @param array|bool $group_id If an array, remove all members of this group from foe lists, or false to ignore
 * @param array|bool $user_id If an array, remove this user from foe lists, or false to ignore
-* @return null
+* @return void
 */
 function phpbb_update_foes($db, $auth, $group_id = false, $user_id = false)
 {
@@ -3116,7 +3118,7 @@ function add_permission_language()
  * @param int		$flag			The binary flag which is OR-ed with the current column value
  * @param string	$sql_more		This string is attached to the sql query generated to update the table.
  *
- * @return null
+ * @return void
  */
 function enable_bitfield_column_flag($table_name, $column_name, $flag, $sql_more = '')
 {
diff --git a/phpBB/includes/functions_compatibility.php b/phpBB/includes/functions_compatibility.php
index dd56aa9622..5ecd8c7a37 100644
--- a/phpBB/includes/functions_compatibility.php
+++ b/phpBB/includes/functions_compatibility.php
@@ -136,7 +136,7 @@ function cache_moderators()
 * @deprecated 3.1.0 (To be removed: 4.0.0)
 * @param array|bool $group_id If an array, remove all members of this group from foe lists, or false to ignore
 * @param array|bool $user_id If an array, remove this user from foe lists, or false to ignore
-* @return null
+* @return void
 */
 function update_foes($group_id = false, $user_id = false)
 {
diff --git a/phpBB/includes/functions_database_helper.php b/phpBB/includes/functions_database_helper.php
index 8f363d56f3..268cb2f384 100644
--- a/phpBB/includes/functions_database_helper.php
+++ b/phpBB/includes/functions_database_helper.php
@@ -31,7 +31,7 @@ if (!defined('IN_PHPBB'))
 * @param string $column Column whose values to change
 * @param array $from_values An array of values that should be changed
 * @param int $to_value The new value
-* @return null
+* @return void
 */
 function phpbb_update_rows_avoiding_duplicates(\phpbb\db\driver\driver_interface $db, $table, $column, $from_values, $to_value)
 {
diff --git a/phpBB/includes/functions_mcp.php b/phpBB/includes/functions_mcp.php
index e96f193370..c09eeeaeb5 100644
--- a/phpBB/includes/functions_mcp.php
+++ b/phpBB/includes/functions_mcp.php
@@ -695,9 +695,9 @@ function phpbb_mcp_sorting($mode, &$sort_days_val, &$sort_key_val, &$sort_dir_va
 * @param	array|false	$acl_list		A list of permissions the user need to have
 * @param	mixed		$single_forum	Limit to one forum id (int) or the first forum found (true)
 *
-* @return	mixed	False if no ids were able to be retrieved, true if at least one id left.
-*					Additionally, this value can be the forum_id assigned if $single_forum was set.
-*					Therefore checking the result for with !== false is the best method.
+* @return	bool|int	False if no ids were able to be retrieved, true if at least one id left.
+*						Additionally, this value can be the forum_id assigned if $single_forum was set.
+*						Therefore checking the result for with !== false is the best method.
 */
 function phpbb_check_ids(&$ids, $table, $sql_id, $acl_list = false, $single_forum = false)
 {
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php
index 376b98f338..e5cc4ac641 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -1570,6 +1570,8 @@ class smtp_class
 			unset($response[0]);
 			$this->commands[$response_code] = implode(' ', $response);
 		}
+
+		return null;
 	}
 
 	/**
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 80f0e31e74..6e4806a93a 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -253,6 +253,7 @@ function generate_smilies($mode, $forum_id)
 * @param	string	$type				Can be forum|topic
 * @param	mixed	$ids				topic/forum ids
 * @param	bool	$return_update_sql	true: SQL query shall be returned, false: execute SQL
+* @return	array|null	SQL query, null otherwise
 */
 function update_post_information($type, $ids, $return_update_sql = false)
 {
@@ -412,7 +413,7 @@ function update_post_information($type, $ids, $return_update_sql = false)
 		$db->sql_query($sql);
 	}
 
-	return;
+	return null;
 }
 
 /**
@@ -2780,7 +2781,7 @@ function phpbb_upload_popup($forum_style = 0)
 * @param bool		$is_soft		The flag indicating whether it is the soft delete mode
 * @param string		$delete_reason	Description for the post deletion reason
 *
-* @return null
+* @return void
 */
 function phpbb_handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_soft = false, $delete_reason = '')
 {
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 905a7a8251..9cdeb7c619 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -1727,7 +1727,7 @@ function phpbb_validate_timezone($timezone)
  * @param string	$username				The username to check
  * @param string	$allowed_username		An allowed username, default being $user->data['username']
  *
- * @return mixed							Either false if validation succeeded or a string which will be
+ * @return string|false						Either false if validation succeeded or a string which will be
  *											used as the error message (with the variable name appended)
  */
 function validate_username($username, $allowed_username = false, $allow_all_names = false)
@@ -2723,7 +2723,7 @@ function group_delete($group_id, $group_name = false)
 /**
 * Add user(s) to group
 *
-* @return mixed false if no errors occurred, else the user lang string for the relevant error, for example 'NO_USER'
+* @return string|false false if no errors occurred, else the user lang string for the relevant error, for example 'NO_USER'
 */
 function group_user_add($group_id, $user_id_ary = false, $username_ary = false, $group_name = false, $default = false, $leader = 0, $pending = 0, $group_attributes = false)
 {
@@ -3073,6 +3073,7 @@ function remove_default_avatar($group_id, $user_ids)
 
 /**
 * Removes the group rank of the default group from the users in user_ids who have that group as default.
+* @return bool true if successful, false if not
 */
 function remove_default_rank($group_id, $user_ids)
 {
@@ -3107,6 +3108,8 @@ function remove_default_rank($group_id, $user_ids)
 			AND user_rank = ' . (int) $row['group_rank'] . '
 			AND ' . $db->sql_in_set('user_id', $user_ids);
 	$db->sql_query($sql);
+
+	return true;
 }
 
 /**
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index de3794353f..185316a705 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -677,7 +677,7 @@ class mcp_queue
 	* @param $post_id_list	array	IDs of the posts to approve/restore
 	* @param $id			mixed	Category of the current active module
 	* @param $mode			string	Active module
-	* @return null
+	* @return void|never
 	*/
 	public static function approve_posts($action, $post_id_list, $id, $mode)
 	{
@@ -937,7 +937,7 @@ class mcp_queue
 	* @param $topic_id_list	array	IDs of the topics to approve/restore
 	* @param $id			mixed	Category of the current active module
 	* @param $mode			string	Active module
-	* @return null
+	* @return void|never
 	*/
 	public static function approve_topics($action, $topic_id_list, $id, $mode)
 	{
@@ -1136,7 +1136,7 @@ class mcp_queue
 	* @param $post_id_list	array	IDs of the posts to disapprove/delete
 	* @param $id			mixed	Category of the current active module
 	* @param $mode			string	Active module
-	* @return null
+	* @return void|never
 	*/
 	public static function disapprove_posts($post_id_list, $id, $mode)
 	{
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index 8257a895c5..7e856858ad 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -1902,7 +1902,7 @@ class parse_message extends bbcode_firstpass
 	* Remove nested quotes at given depth in current parsed message
 	*
 	* @param  integer $max_depth Depth limit
-	* @return null
+	* @return void
 	*/
 	public function remove_nested_quotes($max_depth)
 	{
diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php
index 08fee2e1ae..8ab18ad8c8 100644
--- a/phpBB/includes/questionnaire/questionnaire.php
+++ b/phpBB/includes/questionnaire/questionnaire.php
@@ -74,7 +74,7 @@ class phpbb_questionnaire_data_collector
 	/**
 	* Collect info into the data property.
 	*
-	* @return	null
+	* @return	void
 	*/
 	function collect()
 	{
diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php
index aed6c3aece..75a0b8def4 100644
--- a/phpBB/install/convertors/functions_phpbb20.php
+++ b/phpBB/install/convertors/functions_phpbb20.php
@@ -1317,7 +1317,7 @@ function phpbb_get_files_dir()
 {
 	if (!defined('MOD_ATTACHMENT'))
 	{
-		return;
+		return '';
 	}
 
 	global $src_db, $same_db, $convert, $user;
diff --git a/phpBB/install/startup.php b/phpBB/install/startup.php
index 0aaa9a648f..4e012216a6 100644
--- a/phpBB/install/startup.php
+++ b/phpBB/install/startup.php
@@ -47,7 +47,7 @@ function phpbb_include_updated($path, $phpbb_root_path, $optional = false)
 	}
 }
 
-function installer_msg_handler($errno, $msg_text, $errfile, $errline)
+function installer_msg_handler($errno, $msg_text, $errfile, $errline): bool
 {
 	global $phpbb_installer_container, $msg_long_text;
 
@@ -88,7 +88,7 @@ function installer_msg_handler($errno, $msg_text, $errfile, $errline)
 				print($msg);
 			}
 
-			return;
+			return false;
 		break;
 		case E_USER_ERROR:
 			$msg = '<b>General Error:</b><br>' . $msg_text . '<br> in file ' . $errfile . ' on line ' . $errline . '<br><br>';
diff --git a/phpBB/phpbb/captcha/plugins/captcha_abstract.php b/phpBB/phpbb/captcha/plugins/captcha_abstract.php
index dd1f9f1c48..012e28c987 100644
--- a/phpBB/phpbb/captcha/plugins/captcha_abstract.php
+++ b/phpBB/phpbb/captcha/plugins/captcha_abstract.php
@@ -75,7 +75,7 @@ abstract class captcha_abstract
 			if (!$this->load_code())
 			{
 				// invalid request, bail out
-				return false;
+				return;
 			}
 		}
 		$generator = $this->get_generator_class();
diff --git a/phpBB/phpbb/config/db_text.php b/phpBB/phpbb/config/db_text.php
index 818f6bdcc9..136158cc98 100644
--- a/phpBB/phpbb/config/db_text.php
+++ b/phpBB/phpbb/config/db_text.php
@@ -48,7 +48,7 @@ class db_text
 	* @param string $key       The configuration option's name
 	* @param string $value     New configuration value
 	*
-	* @return null
+	* @return void
 	*/
 	public function set($key, $value)
 	{
@@ -75,7 +75,7 @@ class db_text
 	*
 	* @param string $key       The configuration option's name
 	*
-	* @return null
+	* @return void
 	*/
 	public function delete($key)
 	{
@@ -89,7 +89,7 @@ class db_text
 	*
 	* @param array $map        Map from configuration names to values
 	*
-	* @return null
+	* @return void
 	*/
 	public function set_array(array $map)
 	{
@@ -147,7 +147,7 @@ class db_text
 	*
 	* @param array $keys       Set of configuration option names
 	*
-	* @return null
+	* @return void
 	*/
 	public function delete_array(array $keys)
 	{
diff --git a/phpBB/phpbb/config_php_file.php b/phpBB/phpbb/config_php_file.php
index e3eeef06f0..77bc1ae5a6 100644
--- a/phpBB/phpbb/config_php_file.php
+++ b/phpBB/phpbb/config_php_file.php
@@ -94,7 +94,7 @@ class config_php_file
 	/**
 	* Load the config file and store the information.
 	*
-	* @return null
+	* @return void
 	*/
 	protected function load_config_file()
 	{
diff --git a/phpBB/phpbb/console/command/cron/run.php b/phpBB/phpbb/console/command/cron/run.php
index e105911511..d31abb0691 100644
--- a/phpBB/phpbb/console/command/cron/run.php
+++ b/phpBB/phpbb/console/command/cron/run.php
@@ -45,7 +45,7 @@ class run extends \phpbb\console\command\command
 	/**
 	* Sets the command name and description
 	*
-	* @return null
+	* @return void
 	*/
 	protected function configure()
 	{
diff --git a/phpBB/phpbb/console/command/extension/install.php b/phpBB/phpbb/console/command/extension/install.php
index 0e59abd212..1f414e348e 100644
--- a/phpBB/phpbb/console/command/extension/install.php
+++ b/phpBB/phpbb/console/command/extension/install.php
@@ -49,7 +49,7 @@ class install extends \phpbb\console\command\command
 	/**
 	* Sets the command name and description
 	*
-	* @return null
+	* @return void
 	*/
 	protected function configure()
 	{
diff --git a/phpBB/phpbb/console/command/extension/list_available.php b/phpBB/phpbb/console/command/extension/list_available.php
index 1c38b8922f..c53f83c7c7 100644
--- a/phpBB/phpbb/console/command/extension/list_available.php
+++ b/phpBB/phpbb/console/command/extension/list_available.php
@@ -38,7 +38,7 @@ class list_available extends \phpbb\console\command\command
 	/**
 	* Sets the command name and description
 	*
-	* @return null
+	* @return void
 	*/
 	protected function configure()
 	{
diff --git a/phpBB/phpbb/console/command/extension/manage.php b/phpBB/phpbb/console/command/extension/manage.php
index cb97c6d141..393488e6af 100644
--- a/phpBB/phpbb/console/command/extension/manage.php
+++ b/phpBB/phpbb/console/command/extension/manage.php
@@ -48,7 +48,7 @@ class manage extends \phpbb\console\command\command
 	/**
 	* Sets the command name and description
 	*
-	* @return null
+	* @return void
 	*/
 	protected function configure()
 	{
diff --git a/phpBB/phpbb/console/command/extension/remove.php b/phpBB/phpbb/console/command/extension/remove.php
index 629d55a7a9..9197caed0b 100644
--- a/phpBB/phpbb/console/command/extension/remove.php
+++ b/phpBB/phpbb/console/command/extension/remove.php
@@ -49,7 +49,7 @@ class remove extends \phpbb\console\command\command
 	/**
 	* Sets the command name and description
 	*
-	* @return null
+	* @return void
 	*/
 	protected function configure()
 	{
diff --git a/phpBB/phpbb/console/command/extension/update.php b/phpBB/phpbb/console/command/extension/update.php
index 8992b48241..d469d967e4 100644
--- a/phpBB/phpbb/console/command/extension/update.php
+++ b/phpBB/phpbb/console/command/extension/update.php
@@ -46,7 +46,7 @@ class update extends \phpbb\console\command\command
 	/**
 	* Sets the command name and description
 	*
-	* @return null
+	* @return void
 	*/
 	protected function configure()
 	{
diff --git a/phpBB/phpbb/console/command/reparser/list_all.php b/phpBB/phpbb/console/command/reparser/list_all.php
index 83c301e00f..a062fac75a 100644
--- a/phpBB/phpbb/console/command/reparser/list_all.php
+++ b/phpBB/phpbb/console/command/reparser/list_all.php
@@ -45,7 +45,7 @@ class list_all extends \phpbb\console\command\command
 	/**
 	* Sets the command name and description
 	*
-	* @return null
+	* @return void
 	*/
 	protected function configure()
 	{
diff --git a/phpBB/phpbb/console/command/reparser/reparse.php b/phpBB/phpbb/console/command/reparser/reparse.php
index 529035233d..1e66a22a73 100644
--- a/phpBB/phpbb/console/command/reparser/reparse.php
+++ b/phpBB/phpbb/console/command/reparser/reparse.php
@@ -79,7 +79,7 @@ class reparse extends \phpbb\console\command\command
 	/**
 	* Sets the command name and description
 	*
-	* @return null
+	* @return void
 	*/
 	protected function configure()
 	{
diff --git a/phpBB/phpbb/console/command/thumbnail/delete.php b/phpBB/phpbb/console/command/thumbnail/delete.php
index 1fca707eed..21fb843e7d 100644
--- a/phpBB/phpbb/console/command/thumbnail/delete.php
+++ b/phpBB/phpbb/console/command/thumbnail/delete.php
@@ -55,7 +55,7 @@ class delete extends \phpbb\console\command\command
 	/**
 	* Sets the command name and description
 	*
-	* @return null
+	* @return void
 	*/
 	protected function configure()
 	{
diff --git a/phpBB/phpbb/console/command/thumbnail/generate.php b/phpBB/phpbb/console/command/thumbnail/generate.php
index ac70a2d92e..9be4ce5a2e 100644
--- a/phpBB/phpbb/console/command/thumbnail/generate.php
+++ b/phpBB/phpbb/console/command/thumbnail/generate.php
@@ -72,7 +72,7 @@ class generate extends \phpbb\console\command\command
 	/**
 	* Sets the command name and description
 	*
-	* @return null
+	* @return void
 	*/
 	protected function configure()
 	{
diff --git a/phpBB/phpbb/console/command/thumbnail/recreate.php b/phpBB/phpbb/console/command/thumbnail/recreate.php
index bea7a33d87..cffa2c29dc 100644
--- a/phpBB/phpbb/console/command/thumbnail/recreate.php
+++ b/phpBB/phpbb/console/command/thumbnail/recreate.php
@@ -22,7 +22,7 @@ class recreate extends \phpbb\console\command\command
 	/**
 	* Sets the command name and description
 	*
-	* @return null
+	* @return void
 	*/
 	protected function configure()
 	{
diff --git a/phpBB/phpbb/console/command/update/check.php b/phpBB/phpbb/console/command/update/check.php
index bb9114652a..74220394e2 100644
--- a/phpBB/phpbb/console/command/update/check.php
+++ b/phpBB/phpbb/console/command/update/check.php
@@ -57,7 +57,7 @@ class check extends \phpbb\console\command\command
 	*
 	* Sets the name and description of the command.
 	*
-	* @return null
+	* @return void
 	*/
 	protected function configure()
 	{
diff --git a/phpBB/phpbb/console/command/user/activate.php b/phpBB/phpbb/console/command/user/activate.php
index 35835eed5d..1d635b46dc 100644
--- a/phpBB/phpbb/console/command/user/activate.php
+++ b/phpBB/phpbb/console/command/user/activate.php
@@ -87,7 +87,7 @@ class activate extends command
 	/**
 	 * Sets the command name and description
 	 *
-	 * @return null
+	 * @return void
 	 */
 	protected function configure()
 	{
@@ -186,7 +186,7 @@ class activate extends command
 	 *
 	 * @param array           $user_row The user data array
 	 * @param InputInterface  $input    The input stream used to get the options
-	 * @return null
+	 * @return void
 	 */
 	protected function send_notification($user_row, InputInterface $input)
 	{
diff --git a/phpBB/phpbb/console/command/user/add.php b/phpBB/phpbb/console/command/user/add.php
index fb4ffd5ffb..d26007dfb5 100644
--- a/phpBB/phpbb/console/command/user/add.php
+++ b/phpBB/phpbb/console/command/user/add.php
@@ -85,7 +85,7 @@ class add extends command
 	/**
 	 * Sets the command name and description
 	 *
-	 * @return null
+	 * @return void
 	 */
 	protected function configure()
 	{
@@ -226,7 +226,7 @@ class add extends command
 	 * Validate the submitted user data
 	 *
 	 * @throws runtime_exception if any data fails validation
-	 * @return null
+	 * @return void
 	 */
 	protected function validate_user_data()
 	{
@@ -283,7 +283,7 @@ class add extends command
 	 * Send account activation email
 	 *
 	 * @param int   $user_id The new user's id
-	 * @return null
+	 * @return void
 	 */
 	protected function send_activation_email($user_id)
 	{
diff --git a/phpBB/phpbb/console/command/user/delete.php b/phpBB/phpbb/console/command/user/delete.php
index abda29fedf..acd360b57b 100644
--- a/phpBB/phpbb/console/command/user/delete.php
+++ b/phpBB/phpbb/console/command/user/delete.php
@@ -76,7 +76,7 @@ class delete extends command
 	/**
 	 * Sets the command name and description
 	 *
-	 * @return null
+	 * @return void
 	 */
 	protected function configure()
 	{
diff --git a/phpBB/phpbb/console/command/user/reclean.php b/phpBB/phpbb/console/command/user/reclean.php
index 6ad5ac4f92..96932fcdaa 100644
--- a/phpBB/phpbb/console/command/user/reclean.php
+++ b/phpBB/phpbb/console/command/user/reclean.php
@@ -55,7 +55,7 @@ class reclean extends command
 	/**
 	 * Sets the command name and description
 	 *
-	 * @return null
+	 * @return void
 	 */
 	protected function configure()
 	{
diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php
index a3b0e378fc..99f89580d7 100644
--- a/phpBB/phpbb/content_visibility.php
+++ b/phpBB/phpbb/content_visibility.php
@@ -839,7 +839,7 @@ class content_visibility
 	*
 	* @param $data			array	Contains information from the topics table about given topic
 	* @param $sql_data		array	Populated with the SQL changes, may be empty at call time (by reference)
-	* @return null
+	* @return void
 	*/
 	public function add_post_to_statistic($data, &$sql_data)
 	{
@@ -860,7 +860,7 @@ class content_visibility
 	*
 	* @param $data			array	Contains information from the topics table about given topic
 	* @param $sql_data		array	Populated with the SQL changes, may be empty at call time (by reference)
-	* @return null
+	* @return void
 	*/
 	public function remove_post_from_statistic($data, &$sql_data)
 	{
@@ -893,7 +893,7 @@ class content_visibility
 	*
 	* @param $data			array	Post and topic data
 	* @param $sql_data		array	Populated with the SQL changes, may be empty at call time (by reference)
-	* @return null
+	* @return void
 	*/
 	public function remove_topic_from_statistic($data, &$sql_data)
 	{
diff --git a/phpBB/phpbb/controller/resolver.php b/phpBB/phpbb/controller/resolver.php
index 943bd570d1..1e65b2324b 100644
--- a/phpBB/phpbb/controller/resolver.php
+++ b/phpBB/phpbb/controller/resolver.php
@@ -65,7 +65,7 @@ class resolver implements ControllerResolverInterface
 	* Load a controller callable
 	*
 	* @param Request $request Symfony Request object
-	* @return bool|Callable Callable or false
+	* @return false|Callable Callable or false (fixme: method is returning an array)
 	* @throws \phpbb\controller\exception
 	*/
 	public function getController(Request $request)
diff --git a/phpBB/phpbb/cron/task/core/prune_all_forums.php b/phpBB/phpbb/cron/task/core/prune_all_forums.php
index 664e37b1a1..d7d8d4fd9a 100644
--- a/phpBB/phpbb/cron/task/core/prune_all_forums.php
+++ b/phpBB/phpbb/cron/task/core/prune_all_forums.php
@@ -46,7 +46,7 @@ class prune_all_forums extends \phpbb\cron\task\base
 	/**
 	* Runs this cron task.
 	*
-	* @return null
+	* @return void
 	*/
 	public function run()
 	{
diff --git a/phpBB/phpbb/cron/task/core/prune_forum.php b/phpBB/phpbb/cron/task/core/prune_forum.php
index 2060babc25..3e32c67283 100644
--- a/phpBB/phpbb/cron/task/core/prune_forum.php
+++ b/phpBB/phpbb/cron/task/core/prune_forum.php
@@ -66,7 +66,7 @@ class prune_forum extends \phpbb\cron\task\base implements \phpbb\cron\task\para
 	/**
 	* Runs this cron task.
 	*
-	* @return null
+	* @return void
 	*/
 	public function run()
 	{
@@ -137,7 +137,7 @@ class prune_forum extends \phpbb\cron\task\base implements \phpbb\cron\task\para
 	*
 	* @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/cron/task/core/queue.php b/phpBB/phpbb/cron/task/core/queue.php
index eca69a5041..2f0d91d046 100644
--- a/phpBB/phpbb/cron/task/core/queue.php
+++ b/phpBB/phpbb/cron/task/core/queue.php
@@ -42,7 +42,7 @@ class queue extends \phpbb\cron\task\base
 	/**
 	* Runs this cron task.
 	*
-	* @return null
+	* @return void
 	*/
 	public function run()
 	{
diff --git a/phpBB/phpbb/cron/task/core/tidy_cache.php b/phpBB/phpbb/cron/task/core/tidy_cache.php
index 506a245f0f..514974e6c8 100644
--- a/phpBB/phpbb/cron/task/core/tidy_cache.php
+++ b/phpBB/phpbb/cron/task/core/tidy_cache.php
@@ -36,7 +36,7 @@ class tidy_cache extends \phpbb\cron\task\base
 	/**
 	* Runs this cron task.
 	*
-	* @return null
+	* @return void
 	*/
 	public function run()
 	{
diff --git a/phpBB/phpbb/cron/task/core/tidy_database.php b/phpBB/phpbb/cron/task/core/tidy_database.php
index 949bba8012..51fb26cda2 100644
--- a/phpBB/phpbb/cron/task/core/tidy_database.php
+++ b/phpBB/phpbb/cron/task/core/tidy_database.php
@@ -39,7 +39,7 @@ class tidy_database extends \phpbb\cron\task\base
 	/**
 	* Runs this cron task.
 	*
-	* @return null
+	* @return void
 	*/
 	public function run()
 	{
diff --git a/phpBB/phpbb/cron/task/core/tidy_search.php b/phpBB/phpbb/cron/task/core/tidy_search.php
index a29a403627..ba038a1048 100644
--- a/phpBB/phpbb/cron/task/core/tidy_search.php
+++ b/phpBB/phpbb/cron/task/core/tidy_search.php
@@ -59,7 +59,7 @@ class tidy_search extends base
 	/**
 	* Runs this cron task.
 	*
-	* @return null
+	* @return void
 	*/
 	public function run()
 	{
diff --git a/phpBB/phpbb/cron/task/core/tidy_sessions.php b/phpBB/phpbb/cron/task/core/tidy_sessions.php
index 5e6dabdabf..78c99e8be0 100644
--- a/phpBB/phpbb/cron/task/core/tidy_sessions.php
+++ b/phpBB/phpbb/cron/task/core/tidy_sessions.php
@@ -36,7 +36,7 @@ class tidy_sessions extends \phpbb\cron\task\base
 	/**
 	* Runs this cron task.
 	*
-	* @return null
+	* @return void
 	*/
 	public function run()
 	{
diff --git a/phpBB/phpbb/cron/task/core/tidy_warnings.php b/phpBB/phpbb/cron/task/core/tidy_warnings.php
index 7b67eae6ef..b9dda21012 100644
--- a/phpBB/phpbb/cron/task/core/tidy_warnings.php
+++ b/phpBB/phpbb/cron/task/core/tidy_warnings.php
@@ -41,7 +41,7 @@ class tidy_warnings extends \phpbb\cron\task\base
 	/**
 	* Runs this cron task.
 	*
-	* @return null
+	* @return void
 	*/
 	public function run()
 	{
diff --git a/phpBB/phpbb/db/extractor/mysql_extractor.php b/phpBB/phpbb/db/extractor/mysql_extractor.php
index 6d230a6e35..386130e4ae 100644
--- a/phpBB/phpbb/db/extractor/mysql_extractor.php
+++ b/phpBB/phpbb/db/extractor/mysql_extractor.php
@@ -86,7 +86,7 @@ class mysql_extractor extends base_extractor
 	* Extracts data from database table (for MySQLi 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_mysqli($table_name)
@@ -176,7 +176,7 @@ class mysql_extractor extends base_extractor
 	* Extracts database table structure (for MySQLi or MySQL 3.23.20+)
 	*
 	* @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 new_write_table($table_name)
@@ -201,7 +201,7 @@ class mysql_extractor extends base_extractor
 	* Extracts database table structure (for MySQL versions older than 3.23.20)
 	*
 	* @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 old_write_table($table_name)
diff --git a/phpBB/phpbb/db/migration/profilefield_base_migration.php b/phpBB/phpbb/db/migration/profilefield_base_migration.php
index bc542a8fed..9ec0e2bb3e 100644
--- a/phpBB/phpbb/db/migration/profilefield_base_migration.php
+++ b/phpBB/phpbb/db/migration/profilefield_base_migration.php
@@ -183,8 +183,8 @@ abstract class profilefield_base_migration extends container_aware_migration
 	}
 
 	/**
-	* @param int			$start		Start of staggering step
-	* @return		mixed		int start of the next step, null if the end was reached
+	* @param	int			$start		Start of staggering step
+	* @return	int|null	int start of the next step, null if the end was reached
 	*/
 	public function convert_user_field_to_custom_field($start)
 	{
@@ -226,7 +226,7 @@ abstract class profilefield_base_migration extends container_aware_migration
 		if ($converted_users < $limit)
 		{
 			// No more users left, we are done...
-			return;
+			return null;
 		}
 
 		return $start + $limit;
diff --git a/phpBB/phpbb/db/migration/tool/config_text.php b/phpBB/phpbb/db/migration/tool/config_text.php
index 6080619dfa..89fa3b9d71 100644
--- a/phpBB/phpbb/db/migration/tool/config_text.php
+++ b/phpBB/phpbb/db/migration/tool/config_text.php
@@ -63,7 +63,7 @@ class config_text implements \phpbb\db\migration\tool\tool_interface
 	* @param string $config_name The name of the config_text setting you would
 	* 	like to update
 	* @param mixed $config_value The value of the config_text setting
-	* @return null
+	* @return void
 	* @throws \phpbb\db\migration\exception
 	*/
 	public function update($config_name, $config_value)
diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php
index 60673ea9bc..972c2d5107 100644
--- a/phpBB/phpbb/db/migrator.php
+++ b/phpBB/phpbb/db/migrator.php
@@ -732,7 +732,7 @@ class migrator
 
 		if ($callable_and_parameters === false)
 		{
-			return;
+			return null;
 		}
 
 		$callable = $callable_and_parameters[0];
diff --git a/phpBB/phpbb/di/pass/collection_pass.php b/phpBB/phpbb/di/pass/collection_pass.php
index 341f88518d..049337d974 100644
--- a/phpBB/phpbb/di/pass/collection_pass.php
+++ b/phpBB/phpbb/di/pass/collection_pass.php
@@ -27,7 +27,7 @@ class collection_pass implements CompilerPassInterface
 	* Modify the container before it is passed to the rest of the code
 	*
 	* @param ContainerBuilder $container ContainerBuilder object
-	* @return null
+	* @return void
 	*/
 	public function process(ContainerBuilder $container)
 	{
diff --git a/phpBB/phpbb/event/kernel_exception_subscriber.php b/phpBB/phpbb/event/kernel_exception_subscriber.php
index 71959d81e0..4adb3f10ef 100644
--- a/phpBB/phpbb/event/kernel_exception_subscriber.php
+++ b/phpBB/phpbb/event/kernel_exception_subscriber.php
@@ -66,7 +66,7 @@ class kernel_exception_subscriber implements EventSubscriberInterface
 	* This listener is run when the KernelEvents::EXCEPTION event is triggered
 	*
 	* @param ExceptionEvent $event
-	* @return null
+	* @return void
 	*/
 	public function on_kernel_exception(ExceptionEvent $event)
 	{
diff --git a/phpBB/phpbb/extension/di/extension_base.php b/phpBB/phpbb/extension/di/extension_base.php
index 97033e7ddb..fcc358dd79 100644
--- a/phpBB/phpbb/extension/di/extension_base.php
+++ b/phpBB/phpbb/extension/di/extension_base.php
@@ -122,6 +122,7 @@ class extension_base extends Extension
 			}
 		}
 
+		return null;
 	}
 
 	/**
diff --git a/phpBB/phpbb/help/controller/help.php b/phpBB/phpbb/help/controller/help.php
index 3bf6fe3098..557b564da4 100644
--- a/phpBB/phpbb/help/controller/help.php
+++ b/phpBB/phpbb/help/controller/help.php
@@ -124,7 +124,7 @@ class help
 	 * Assigns the help data to the template blocks
 	 *
 	 * @param array $help_data
-	 * @return null
+	 * @return void
 	 */
 	protected function assign_to_template(array $help_data)
 	{
diff --git a/phpBB/phpbb/message/form.php b/phpBB/phpbb/message/form.php
index 6573a04f8b..c23b168906 100644
--- a/phpBB/phpbb/message/form.php
+++ b/phpBB/phpbb/message/form.php
@@ -118,7 +118,7 @@ abstract class form
 	* Bind the values of the request to the form
 	*
 	* @param \phpbb\request\request_interface $request
-	* @return null
+	* @return void
 	*/
 	public function bind(\phpbb\request\request_interface $request)
 	{
@@ -130,7 +130,7 @@ abstract class form
 	* Submit form, generate the email and send it
 	*
 	* @param \messenger $messenger
-	* @return null
+	* @return void
 	*/
 	public function submit(\messenger $messenger)
 	{
@@ -162,7 +162,7 @@ abstract class form
 	* Render the template of the form
 	*
 	* @param \phpbb\template\template $template
-	* @return null
+	* @return void
 	*/
 	public function render(\phpbb\template\template $template)
 	{
diff --git a/phpBB/phpbb/plupload/plupload.php b/phpBB/phpbb/plupload/plupload.php
index aeb1bd87d2..6ccb141313 100644
--- a/phpBB/phpbb/plupload/plupload.php
+++ b/phpBB/phpbb/plupload/plupload.php
@@ -138,6 +138,7 @@ class plupload
 				'id' => 'id',
 				'result' => null,
 			));
+			return null;
 		}
 	}
 
diff --git a/phpBB/phpbb/report/report_reason_list_provider.php b/phpBB/phpbb/report/report_reason_list_provider.php
index 388a61d577..6d9bd7694e 100644
--- a/phpBB/phpbb/report/report_reason_list_provider.php
+++ b/phpBB/phpbb/report/report_reason_list_provider.php
@@ -48,7 +48,7 @@ class report_reason_list_provider
 	 * Sets template variables to render report reasons select HTML input
 	 *
 	 * @param int	$reason_id
-	 * @return null
+	 * @return void
 	 */
 	public function display_reasons($reason_id = 0)
 	{
diff --git a/phpBB/phpbb/routing/resources_locator/default_resources_locator.php b/phpBB/phpbb/routing/resources_locator/default_resources_locator.php
index 90c3877007..8cbf089b2a 100644
--- a/phpBB/phpbb/routing/resources_locator/default_resources_locator.php
+++ b/phpBB/phpbb/routing/resources_locator/default_resources_locator.php
@@ -44,9 +44,9 @@ class default_resources_locator implements resources_locator_interface
 	/**
 	 * Construct method
 	 *
-	 * @param string	$phpbb_root_path	phpBB root path
-	 * @param string	$environment		Name of the current environment
-	 * @param manager	$extension_manager	Extension manager
+	 * @param string		$phpbb_root_path	phpBB root path
+	 * @param string		$environment		Name of the current environment
+	 * @param manager|null	$extension_manager	Extension manager
 	 */
 	public function __construct($phpbb_root_path, $environment, manager $extension_manager = null)
 	{
diff --git a/phpBB/phpbb/search/backend/fulltext_postgres.php b/phpBB/phpbb/search/backend/fulltext_postgres.php
index efd6ecc148..6c4ac05932 100644
--- a/phpBB/phpbb/search/backend/fulltext_postgres.php
+++ b/phpBB/phpbb/search/backend/fulltext_postgres.php
@@ -1011,7 +1011,7 @@ class fulltext_postgres extends base implements search_backend_interface
 	}
 
 	/**
-	 * {@inheritdoc}
+	 * Computes the stats and store them in the $this->stats associative array
 	 */
 	protected function get_stats()
 	{
diff --git a/phpBB/phpbb/storage/exception/exception.php b/phpBB/phpbb/storage/exception/exception.php
index 3a587bea3f..8268530c16 100644
--- a/phpBB/phpbb/storage/exception/exception.php
+++ b/phpBB/phpbb/storage/exception/exception.php
@@ -20,11 +20,11 @@ class exception extends runtime_exception
 	/**
 	 * Constructor
 	 *
-	 * @param string		$message	The Exception message to throw (must be a language variable)
-	 * @param string		$filename	The file that caused the error
-	 * @param array			$parameters	The parameters to use with the language var
-	 * @param \Exception	$previous	The previous runtime_exception used for the runtime_exception chaining
-	 * @param integer		$code		The Exception code
+	 * @param string			$message	The Exception message to throw (must be a language variable)
+	 * @param string			$filename	The file that caused the error
+	 * @param array				$parameters	The parameters to use with the language var
+	 * @param \Exception|null	$previous	The previous runtime_exception used for the runtime_exception chaining
+	 * @param integer			$code		The Exception code
 	 */
 	public function __construct($message = '', $filename = '', $parameters = [], \Exception $previous = null, $code = 0)
 	{
diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php
index d98d8b6e28..7f83152590 100644
--- a/phpBB/phpbb/template/context.php
+++ b/phpBB/phpbb/template/context.php
@@ -340,7 +340,7 @@ class context
 	* If key is false the position is set to 0
 	* If key is true the position is set to the last entry
 	*
-	* @return mixed false if not found, index position otherwise; be sure to test with ===
+	* @return false|int false if not found, index position otherwise; be sure to test with ===
 	*/
 	public function find_key_index($blockname, $key)
 	{
@@ -377,7 +377,7 @@ class context
 		// Change key to zero (change first position) if false and to last position if true
 		if (is_bool($key))
 		{
-			return (!$key) ? 0 : count($block) - 1;
+			return (!$key) ? 0 : (count($block) ?? 0) - 1;
 		}
 
 		// Get correct position if array given
diff --git a/phpBB/phpbb/template/twig/environment.php b/phpBB/phpbb/template/twig/environment.php
index bcffbd06ce..5843cc0762 100644
--- a/phpBB/phpbb/template/twig/environment.php
+++ b/phpBB/phpbb/template/twig/environment.php
@@ -54,9 +54,9 @@ class environment extends \Twig\Environment
 	* @param \phpbb\filesystem\filesystem $filesystem
 	* @param \phpbb\path_helper $path_helper phpBB path helper
 	* @param string $cache_path The path to the cache directory
-	* @param \phpbb\extension\manager $extension_manager phpBB extension manager
-	* @param \Twig\Loader\LoaderInterface $loader Twig loader interface
-	* @param \phpbb\event\dispatcher_interface	$phpbb_dispatcher	Event dispatcher object
+	* @param \phpbb\extension\manager|null $extension_manager phpBB extension manager
+	* @param \Twig\Loader\LoaderInterface|null $loader Twig loader interface
+	* @param \phpbb\event\dispatcher_interface|null	$phpbb_dispatcher	Event dispatcher object
 	* @param array $options Array of options to pass to Twig
 	*/
 	public function __construct(\phpbb\config\config $phpbb_config, \phpbb\filesystem\filesystem $filesystem, \phpbb\path_helper $path_helper, $cache_path, \phpbb\extension\manager $extension_manager = null, \Twig\Loader\LoaderInterface $loader = null, \phpbb\event\dispatcher_interface $phpbb_dispatcher = null, $options = array())
@@ -195,7 +195,7 @@ class environment extends \Twig\Environment
 	}
 
 	/**
-	 * {@inheritdoc}
+	 * Get template with assets
 	 */
 	private function display_with_assets($name, array $context = [])
 	{
@@ -261,7 +261,7 @@ class environment extends \Twig\Environment
 	*
 	* @param string  $cls   The template class associated with the given template name
 	* @param string  $name  The template name
-	* @param integer $index The index if it is an embedded template
+	* @param integer|null $index The index if it is an embedded template
 	* @return \Twig\Template A template instance representing the given template name
 	* @throws \Twig\Error\LoaderError
 	*/
diff --git a/phpBB/phpbb/tree/nestedset.php b/phpBB/phpbb/tree/nestedset.php
index b25a91b7b9..3a32710ebc 100644
--- a/phpBB/phpbb/tree/nestedset.php
+++ b/phpBB/phpbb/tree/nestedset.php
@@ -700,7 +700,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface
 	* @param bool	$set_subset_zero	Should the parent, left and right id of the items be set to 0, or kept unchanged?
 	*									In case of removing an item from the tree, we should the values to 0
 	*									In case of moving an item, we shouldkeep the original values, in order to allow "+ diff" later
-	* @return	null
+	* @return	void
 	*/
 	protected function remove_subset(array $subset_items, array $bounding_item, $set_subset_zero = true)
 	{