Merge pull request #6439 from marc1706/ticket/16955

[ticket/16955] Improve code and docblocks to resolve psalm results
This commit is contained in:
Marc Alexander 2023-01-03 22:19:57 +01:00 committed by GitHub
commit c90d84ac90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
285 changed files with 1872 additions and 1648 deletions

View file

@ -72,6 +72,10 @@ jobs:
run: |
.github/check-doctum-parse-errors.sh
- name: Check code with psalm
run: |
phpBB/vendor/bin/psalm --output-format=github
- name: Check image ICC profiles
run: |
.github/check-image-icc-profiles.sh

View file

@ -0,0 +1,35 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
class APCUIterator implements Iterator
{
public function current()
{
}
public function next()
{
}
public function key()
{
}
public function valid()
{
}
public function rewind()
{
}
}

View file

@ -0,0 +1,20 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
/** @link https://www.php.net/manual/en/memcached.constants.php */
class Memcached
{
public const OPT_COMPRESSION = -1001;
public const OPT_BINARY_PROTOCOL = 18;
}

View file

@ -0,0 +1,19 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
/** @link https://php.net/manual/en/oci8.constants.php */
define('OCI_DEFAULT', 0);
define('OCI_ASSOC', 1);
define('OCI_RETURN_NULLS', 4);

View file

@ -0,0 +1,15 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
/** @link https://www.php.net/manual/en/pgsql.constants.php */
define('PGSQL_CONNECT_FORCE_NEW', 2);

View file

@ -0,0 +1,19 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
/** @link https://phpredis.github.io/phpredis/Redis.html */
class Redis
{
public const OPT_PREFIX = 2;
public const SERIALIZER_PHP = 1;
}

View file

@ -0,0 +1,33 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
class SQLite3
{
public function query(string $query) {}
}
class SQLite3Result
{
public function fetchArray(int $mode = SQLITE3_BOTH) {}
}
/**
* @link https://www.php.net/manual/en/sqlite3.constants.php
*/
define('SQLITE3_ASSOC', 1);
define('SQLITE3_NUM', 2);
define('SQLITE3_BOTH', 3);
define('SQLITE3_OPEN_READONLY', 1);
define('SQLITE3_OPEN_READWRITE', 2);
define('SQLITE3_OPEN_CREATE', 4);

View file

@ -23,6 +23,7 @@ require_once $phpbb_root_path . 'includes/startup.php';
$table_prefix = 'phpbb_';
require_once $phpbb_root_path . 'includes/constants.php';
require_once $phpbb_root_path . 'phpbb/class_loader.' . $phpEx;
require_once $phpbb_root_path . 'includes/acp/acp_database.' . $phpEx;
require_once $phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx;
require_once $phpbb_root_path . 'includes/functions.' . $phpEx;
require_once $phpbb_root_path . 'includes/functions_acp.' . $phpEx;
@ -38,6 +39,18 @@ require_once $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
require_once $phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx;
require_once $phpbb_root_path . 'includes/functions_transfer.' . $phpEx;
require_once $phpbb_root_path . 'includes/functions_user.' . $phpEx;
require_once $phpbb_root_path . 'includes/sphinxapi.' . $phpEx;
require_once $phpbb_root_path . 'includes/diff/diff.' . $phpEx;
require_once $phpbb_root_path . 'includes/diff/engine.' . $phpEx;
require_once $phpbb_root_path . 'includes/compatibility_globals.' . $phpEx;
$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', $phpbb_root_path . 'phpbb/', "php");
$phpbb_class_loader->register();
// Include files that require class loader to be initialized
require_once $phpbb_root_path . 'includes/acp/auth.' . $phpEx;
require_once $phpbb_root_path . 'includes/acp/acp_captcha.' . $phpEx;
class phpbb_cache_container extends \Symfony\Component\DependencyInjection\Container
{
}

24
phpBB/composer.lock generated
View file

@ -6979,16 +6979,16 @@
},
{
"name": "psalm/plugin-symfony",
"version": "v3.1.9",
"version": "v3.1.10",
"source": {
"type": "git",
"url": "https://github.com/psalm/psalm-plugin-symfony.git",
"reference": "b9511a3c4dd67131d2ae55f6d12b6c28ce56a561"
"reference": "5dca17839a6d48766ac760b8aa6d1f6d12759b28"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/psalm/psalm-plugin-symfony/zipball/b9511a3c4dd67131d2ae55f6d12b6c28ce56a561",
"reference": "b9511a3c4dd67131d2ae55f6d12b6c28ce56a561",
"url": "https://api.github.com/repos/psalm/psalm-plugin-symfony/zipball/5dca17839a6d48766ac760b8aa6d1f6d12759b28",
"reference": "5dca17839a6d48766ac760b8aa6d1f6d12759b28",
"shasum": ""
},
"require": {
@ -7038,9 +7038,9 @@
"description": "Psalm Plugin for Symfony",
"support": {
"issues": "https://github.com/psalm/psalm-plugin-symfony/issues",
"source": "https://github.com/psalm/psalm-plugin-symfony/tree/v3.1.9"
"source": "https://github.com/psalm/psalm-plugin-symfony/tree/v3.1.10"
},
"time": "2022-09-12T13:01:42+00:00"
"time": "2022-10-22T13:09:05+00:00"
},
{
"name": "sebastian/cli-parser",
@ -8727,16 +8727,16 @@
},
{
"name": "vimeo/psalm",
"version": "4.29.0",
"version": "4.30.0",
"source": {
"type": "git",
"url": "https://github.com/vimeo/psalm.git",
"reference": "7ec5ffbd5f68ae03782d7fd33fff0c45a69f95b3"
"reference": "d0bc6e25d89f649e4f36a534f330f8bb4643dd69"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/vimeo/psalm/zipball/7ec5ffbd5f68ae03782d7fd33fff0c45a69f95b3",
"reference": "7ec5ffbd5f68ae03782d7fd33fff0c45a69f95b3",
"url": "https://api.github.com/repos/vimeo/psalm/zipball/d0bc6e25d89f649e4f36a534f330f8bb4643dd69",
"reference": "d0bc6e25d89f649e4f36a534f330f8bb4643dd69",
"shasum": ""
},
"require": {
@ -8829,9 +8829,9 @@
],
"support": {
"issues": "https://github.com/vimeo/psalm/issues",
"source": "https://github.com/vimeo/psalm/tree/4.29.0"
"source": "https://github.com/vimeo/psalm/tree/4.30.0"
},
"time": "2022-10-11T17:09:17+00:00"
"time": "2022-11-06T20:37:08+00:00"
},
{
"name": "webmozart/assert",

View file

@ -65,7 +65,7 @@ require __DIR__ . '/../phpbb/event/md_exporter.' . $phpEx;
require __DIR__ . '/../phpbb/event/rst_exporter.' . $phpEx;
require __DIR__ . '/../includes/functions.' . $phpEx;
require __DIR__ . '/../phpbb/event/recursive_event_filter_iterator.' . $phpEx;
require __DIR__ . '/../phpbb/recursive_dot_prefix_filter_iterator.' . $phpEx;
require __DIR__ . '/../phpbb/iterator/recursive_dot_prefix_filter_iterator.' . $phpEx;
switch ($action)
{

View file

@ -68,7 +68,7 @@ require __DIR__ . '/../phpbb/event/md_exporter.' . $phpEx;
require __DIR__ . '/../phpbb/event/rst_exporter.' . $phpEx;
require __DIR__ . '/../includes/functions.' . $phpEx;
require __DIR__ . '/../phpbb/event/recursive_event_filter_iterator.' . $phpEx;
require __DIR__ . '/../phpbb/recursive_dot_prefix_filter_iterator.' . $phpEx;
require __DIR__ . '/../phpbb/iterator/recursive_dot_prefix_filter_iterator.' . $phpEx;
switch ($action)
{

View file

@ -67,7 +67,7 @@ require __DIR__ . '/../phpbb/event/php_exporter.' . $phpEx;
require __DIR__ . '/../phpbb/event/md_exporter.' . $phpEx;
require __DIR__ . '/../includes/functions.' . $phpEx;
require __DIR__ . '/../phpbb/event/recursive_event_filter_iterator.' . $phpEx;
require __DIR__ . '/../phpbb/recursive_dot_prefix_filter_iterator.' . $phpEx;
require __DIR__ . '/../phpbb/iterator/recursive_dot_prefix_filter_iterator.' . $phpEx;
switch ($action)
{

View file

@ -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()
{

View file

@ -23,6 +23,12 @@ class acp_captcha
{
var $u_action;
/** @var string Template name */
public $tpl_name = 'acp_captcha';
/** @var string Page title language variable */
public $page_title = 'ACP_VC_SETTINGS';
function main($id, $mode)
{
global $user, $template, $phpbb_log, $request;
@ -85,8 +91,6 @@ class acp_captcha
),
);
$this->tpl_name = 'acp_captcha';
$this->page_title = 'ACP_VC_SETTINGS';
$form_key = 'acp_captcha';
add_form_key($form_key);

View file

@ -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)
{

View file

@ -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)
@ -220,24 +220,15 @@ class acp_language
{
try
{
$iterator = new \RecursiveIteratorIterator(
new \phpbb\recursive_dot_prefix_filter_iterator(
new \RecursiveDirectoryIterator(
$this->phpbb_root_path . 'language/' . $this->config['default_lang'] . '/',
\FilesystemIterator::SKIP_DOTS
)
),
\RecursiveIteratorIterator::LEAVES_ONLY
);
$iterator = new \phpbb\finder\recursive_path_iterator($this->phpbb_root_path . 'language/' . $this->config['default_lang'] . '/');
}
catch (\Exception $e)
{
return array();
return;
}
foreach ($iterator as $file_info)
{
/** @var \RecursiveDirectoryIterator $file_info */
$relative_path = $iterator->getInnerIterator()->getSubPathname();
$relative_path = str_replace(DIRECTORY_SEPARATOR, '/', $relative_path);

View file

@ -55,7 +55,7 @@ class acp_storage
public $u_action;
/**
* @param string $id
* @param string $id
* @param string $mode
*/
public function main($id, $mode)
@ -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)
{

View file

@ -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)
*/

View file

@ -46,8 +46,8 @@ class diff
/**
* Computes diffs between sequences of strings.
*
* @param array &$from_content An array of strings. Typically these are lines from a file.
* @param array &$to_content An array of strings.
* @param array|string &$from_content An array of strings. Typically these are lines from a file.
* @param array|string &$to_content An array of strings.
* @param bool $preserve_cr If true, \r is replaced by a new line in the diff output
*/
function __construct(&$from_content, &$to_content, $preserve_cr = true)
@ -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);
@ -498,9 +498,9 @@ class diff3 extends diff
/**
* Computes diff between 3 sequences of strings.
*
* @param array &$orig The original lines to use.
* @param array &$final1 The first version to compare to.
* @param array &$final2 The second version to compare to.
* @param array|string &$orig The original lines to use.
* @param array|string &$final1 The first version to compare to.
* @param array|string &$final2 The second version to compare to.
* @param bool $preserve_cr If true, \r\n and bare \r are replaced by a new line
* in the diff output
*/
@ -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()
{
@ -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();

View file

@ -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.

View file

@ -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)
{
@ -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)
{
@ -1907,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)
{
@ -2892,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)
{
@ -2921,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;
@ -2931,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...
@ -2949,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)
@ -2967,7 +2969,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
// echo '<br /><br />BACKTRACE<br />' . get_backtrace() . '<br />' . "\n";
}
return;
return true;
break;

View file

@ -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 = '';
@ -2487,7 +2489,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)
{
@ -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 = '')
{

View file

@ -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);
}
/**
@ -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)
{
@ -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)
@ -646,14 +646,10 @@ function phpbb_email_hash($email)
*/
function phpbb_load_extensions_autoloaders($phpbb_root_path)
{
$iterator = new \RecursiveIteratorIterator(
new \phpbb\recursive_dot_prefix_filter_iterator(
new \RecursiveDirectoryIterator(
$phpbb_root_path . 'ext/',
\FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS
)
),
\RecursiveIteratorIterator::SELF_FIRST
$iterator = new \phpbb\finder\recursive_path_iterator(
$phpbb_root_path . 'ext/',
\RecursiveIteratorIterator::SELF_FIRST,
\FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS
);
$iterator->setMaxDepth(2);
@ -675,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)
*/

View file

@ -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;
}
}
);
@ -1527,8 +1524,8 @@ function truncate_string($string, $max_length = 60, $max_store_length = 255, $al
* @param int $user_id The users id
* @param string $username The users name
* @param string $username_colour The users colour
* @param string $guest_username optional parameter to specify the guest username. It will be used in favor of the GUEST language variable then.
* @param string $custom_profile_url optional parameter to specify a profile url. The user id get appended to this url as &amp;u={user_id}
* @param string|false $guest_username optional parameter to specify the guest username. It will be used in favor of the GUEST language variable then.
* @param string|false $custom_profile_url optional parameter to specify a profile url. The user id get appended to this url as &amp;u={user_id}
*
* @return string A string consisting of what is wanted based on $mode.
*/

View file

@ -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)
{

View file

@ -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,15 +1476,13 @@ 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;
}
/**
* Get user rank title and image
*
* @param array $user_data the current stored users data
* @param int $user_posts the users number of posts
* @param int|false $user_posts the users number of posts or false if guest
*
* @return array An associative array containing the rank title (title), the rank image as full img tag (img) and the rank image source (img_src)
*

View file

@ -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)
{

View file

@ -1570,6 +1570,8 @@ class smtp_class
unset($response[0]);
$this->commands[$response_code] = implode(' ', $response);
}
return null;
}
/**

View file

@ -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 = '')
{

View file

@ -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;
}
/**

View file

@ -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)
{

View file

@ -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)
{

View file

@ -74,7 +74,7 @@ class phpbb_questionnaire_data_collector
/**
* Collect info into the data property.
*
* @return null
* @return void
*/
function collect()
{

View file

@ -1317,7 +1317,7 @@ function phpbb_get_files_dir()
{
if (!defined('MOD_ATTACHMENT'))
{
return;
return '';
}
global $src_db, $same_db, $convert, $user;

View file

@ -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>';

View file

@ -23,7 +23,6 @@ abstract class base implements provider_interface
*/
public function init()
{
return;
}
/**
@ -31,7 +30,6 @@ abstract class base implements provider_interface
*/
public function autologin()
{
return;
}
/**
@ -39,7 +37,6 @@ abstract class base implements provider_interface
*/
public function acp()
{
return;
}
/**
@ -47,7 +44,6 @@ abstract class base implements provider_interface
*/
public function get_acp_template($new_config)
{
return;
}
/**
@ -55,7 +51,6 @@ abstract class base implements provider_interface
*/
public function get_login_data()
{
return;
}
/**
@ -63,7 +58,6 @@ abstract class base implements provider_interface
*/
public function get_auth_link_data($user_id = 0)
{
return;
}
/**
@ -71,7 +65,6 @@ abstract class base implements provider_interface
*/
public function logout($data, $new_session)
{
return;
}
/**
@ -79,7 +72,6 @@ abstract class base implements provider_interface
*/
public function validate_session($user)
{
return;
}
/**
@ -87,7 +79,7 @@ abstract class base implements provider_interface
*/
public function login_link_has_necessary_data(array $login_link_data)
{
return;
return null;
}
/**
@ -95,7 +87,6 @@ abstract class base implements provider_interface
*/
public function link_account(array $link_data)
{
return;
}
/**
@ -103,6 +94,5 @@ abstract class base implements provider_interface
*/
public function unlink_account(array $link_data)
{
return;
}
}

View file

@ -218,7 +218,7 @@ class oauth extends base
'oauth_provider_id' => (string) $unique_id
];
$sql = 'SELECT user_id
$sql = 'SELECT user_id
FROM ' . $this->oauth_account_table . '
WHERE ' . $this->db->sql_build_array('SELECT', $data);
$result = $this->db->sql_query($sql);
@ -240,6 +240,7 @@ class oauth extends base
* @var ServiceInterface service OAuth service
* @since 3.2.3-RC1
* @changed 3.2.6-RC1 Added redirect_data
* @psalm-var string[] $vars
*/
$vars = [
'row',
@ -476,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;
}
/**
@ -618,8 +617,8 @@ 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 string|false Returns a language constant (string) if an error is encountered,
* or false on success.
* @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)
{
@ -662,7 +661,9 @@ class oauth extends base
}
else
{
return $this->set_redirect($service);
$this->set_redirect($service);
return false; // Not reached
}
}
@ -670,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)
{
@ -828,8 +830,7 @@ class oauth extends base
* Sets a redirect to the authorization uri.
*
* @param OAuth1Service|OAuth2Service $service The external OAuth service
* @return array|false Array if an error occurred,
* false on success
* @return array|never Array if an error occurred, won't return on success
*/
protected function set_redirect($service)
{
@ -854,6 +855,6 @@ class oauth extends base
redirect($service->getAuthorizationUri($parameters), false, true);
return false;
return []; // Never reached
}
}

View file

@ -263,7 +263,7 @@ class token_storage implements TokenStorageInterface
$data['session_id'] = $this->user->data['session_id'];
}
return $this->get_state_row($data);
return $this->get_state_row($data)['oauth_state'] ?? '';
}
/**
@ -519,7 +519,7 @@ class token_storage implements TokenStorageInterface
*
* @param array $data The SQL WHERE data
* @return array|false array with the OAuth state row,
* false if the state does not exist
* false if the state does not exist
*/
protected function get_state_row($data)
{

View file

@ -25,8 +25,8 @@ interface provider_interface
* Changing to an authentication provider will not be permitted in acp_board
* if there is an error.
*
* @return boolean|string False if the user is identified, otherwise an
* error message, or null if not implemented.
* @return bool|string|void False if the user is identified, otherwise an
* error message, or void if not implemented.
*/
public function init();
@ -52,8 +52,8 @@ interface provider_interface
/**
* Autologin function
*
* @return array|null containing the user row, empty if no auto login
* should take place, or null if not implemented.
* @return array|void containing the user row, empty if no auto login
* should take place, or void if not implemented.
*/
public function autologin();
@ -61,7 +61,7 @@ interface provider_interface
* This function is used to output any required fields in the authentication
* admin panel. It also defines any required configuration table fields.
*
* @return array|null Returns null if not implemented or an array of the
* @return array|void Returns void if not implemented or an array of the
* configuration fields of the provider.
*/
public function acp();
@ -74,7 +74,7 @@ interface provider_interface
*
* @param \phpbb\config\config $new_config Contains the new configuration values
* that have been set in acp_board.
* @return array|null Returns null if not implemented or an array with
* @return array|void Returns void if not implemented or an array with
* the template file name and an array of the vars
* that the template needs that must conform to the
* following example:
@ -107,8 +107,8 @@ interface provider_interface
* Returns an array of data necessary to build custom elements on the login
* form.
*
* @return array|null If this function is not implemented on an auth
* provider then it returns null. If it is implemented
* @return array|void If this function is not implemented on an auth
* provider then it returns void. If it is implemented
* it will return an array of up to four elements of
* which only 'TEMPLATE_FILE'. If 'BLOCK_VAR_NAME' is
* present then 'BLOCK_VARS' must also be present in
@ -139,8 +139,8 @@ interface provider_interface
* into phpBB.
*
* @param array $user
* @return boolean true if the given user is authenticated, false if the
* session should be closed, or null if not implemented.
* @return bool|void true if the given user is authenticated, false if the
* session should be closed, or void if not implemented.
*/
public function validate_session($user);
@ -152,7 +152,7 @@ interface provider_interface
* @param array $login_link_data Any data needed to link a phpBB account to
* an external account.
* @return string|null Returns a string with a language constant if there
* is data missing or null if there is no error.
* is data missing or void if there is no error.
*/
public function login_link_has_necessary_data(array $login_link_data);
@ -171,8 +171,8 @@ interface provider_interface
* defaults to 0, which is not a valid ID. The method
* should fall back to the current user's ID in this
* case.
* @return array|null If this function is not implemented on an auth
* provider then it returns null. If it is implemented
* @return array|void If this function is not implemented on an auth
* provider then it returns void. If it is implemented
* it will return an array of up to four elements of
* which only 'TEMPLATE_FILE'. If 'BLOCK_VAR_NAME' is
* present then 'BLOCK_VARS' must also be present in

View file

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

View file

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

View file

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

View file

@ -38,39 +38,25 @@ class apcu extends \phpbb\cache\driver\memory
}
/**
* Fetch an item from the cache
*
* @access protected
* @param string $var Cache key
* @return mixed Cached data
* {@inheritDoc}
*/
function _read($var)
protected function _read(string $var)
{
return apcu_fetch($this->key_prefix . $var);
}
/**
* Store data in the cache
*
* @access protected
* @param string $var Cache key
* @param mixed $data Data to store
* @param int $ttl Time-to-live of cached data
* @return bool True if the operation succeeded
* {@inheritDoc}
*/
function _write($var, $data, $ttl = 2592000)
protected function _write(string $var, $data, int $ttl = 2592000): bool
{
return apcu_store($this->key_prefix . $var, $data, $ttl);
}
/**
* Remove an item from the cache
*
* @access protected
* @param string $var Cache key
* @return bool True if the operation succeeded
*/
function _delete($var)
* {@inheritDoc}
*/
protected function _delete(string $var): bool
{
return apcu_delete($this->key_prefix . $var);
}

View file

@ -199,7 +199,7 @@ abstract class base implements \phpbb\cache\driver\driver_interface
*
* @param string $dir Directory to remove
*
* @return null
* @return void
*/
protected function remove_dir($dir)
{
@ -231,4 +231,13 @@ abstract class base implements \phpbb\cache\driver\driver_interface
@rmdir($dir);
}
/**
* Fetch an item from the cache
*
* @param string $var Cache key
*
* @return mixed Cached data
*/
abstract protected function _read(string $var);
}

View file

@ -95,7 +95,7 @@ interface driver_interface
*
* @param string $query SQL query
*
* @return int|bool Query ID (integer) if cache contains a rowset
* @return string|false Query ID (md5 of query) if cache contains a rowset
* for the specified query.
* False otherwise.
*/

View file

@ -95,6 +95,14 @@ class dummy extends \phpbb\cache\driver\base
return false;
}
/**
* {@inheritDoc}
*/
protected function _read(string $var)
{
return false;
}
/**
* {@inheritDoc}
*/

View file

@ -331,17 +331,13 @@ class file extends \phpbb\cache\driver\base
}
/**
* Read cached data from a specified file
*
* @access private
* @param string $filename Filename to write
* @return mixed False if an error was encountered, otherwise the data type of the cached data
*/
function _read($filename)
* {@inheritDoc}
*/
protected function _read(string $var)
{
global $phpEx;
$filename = $this->clean_varname($filename);
$filename = $this->clean_varname($var);
$file = "{$this->cache_dir}$filename.$phpEx";
$type = substr($filename, 0, strpos($filename, '_'));

View file

@ -37,7 +37,7 @@ if (!defined('PHPBB_ACM_MEMCACHED'))
/**
* ACM for Memcached
*/
class memcached extends \phpbb\cache\driver\memory
class memcached extends memory
{
/** @var string Extension to use */
protected $extension = 'memcached';
@ -107,26 +107,17 @@ class memcached extends \phpbb\cache\driver\memory
}
/**
* Fetch an item from the cache
*
* @param string $var Cache key
*
* @return mixed Cached data
*/
protected function _read($var)
* {@inheritDoc}
*/
protected function _read(string $var)
{
return $this->memcached->get($this->key_prefix . $var);
}
/**
* Store data in the cache
*
* @param string $var Cache key
* @param mixed $data Data to store
* @param int $ttl Time-to-live of cached data
* @return bool True if the operation succeeded
* {@inheritDoc}
*/
protected function _write($var, $data, $ttl = 2592000)
protected function _write(string $var, $data, int $ttl = 2592000): bool
{
if (!$this->memcached->replace($this->key_prefix . $var, $data, $ttl))
{
@ -136,12 +127,9 @@ class memcached extends \phpbb\cache\driver\memory
}
/**
* Remove an item from the cache
*
* @param string $var Cache key
* @return bool True if the operation succeeded
* {@inheritDoc}
*/
protected function _delete($var)
protected function _delete(string $var): bool
{
return $this->memcached->delete($this->key_prefix . $var);
}

View file

@ -270,13 +270,33 @@ abstract class memory extends \phpbb\cache\driver\base
/**
* Check if a cache var exists
*
* @access protected
* @param string $var Cache key
*
* @return bool True if it exists, otherwise false
*/
function _isset($var)
protected function _isset(string $var): bool
{
// Most caches don't need to check
return true;
}
/**
* Remove an item from the cache
*
* @param string $var Cache key
*
* @return bool True if the operation succeeded
*/
abstract protected function _delete(string $var): bool;
/**
* Store data in the cache
*
* @param string $var Cache key
* @param mixed $data Data to store
* @param int $ttl Time-to-live of cached data
*
* @return bool True if the operation succeeded
*/
abstract protected function _write(string $var, $data, int $ttl = 2592000): bool;
}

View file

@ -115,27 +115,17 @@ class redis extends \phpbb\cache\driver\memory
}
/**
* Fetch an item from the cache
*
* @access protected
* @param string $var Cache key
* @return mixed Cached data
*/
function _read($var)
* {@inheritDoc}
*/
protected function _read(string $var)
{
return $this->redis->get($var);
}
/**
* Store data in the cache
*
* @access protected
* @param string $var Cache key
* @param mixed $data Data to store
* @param int $ttl Time-to-live of cached data
* @return bool True if the operation succeeded
* {@inheritDoc}
*/
function _write($var, $data, $ttl = 2592000)
protected function _write(string $var, $data, int $ttl = 2592000): bool
{
if ($ttl == 0)
{
@ -145,13 +135,9 @@ class redis extends \phpbb\cache\driver\memory
}
/**
* Remove an item from the cache
*
* @access protected
* @param string $var Cache key
* @return bool True if the operation succeeded
*/
function _delete($var)
* {@inheritDoc}
*/
protected function _delete(string $var): bool
{
if ($this->redis->delete($var) > 0)
{

View file

@ -31,13 +31,9 @@ class wincache extends \phpbb\cache\driver\memory
}
/**
* Fetch an item from the cache
*
* @access protected
* @param string $var Cache key
* @return mixed Cached data
*/
function _read($var)
* {@inheritDoc}
*/
protected function _read(string $var)
{
$success = false;
$result = wincache_ucache_get($this->key_prefix . $var, $success);
@ -46,27 +42,17 @@ class wincache extends \phpbb\cache\driver\memory
}
/**
* Store data in the cache
*
* @access protected
* @param string $var Cache key
* @param mixed $data Data to store
* @param int $ttl Time-to-live of cached data
* @return bool True if the operation succeeded
* {@inheritDoc}
*/
function _write($var, $data, $ttl = 2592000)
protected function _write(string $var, $data, int $ttl = 2592000): bool
{
return wincache_ucache_set($this->key_prefix . $var, $data, $ttl);
}
/**
* Remove an item from the cache
*
* @access protected
* @param string $var Cache key
* @return bool True if the operation succeeded
*/
function _delete($var)
* {@inheritDoc}
*/
protected function _delete(string $var): bool
{
return wincache_ucache_delete($this->key_prefix . $var);
}

View file

@ -41,7 +41,7 @@ class factory
* Return a new instance of a given plugin
*
* @param $name
* @return object
* @return object|null
*/
public function get_instance($name)
{

View file

@ -1653,6 +1653,8 @@ class gd
),
),
);
/** @var 1|2|3 $config['captcha_gd_fonts'] */
return array(
'width' => 9,
'height' => 15,

View file

@ -205,7 +205,7 @@ class gd_wave
$x_index_old = intval(($x - 1) / $subdivision_factor);
$x_index_new = intval($x / $subdivision_factor);
if (!empty($plane[$y_index_new][$x_index_new]))
if ($plane[$y_index_new][$x_index_new])
{
$img_pos_cur[1] += $this->wave_height($x, $y, $subdivision_factor, 1) - 30 - $cur_height;
$color = $colors[20];
@ -213,10 +213,10 @@ class gd_wave
$img_pos_cur[1] = min($img_pos_cur[1], $img_y - 1);
$img_buffer[$buffer_cur][$x] = $img_pos_cur;
// Smooth the edges as much as possible by having not more than one low<->high traingle per square
// Smooth the edges as much as possible by having not more than one low<->high triangle per square
// Otherwise, just
$diag_down = (empty($plane[$y_index_old][$x_index_old]) == empty($plane[$y_index_new][$x_index_new]));
$diag_up = (empty($plane[$y_index_old][$x_index_new]) == empty($plane[$y_index_new][$x_index_old]));
$diag_down = !$plane[$y_index_old][$x_index_old] && !$plane[$y_index_new][$x_index_new];
$diag_up = !$plane[$y_index_old][$x_index_new] && !$plane[$y_index_new][$x_index_old];
// natural switching
$mode = ($x + $y) & 1;

View file

@ -75,7 +75,7 @@ abstract class captcha_abstract
if (!$this->load_code())
{
// invalid request, bail out
return false;
return;
}
}
$generator = $this->get_generator_class();

View file

@ -39,6 +39,9 @@ class qa
*/
protected $service_name;
/** @var int Question ID */
protected $question = -1;
/**
* Constructor
*
@ -450,7 +453,7 @@ class qa
'session_id' => (string) $user->session_id,
'lang_iso' => (string) $this->question_lang,
'confirm_type' => (int) $this->type,
'question_id' => (int) $this->question,
'question_id' => $this->question,
));
$db->sql_query($sql);
@ -473,7 +476,7 @@ class qa
$this->solved = 0;
$sql = 'UPDATE ' . $this->table_qa_confirm . '
SET question_id = ' . (int) $this->question . "
SET question_id = ' . $this->question . "
WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "'
AND session_id = '" . $db->sql_escape($user->session_id) . "'";
$db->sql_query($sql);
@ -493,7 +496,7 @@ class qa
$this->solved = 0;
$sql = 'UPDATE ' . $this->table_qa_confirm . '
SET question_id = ' . (int) $this->question . ",
SET question_id = ' . $this->question . ",
attempts = attempts + 1
WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "'
AND session_id = '" . $db->sql_escape($user->session_id) . "'";
@ -553,7 +556,7 @@ class qa
if ($row)
{
$this->question = $row['question_id'];
$this->question = (int) $row['question_id'];
$this->attempts = $row['attempts'];
$this->question_strict = $row['strict'];
@ -576,7 +579,7 @@ class qa
$sql = 'SELECT answer_text
FROM ' . $this->table_captcha_answers . '
WHERE question_id = ' . (int) $this->question;
WHERE question_id = ' . $this->question;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
@ -1034,7 +1037,8 @@ class qa
{
return true;
}
return false;
}
return false;
}
}

View file

@ -18,18 +18,4 @@ namespace phpbb\composer\exception;
*/
class managed_with_clean_error_exception extends managed_with_error_exception
{
/**
* Constructor
*
* @param string $prefix The language string prefix
* @param string $message The Exception message to throw (must be a language variable).
* @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($prefix, $message = '', array $parameters = [], \Exception $previous = null, $code = 0)
{
parent::__construct($prefix . $message, $parameters, $previous, $code);
}
}

View file

@ -18,18 +18,4 @@ namespace phpbb\composer\exception;
*/
class managed_with_enable_error_exception extends managed_with_error_exception
{
/**
* Constructor
*
* @param string $prefix The language string prefix
* @param string $message The Exception message to throw (must be a language variable).
* @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($prefix, $message = '', array $parameters = [], \Exception $previous = null, $code = 0)
{
parent::__construct($prefix . $message, $parameters, $previous, $code);
}
}

View file

@ -18,18 +18,4 @@ namespace phpbb\composer\exception;
*/
class managed_with_error_exception extends runtime_exception
{
/**
* Constructor
*
* @param string $prefix The language string prefix
* @param string $message The Exception message to throw (must be a language variable).
* @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($prefix, $message = '', array $parameters = [], \Exception $previous = null, $code = 0)
{
parent::__construct($prefix . $message, $parameters, $previous, $code);
}
}

View file

@ -29,7 +29,7 @@ use phpbb\filesystem\filesystem;
class extension_manager extends manager
{
/**
* @var manager
* @var ext_manager
*/
protected $extension_manager;
@ -102,7 +102,8 @@ class extension_manager extends manager
{
if ($this->enable_on_install)
{
$io->writeError([['ENABLING_EXTENSIONS', [], 1]], true);
/** @psalm-suppress InvalidArgument */
$io->writeError([['ENABLING_EXTENSIONS', [], 1]]);
foreach ($packages as $package => $version)
{
try
@ -111,11 +112,13 @@ class extension_manager extends manager
}
catch (\phpbb\exception\runtime_exception $e)
{
$io->writeError([[$e->getMessage(), $e->get_parameters(), 4]], true);
/** @psalm-suppress InvalidArgument */
$io->writeError([[$e->getMessage(), $e->get_parameters(), 4]]);
}
catch (\Exception $e)
{
$io->writeError([[$e->getMessage(), [], 4]], true);
/** @psalm-suppress InvalidArgument */
$io->writeError([[$e->getMessage(), [], 4]]);
}
}
}
@ -126,7 +129,8 @@ class extension_manager extends manager
*/
protected function pre_update(array $packages, IOInterface $io = null)
{
$io->writeError([['DISABLING_EXTENSIONS', [], 1]], true);
/** @psalm-suppress InvalidArgument */
$io->writeError([['DISABLING_EXTENSIONS', [], 1]]);
$this->enabled_extensions = [];
foreach ($packages as $package => $version)
{
@ -140,11 +144,13 @@ class extension_manager extends manager
}
catch (\phpbb\exception\runtime_exception $e)
{
$io->writeError([[$e->getMessage(), $e->get_parameters(), 4]], true);
/** @psalm-suppress InvalidArgument */
$io->writeError([[$e->getMessage(), $e->get_parameters(), 4]]);
}
catch (\Exception $e)
{
$io->writeError([[$e->getMessage(), [], 4]], true);
/** @psalm-suppress InvalidArgument */
$io->writeError([[$e->getMessage(), [], 4]]);
}
}
}
@ -154,7 +160,8 @@ class extension_manager extends manager
*/
protected function post_update(array $packages, IOInterface $io = null)
{
$io->writeError([['ENABLING_EXTENSIONS', [], 1]], true);
/** @psalm-suppress InvalidArgument */
$io->writeError([['ENABLING_EXTENSIONS', [], 1]]);
foreach ($this->enabled_extensions as $package)
{
try
@ -163,11 +170,13 @@ class extension_manager extends manager
}
catch (\phpbb\exception\runtime_exception $e)
{
$io->writeError([[$e->getMessage(), $e->get_parameters(), 4]], true);
/** @psalm-suppress InvalidArgument */
$io->writeError([[$e->getMessage(), $e->get_parameters(), 4]]);
}
catch (\Exception $e)
{
$io->writeError([[$e->getMessage(), [], 4]], true);
/** @psalm-suppress InvalidArgument */
$io->writeError([[$e->getMessage(), [], 4]]);
}
}
}
@ -195,7 +204,8 @@ class extension_manager extends manager
{
if ($this->purge_on_remove)
{
$io->writeError([['DISABLING_EXTENSIONS', [], 1]], true);
/** @psalm-suppress InvalidArgument */
$io->writeError([['DISABLING_EXTENSIONS', [], 1]]);
}
foreach ($packages as $package => $version)
@ -216,11 +226,13 @@ class extension_manager extends manager
}
catch (\phpbb\exception\runtime_exception $e)
{
$io->writeError([[$e->getMessage(), $e->get_parameters(), 4]], true);
/** @psalm-suppress InvalidArgument */
$io->writeError([[$e->getMessage(), $e->get_parameters(), 4]]);
}
catch (\Exception $e)
{
$io->writeError([[$e->getMessage(), [], 4]], true);
/** @psalm-suppress InvalidArgument */
$io->writeError([[$e->getMessage(), [], 4]]);
}
}
}
@ -244,7 +256,8 @@ class extension_manager extends manager
if ($this->extension_manager->is_enabled($package))
{
$enabled = true;
$io->writeError([['DISABLING_EXTENSIONS', [], 1]], true);
/** @psalm-suppress InvalidArgument */
$io->writeError([['DISABLING_EXTENSIONS', [], 1]]);
$this->extension_manager->disable($package);
}
@ -279,7 +292,8 @@ class extension_manager extends manager
{
try
{
$io->writeError([['ENABLING_EXTENSIONS', [], 1]], true);
/** @psalm-suppress InvalidArgument */
$io->writeError([['ENABLING_EXTENSIONS', [], 1]]);
$this->extension_manager->enable($package);
}
catch (\Exception $e)

View file

@ -147,11 +147,12 @@ class installer
* @param array $packages Packages to install.
* Each entry may be a name or an array associating a version constraint to a name
* @param array $whitelist White-listed packages (packages that can be installed/updated/removed)
* @param IOInterface|null $io IO object used for the output
* @param io\io_interface|null $io IO object used for the output
*
* @throws runtime_exception
* @throws JsonValidationException
*/
protected function do_install(array $packages, $whitelist, IOInterface $io = null)
protected function do_install(array $packages, $whitelist, io\io_interface $io = null)
{
if (!$io)
{
@ -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)
{

View file

@ -57,11 +57,11 @@ interface manager_interface
/**
* Tells whether or not a package is managed by Composer.
*
* @param string $packages Package name
* @param string $package Package name
*
* @return bool
*/
public function is_managed($packages);
public function is_managed($package);
/**
* Returns the list of managed packages for the current type

View file

@ -20,7 +20,7 @@ class config implements \ArrayAccess, \IteratorAggregate, \Countable
{
/**
* The configuration data
* @var array<string,string>
* @var array<string,int|string>
*/
protected $config;
@ -59,7 +59,7 @@ class config implements \ArrayAccess, \IteratorAggregate, \Countable
* Retrieves a configuration value.
*
* @param string $key The configuration option's name.
* @return string The configuration value
* @return int|string The configuration value
*/
public function offsetGet($key)
{
@ -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)
{

View file

@ -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)
{

View file

@ -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()
{

View file

@ -14,18 +14,10 @@
namespace phpbb\console;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Shell;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class application extends \Symfony\Component\Console\Application
{
/**
* @var bool Indicates whether or not we are in a shell
*/
protected $in_shell = false;
/**
* @var \phpbb\config\config Config object
*/
@ -62,41 +54,6 @@ class application extends \Symfony\Component\Console\Application
return $input_definition;
}
/**
* Gets the help message.
*
* It's a hack of the default help message to display the --shell
* option only for the application and not for all the commands.
*
* @return string A help message.
*/
public function getHelp()
{
// If we are already in a shell
// we do not want to have the --shell option available
if ($this->in_shell)
{
return parent::getHelp();
}
try
{
$definition = $this->getDefinition();
$definition->addOption(new InputOption(
'--shell',
'-s',
InputOption::VALUE_NONE,
$this->language->lang('CLI_DESCRIPTION_OPTION_SHELL')
));
}
catch (\LogicException $e)
{
// Do nothing
}
return parent::getHelp();
}
/**
* Register a set of commands from the container
*
@ -118,25 +75,6 @@ class application extends \Symfony\Component\Console\Application
}
}
/**
* {@inheritdoc}
*/
public function doRun(InputInterface $input, OutputInterface $output)
{
// Run a shell if the --shell (or -s) option is set and if no command name is specified
// Also, we do not want to have the --shell option available if we are already in a shell
if (!$this->in_shell && $this->getCommandName($input) === null && $input->hasParameterOption(array('--shell', '-s')))
{
$shell = new Shell($this);
$this->in_shell = true;
$shell->run();
return 0;
}
return parent::doRun($input, $output);
}
/**
* Register global options
*

View file

@ -45,7 +45,7 @@ class run extends \phpbb\console\command\command
/**
* Sets the command name and description
*
* @return null
* @return void
*/
protected function configure()
{

View file

@ -49,7 +49,7 @@ class install extends \phpbb\console\command\command
/**
* Sets the command name and description
*
* @return null
* @return void
*/
protected function configure()
{

View file

@ -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()
{

View file

@ -48,7 +48,7 @@ class manage extends \phpbb\console\command\command
/**
* Sets the command name and description
*
* @return null
* @return void
*/
protected function configure()
{

View file

@ -49,7 +49,7 @@ class remove extends \phpbb\console\command\command
/**
* Sets the command name and description
*
* @return null
* @return void
*/
protected function configure()
{

View file

@ -46,7 +46,7 @@ class update extends \phpbb\console\command\command
/**
* Sets the command name and description
*
* @return null
* @return void
*/
protected function configure()
{

View file

@ -101,7 +101,7 @@ class update_hashes extends \phpbb\console\command\command
while ($row = $this->db->sql_fetchrow($result))
{
$old_hash = preg_replace('/^\$CP\$/', '', $row['user_password']);
$new_hash = $this->passwords_manager->hash($old_hash, array($this->default_type));
$new_hash = $this->passwords_manager->hash($old_hash, [$this->default_type]);
$sql = 'UPDATE ' . USERS_TABLE . "
SET user_password = '" . $this->db->sql_escape($new_hash) . "'

View file

@ -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()
{

View file

@ -79,7 +79,7 @@ class reparse extends \phpbb\console\command\command
/**
* Sets the command name and description
*
* @return null
* @return void
*/
protected function configure()
{

View file

@ -55,7 +55,7 @@ class delete extends \phpbb\console\command\command
/**
* Sets the command name and description
*
* @return null
* @return void
*/
protected function configure()
{

View file

@ -72,7 +72,7 @@ class generate extends \phpbb\console\command\command
/**
* Sets the command name and description
*
* @return null
* @return void
*/
protected function configure()
{

View file

@ -22,7 +22,7 @@ class recreate extends \phpbb\console\command\command
/**
* Sets the command name and description
*
* @return null
* @return void
*/
protected function configure()
{

View file

@ -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()
{

View file

@ -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)
{

View file

@ -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)
{

View file

@ -76,7 +76,7 @@ class delete extends command
/**
* Sets the command name and description
*
* @return null
* @return void
*/
protected function configure()
{

View file

@ -55,7 +55,7 @@ class reclean extends command
/**
* Sets the command name and description
*
* @return null
* @return void
*/
protected function configure()
{

View file

@ -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)
{

View file

@ -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)

View file

@ -164,7 +164,7 @@ class manager
* Web runner uses this method to resolve names to tasks.
*
* @param string $name Name of the task to look up.
* @return wrapper A wrapped task corresponding to the given name, or null.
* @return wrapper|null A wrapped task corresponding to the given name, or null.
*/
public function find_task($name)
{

View file

@ -46,7 +46,7 @@ class prune_all_forums extends \phpbb\cron\task\base
/**
* Runs this cron task.
*
* @return null
* @return void
*/
public function run()
{

View file

@ -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)
{

View file

@ -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)
{
@ -166,7 +166,8 @@ class prune_shadow_topics extends \phpbb\cron\task\base implements \phpbb\cron\t
* @param int $prune_flags Prune flags
* @param int $prune_days Prune date in days
* @param int $prune_freq Prune frequency
* @return null
*
* @return void
*/
protected function auto_prune_shadow_topics($forum_id, $prune_mode, $prune_flags, $prune_days, $prune_freq)
{
@ -194,7 +195,5 @@ class prune_shadow_topics extends \phpbb\cron\task\base implements \phpbb\cron\t
$this->log->add('admin', $user_id, $user_ip, 'LOG_PRUNE_SHADOW', false, array($row['forum_name']));
}
return;
}
}

View file

@ -42,7 +42,7 @@ class queue extends \phpbb\cron\task\base
/**
* Runs this cron task.
*
* @return null
* @return void
*/
public function run()
{

View file

@ -36,7 +36,7 @@ class tidy_cache extends \phpbb\cron\task\base
/**
* Runs this cron task.
*
* @return null
* @return void
*/
public function run()
{

View file

@ -39,7 +39,7 @@ class tidy_database extends \phpbb\cron\task\base
/**
* Runs this cron task.
*
* @return null
* @return void
*/
public function run()
{

View file

@ -59,7 +59,7 @@ class tidy_search extends base
/**
* Runs this cron task.
*
* @return null
* @return void
*/
public function run()
{

View file

@ -36,7 +36,7 @@ class tidy_sessions extends \phpbb\cron\task\base
/**
* Runs this cron task.
*
* @return null
* @return void
*/
public function run()
{

View file

@ -41,7 +41,7 @@ class tidy_warnings extends \phpbb\cron\task\base
/**
* Runs this cron task.
*
* @return null
* @return void
*/
public function run()
{

View file

@ -107,7 +107,7 @@ class update_hashes extends \phpbb\cron\task\base
while ($row = $this->db->sql_fetchrow($result))
{
$old_hash = preg_replace('/^\$CP\$/', '', $row['user_password']);
$new_hash = $this->passwords_manager->hash($old_hash, array($this->default_type));
$new_hash = $this->passwords_manager->hash($old_hash, [$this->default_type]);
// Increase number so we know that users were selected from the database
$affected_rows++;

View file

@ -91,7 +91,7 @@ class wrapper
{
$params = [];
$params['cron_type'] = $this->get_name();
if ($this->is_parametrized())
if ($this->task instanceof parametrized)
{
$params = array_merge($params, $this->task->get_parameters());
}
@ -113,7 +113,7 @@ class wrapper
$this->template->assign_var('CRON_TASK_URL', $this->get_url());
return $this->template->assign_display('cron_html_tag');
return (string) $this->template->assign_display('cron_html_tag');
}
/**

View file

@ -68,7 +68,7 @@ class connection implements DriverConnection
/**
* {@inheritDoc}
*/
public function lastInsertId($name = null): ?string
public function lastInsertId($name = null)
{
return $this->wrapped->lastInsertId($name);
}

View file

@ -22,6 +22,7 @@ class table_helper
* @param array $column_data Column data.
*
* @return array<string, array> A pair of type and array of column options.
* @psalm-return array{string, array}
*/
public static function convert_column_data(array $column_data, string $dbms_layer): array
{

View file

@ -55,6 +55,7 @@ class type_converter
* @param string $type Legacy type name
*
* @return array<string, array> Pair of type name and options.
* @psalm-return array{string, array}
*/
public static function convert(string $type, string $dbms): array
{
@ -73,7 +74,7 @@ class type_converter
* @param string $type Legacy type name.
* @param int $length Type length.
*
* @return array<string, array> Pair of type name and options.
* @return array{string, array} Pair of type name and options.
*/
private static function mapWithLength(string $type, int $length): array
{
@ -107,7 +108,7 @@ class type_converter
*
* @param string $type Type name.
*
* @return array<string, array> Pair of type name and an array of options.
* @return array{string, array} Pair of type name and an array of options.
*/
private static function mapType(string $type, string $dbms): array
{

Some files were not shown because too many files have changed in this diff Show more