[ticket/11981] Fix code sniffer complaints

PHPBB3-11981
This commit is contained in:
Marc Alexander 2013-10-28 22:27:25 +01:00
parent 2afd47b938
commit 7f58a4572e
30 changed files with 70 additions and 65 deletions

View file

@ -94,29 +94,29 @@ class acp_database
case 'mysqli':
case 'mysql4':
case 'mysql':
$extractor = new mysql_extractor($download, $store, $format, $filename, $time);
$extractor = new mysql_extractor($format, $filename, $time, $download, $store);
break;
case 'sqlite':
$extractor = new sqlite_extractor($download, $store, $format, $filename, $time);
$extractor = new sqlite_extractor($format, $filename, $time, $download, $store);
break;
case 'postgres':
$extractor = new postgres_extractor($download, $store, $format, $filename, $time);
$extractor = new postgres_extractor($format, $filename, $time, $download, $store);
break;
case 'oracle':
$extractor = new oracle_extractor($download, $store, $format, $filename, $time);
$extractor = new oracle_extractor($format, $filename, $time, $download, $store);
break;
case 'mssql':
case 'mssql_odbc':
case 'mssqlnative':
$extractor = new mssql_extractor($download, $store, $format, $filename, $time);
$extractor = new mssql_extractor($format, $filename, $time, $download, $store);
break;
case 'firebird':
$extractor = new firebird_extractor($download, $store, $format, $filename, $time);
$extractor = new firebird_extractor($format, $filename, $time, $download, $store);
break;
}
@ -488,7 +488,7 @@ class base_extractor
var $format;
var $run_comp = false;
function base_extractor($download = false, $store = false, $format, $filename, $time)
function base_extractor($format, $filename, $time, $download = false, $store = false)
{
global $request;

View file

@ -888,7 +888,11 @@ class acp_styles
protected function list_style(&$style, $level)
{
// Mark row as shown
if (!empty($style['_shown'])) return;
if (!empty($style['_shown']))
{
return;
}
$style['_shown'] = true;
// Generate template variables

View file

@ -506,7 +506,7 @@ class auth_admin extends \phpbb\auth\auth
'FORUM_ID' => $forum_id)
);
$this->assign_cat_array($ug_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id, $show_trace, ($mode == 'view'));
$this->assign_cat_array($ug_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id, ($mode == 'view'), $show_trace);
unset($content_array[$ug_id]);
}
@ -593,7 +593,7 @@ class auth_admin extends \phpbb\auth\auth
'FORUM_ID' => $forum_id)
);
$this->assign_cat_array($forum_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id, $show_trace, ($mode == 'view'));
$this->assign_cat_array($forum_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id, ($mode == 'view'), $show_trace);
}
unset($hold_ary[$ug_id], $ug_names_ary[$ug_id]);
@ -1099,7 +1099,7 @@ class auth_admin extends \phpbb\auth\auth
* Assign category to template
* used by display_mask()
*/
function assign_cat_array(&$category_array, $tpl_cat, $tpl_mask, $ug_id, $forum_id, $show_trace = false, $s_view)
function assign_cat_array(&$category_array, $tpl_cat, $tpl_mask, $ug_id, $forum_id, $s_view, $show_trace = false)
{
global $template, $user, $phpbb_admin_path, $phpEx, $phpbb_container;

View file

@ -184,7 +184,7 @@ class captcha
for ($x = 1; $x <= $full_x; ++$x)
{
$cur_height = $this->wave_height($x, $y, $subdivision_factor) + $this->grid_height($x, $y, 1, $x_grid, $y_grid);
$cur_height = $this->wave_height($x, $y, $subdivision_factor) + $this->grid_height($x, $y, $x_grid, $y_grid, 1);
// height is a z-factor, not a y-factor
$offset = $cur_height - $prev_height;
@ -264,7 +264,7 @@ class captcha
return ((sin($x / (3 * $factor)) + sin($y / (3 * $factor))) * 10 * $tweak);
}
function grid_height($x, $y, $factor = 1, $x_grid, $y_grid)
function grid_height($x, $y, $x_grid, $y_grid, $factor = 1)
{
return ((!($x % ($x_grid * $factor)) || !($y % ($y_grid * $factor))) ? 3 : 0);
}

View file

@ -46,7 +46,7 @@ class compress
if (is_file($phpbb_root_path . $src))
{
$this->data($src_path, file_get_contents("$phpbb_root_path$src"), false, stat("$phpbb_root_path$src"));
$this->data($src_path, file_get_contents("$phpbb_root_path$src"), stat("$phpbb_root_path$src"), false);
}
else if (is_dir($phpbb_root_path . $src))
{
@ -86,7 +86,7 @@ class compress
continue;
}
$this->data("$src_path$path$file", file_get_contents("$phpbb_root_path$src$path$file"), false, stat("$phpbb_root_path$src$path$file"));
$this->data("$src_path$path$file", file_get_contents("$phpbb_root_path$src$path$file"), stat("$phpbb_root_path$src$path$file"), false);
}
}
}
@ -109,7 +109,7 @@ class compress
return false;
}
$this->data($filename, file_get_contents($src), false, stat($src));
$this->data($filename, file_get_contents($src), stat($src), false);
return true;
}
@ -123,7 +123,7 @@ class compress
$stat[4] = $stat[5] = 0;
$stat[7] = strlen($src);
$stat[9] = time();
$this->data($name, $src, false, $stat);
$this->data($name, $src, $stat, false);
return true;
}
@ -395,7 +395,7 @@ class compress_zip extends compress
/**
* Create the structures ... note we assume version made by is MSDOS
*/
function data($name, $data, $is_dir = false, $stat)
function data($name, $data, $stat, $is_dir = false)
{
$name = str_replace('\\', '/', $name);
$name = $this->unique_filename($name);
@ -669,7 +669,7 @@ class compress_tar extends compress
/**
* Create the structures
*/
function data($name, $data, $is_dir = false, $stat)
function data($name, $data, $stat, $is_dir = false)
{
$name = $this->unique_filename($name);
$this->wrote = true;

View file

@ -1414,7 +1414,7 @@ class smtp_class
$result = false;
$stream_meta = stream_get_meta_data($this->socket);
if (socket_set_blocking($this->socket, 1));
if (socket_set_blocking($this->socket, 1))
{
$result = stream_socket_enable_crypto($this->socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
socket_set_blocking($this->socket, (int) $stream_meta['blocked']);

View file

@ -78,9 +78,9 @@ class ucp_notifications
trigger_error($message);
}
$this->output_notification_methods('notification_methods', $phpbb_notifications, $template, $user);
$this->output_notification_methods($phpbb_notifications, $template, $user, 'notification_methods');
$this->output_notification_types($subscriptions, 'notification_types', $phpbb_notifications, $template, $user);
$this->output_notification_types($subscriptions, $phpbb_notifications, $template, $user, 'notification_types');
$this->tpl_name = 'ucp_notifications';
$this->page_title = 'UCP_NOTIFICATION_OPTIONS';
@ -162,12 +162,12 @@ class ucp_notifications
/**
* Output all the notification types to the template
*
* @param string $block
* @param \phpbb\notification\manager $phpbb_notifications
* @param \phpbb\template\template $template
* @param \phpbb\user $user
* @param string $block
*/
public function output_notification_types($subscriptions, $block = 'notification_types', \phpbb\notification\manager $phpbb_notifications, \phpbb\template\template $template, \phpbb\user $user)
public function output_notification_types($subscriptions, \phpbb\notification\manager $phpbb_notifications, \phpbb\template\template $template, \phpbb\user $user, $block = 'notification_types')
{
$notification_methods = $phpbb_notifications->get_subscription_methods();
@ -209,12 +209,12 @@ class ucp_notifications
/**
* Output all the notification methods to the template
*
* @param string $block
* @param \phpbb\notification\manager $phpbb_notifications
* @param \phpbb\template\template $template
* @param \phpbb\user $user
* @param string $block
*/
public function output_notification_methods($block = 'notification_methods', \phpbb\notification\manager $phpbb_notifications, \phpbb\template\template $template, \phpbb\user $user)
public function output_notification_methods(\phpbb\notification\manager $phpbb_notifications, \phpbb\template\template $template, \phpbb\user $user, $block = 'notification_methods')
{
$notification_methods = $phpbb_notifications->get_subscription_methods();

View file

@ -97,7 +97,6 @@ class ldap extends \phpbb\auth\provider\base
@ldap_close($ldap);
if (!is_array($result) || sizeof($result) < 2)
{
return sprintf($this->user->lang['LDAP_NO_IDENTITY'], $this->user->data['username']);

View file

@ -179,7 +179,7 @@ class oauth extends \phpbb\auth\provider\base
$storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table);
$query = 'mode=login&login=external&oauth_service=' . $service_name_original;
$service = $this->get_service($service_name_original, $storage, $service_credentials, $this->service_providers[$service_name]->get_auth_scope(), $query);
$service = $this->get_service($service_name_original, $storage, $service_credentials, $query, $this->service_providers[$service_name]->get_auth_scope());
if ($this->request->is_set('code', \phpbb\request\request_interface::GET))
{
@ -273,13 +273,13 @@ class oauth extends \phpbb\auth\provider\base
* @param string $service_name The name of the service
* @param \phpbb\auth\provider\oauth\token_storage $storage
* @param array $service_credentials {@see \phpbb\auth\provider\oauth\oauth::get_service_credentials}
* @param array $scope The scope of the request against
* the api.
* @param string $query The query string of the
* current_uri used in redirection
* @param array $scope The scope of the request against
* the api.
* @return \OAuth\Common\Service\ServiceInterface
*/
protected function get_service($service_name, \phpbb\auth\provider\oauth\token_storage $storage, array $service_credentials, array $scopes = array(), $query)
protected function get_service($service_name, \phpbb\auth\provider\oauth\token_storage $storage, array $service_credentials, $query, array $scopes = array())
{
$current_uri = $this->get_current_uri($service_name, $query);
@ -458,7 +458,7 @@ class oauth extends \phpbb\auth\provider\base
// Prepare for an authentication request
$service_credentials = $this->service_providers[$service_name]->get_service_credentials();
$scopes = $this->service_providers[$service_name]->get_auth_scope();
$service = $this->get_service(strtolower($link_data['oauth_service']), $storage, $service_credentials, $scopes, $query);
$service = $this->get_service(strtolower($link_data['oauth_service']), $storage, $service_credentials, $query, $scopes);
$this->service_providers[$service_name]->set_external_service_provider($service);
// The user has already authenticated successfully, request to authenticate again
@ -491,7 +491,7 @@ class oauth extends \phpbb\auth\provider\base
$query = 'i=ucp_auth_link&mode=auth_link&link=1&oauth_service=' . strtolower($link_data['oauth_service']);
$service_credentials = $this->service_providers[$service_name]->get_service_credentials();
$scopes = $this->service_providers[$service_name]->get_auth_scope();
$service = $this->get_service(strtolower($link_data['oauth_service']), $storage, $service_credentials, $scopes, $query);
$service = $this->get_service(strtolower($link_data['oauth_service']), $storage, $service_credentials, $query, $scopes);
if ($this->request->is_set('code', \phpbb\request\request_interface::GET))
{

View file

@ -78,7 +78,7 @@ class token_storage implements TokenStorageInterface
{
$service = $this->get_service_name_for_db($service);
if ($this->cachedToken instanceOf TokenInterface)
if ($this->cachedToken instanceof TokenInterface)
{
return $this->cachedToken;
}
@ -238,7 +238,7 @@ class token_storage implements TokenStorageInterface
{
$service = $this->get_service_name_for_db($service);
if ($this->cachedToken instanceOf TokenInterface) {
if ($this->cachedToken instanceof TokenInterface) {
return $this->cachedToken;
}

View file

@ -259,7 +259,7 @@ class mssql extends \phpbb\db\driver\driver
{
foreach ($row as $key => $value)
{
$row[$key] = ($value === ' ' || $value === NULL) ? '' : $value;
$row[$key] = ($value === ' ' || $value === null) ? '' : $value;
}
}

View file

@ -195,7 +195,7 @@ class result_mssqlnative
*/
class mssqlnative extends \phpbb\db\driver\mssql_base
{
var $m_insert_id = NULL;
var $m_insert_id = null;
var $last_query_text = '';
var $query_options = array();
var $connect_error = '';
@ -427,7 +427,7 @@ class mssqlnative extends \phpbb\db\driver\mssql_base
{
foreach ($row as $key => $value)
{
$row[$key] = ($value === ' ' || $value === NULL) ? '' : $value;
$row[$key] = ($value === ' ' || $value === null) ? '' : $value;
}
// remove helper values from LIMIT queries

View file

@ -47,11 +47,11 @@ class mysqli extends \phpbb\db\driver\mysql_base
$this->server = ($this->persistency) ? 'p:' . (($sqlserver) ? $sqlserver : 'localhost') : $sqlserver;
$this->dbname = $database;
$port = (!$port) ? NULL : $port;
$port = (!$port) ? null : $port;
// If port is set and it is not numeric, most likely mysqli socket is set.
// Try to map it to the $socket parameter.
$socket = NULL;
$socket = null;
if ($port)
{
if (is_numeric($port))
@ -61,7 +61,7 @@ class mysqli extends \phpbb\db\driver\mysql_base
else
{
$socket = $port;
$port = NULL;
$port = null;
}
}

View file

@ -328,7 +328,7 @@ class postgres extends \phpbb\db\driver\driver
return false;
}
$temp_result = @pg_fetch_assoc($temp_q_id, NULL);
$temp_result = @pg_fetch_assoc($temp_q_id, null);
@pg_free_result($query_id);
return ($temp_result) ? $temp_result['last_value'] : false;
@ -456,7 +456,7 @@ class postgres extends \phpbb\db\driver\driver
if ($result = @pg_query($this->db_connect_id, "EXPLAIN $explain_query"))
{
while ($row = @pg_fetch_assoc($result, NULL))
while ($row = @pg_fetch_assoc($result, null))
{
$html_table = $this->sql_report('add_select_row', $query, $html_table, $row);
}
@ -476,7 +476,7 @@ class postgres extends \phpbb\db\driver\driver
$endtime = $endtime[0] + $endtime[1];
$result = @pg_query($this->db_connect_id, $query);
while ($void = @pg_fetch_assoc($result, NULL))
while ($void = @pg_fetch_assoc($result, null))
{
// Take the time spent on parsing rows into account
}

View file

@ -34,7 +34,7 @@ class notifications extends \phpbb\db\migration\migration
),
$this->table_prefix . 'notifications' => array(
'COLUMNS' => array(
'notification_id' => array('UINT', NULL, 'auto_increment'),
'notification_id' => array('UINT', null, 'auto_increment'),
'item_type' => array('VCHAR:255', ''),
'item_id' => array('UINT', 0),
'item_parent_id' => array('UINT', 0),

View file

@ -26,7 +26,7 @@ class notifications_schema_fix extends \phpbb\db\migration\migration
'add_tables' => array(
$this->table_prefix . 'notification_types' => array(
'COLUMNS' => array(
'notification_type_id' => array('USINT', NULL, 'auto_increment'),
'notification_type_id' => array('USINT', null, 'auto_increment'),
'notification_type_name' => array('VCHAR:255', ''),
'notification_type_enabled' => array('BOOL', 1),
),
@ -37,7 +37,7 @@ class notifications_schema_fix extends \phpbb\db\migration\migration
),
$this->table_prefix . 'notifications' => array(
'COLUMNS' => array(
'notification_id' => array('UINT:10', NULL, 'auto_increment'),
'notification_id' => array('UINT:10', null, 'auto_increment'),
'notification_type_id' => array('USINT', 0),
'item_id' => array('UINT', 0),
'item_parent_id' => array('UINT', 0),
@ -73,7 +73,7 @@ class notifications_schema_fix extends \phpbb\db\migration\migration
),
$this->table_prefix . 'notifications' => array(
'COLUMNS' => array(
'notification_id' => array('UINT', NULL, 'auto_increment'),
'notification_id' => array('UINT', null, 'auto_increment'),
'item_type' => array('VCHAR:255', ''),
'item_id' => array('UINT', 0),
'item_parent_id' => array('UINT', 0),

View file

@ -56,7 +56,7 @@ class style_update_p2 extends \phpbb\db\migration\migration
'add_tables' => array(
$this->table_prefix . 'styles_imageset' => array(
'COLUMNS' => array(
'imageset_id' => array('UINT', NULL, 'auto_increment'),
'imageset_id' => array('UINT', null, 'auto_increment'),
'imageset_name' => array('VCHAR_UNI:255', ''),
'imageset_copyright' => array('VCHAR_UNI', ''),
'imageset_path' => array('VCHAR:100', ''),
@ -68,7 +68,7 @@ class style_update_p2 extends \phpbb\db\migration\migration
),
$this->table_prefix . 'styles_imageset_data' => array(
'COLUMNS' => array(
'image_id' => array('UINT', NULL, 'auto_increment'),
'image_id' => array('UINT', null, 'auto_increment'),
'image_name' => array('VCHAR:200', ''),
'image_filename' => array('VCHAR:200', ''),
'image_lang' => array('VCHAR:30', ''),
@ -83,7 +83,7 @@ class style_update_p2 extends \phpbb\db\migration\migration
),
$this->table_prefix . 'styles_template' => array(
'COLUMNS' => array(
'template_id' => array('UINT', NULL, 'auto_increment'),
'template_id' => array('UINT', null, 'auto_increment'),
'template_name' => array('VCHAR_UNI:255', ''),
'template_copyright' => array('VCHAR_UNI', ''),
'template_path' => array('VCHAR:100', ''),
@ -112,7 +112,7 @@ class style_update_p2 extends \phpbb\db\migration\migration
),
$this->table_prefix . 'styles_theme' => array(
'COLUMNS' => array(
'theme_id' => array('UINT', NULL, 'auto_increment'),
'theme_id' => array('UINT', null, 'auto_increment'),
'theme_name' => array('VCHAR_UNI:255', ''),
'theme_copyright' => array('VCHAR_UNI', ''),
'theme_path' => array('VCHAR:100', ''),

View file

@ -27,7 +27,7 @@ class teampage extends \phpbb\db\migration\migration
'add_tables' => array(
$this->table_prefix . 'teampage' => array(
'COLUMNS' => array(
'teampage_id' => array('UINT', NULL, 'auto_increment'),
'teampage_id' => array('UINT', null, 'auto_increment'),
'group_id' => array('UINT', 0),
'teampage_name' => array('VCHAR_UNI:255', ''),
'teampage_position' => array('UINT', 0),

View file

@ -33,7 +33,7 @@ class tools
/**
* @var object DB object
*/
var $db = NULL;
var $db = null;
/**
* The Column types for every database we support

View file

@ -72,7 +72,6 @@ class kernel_exception_subscriber implements EventSubscriberInterface
page_footer(true, false, false);
$status_code = $exception instanceof HttpException ? $exception->getStatusCode() : 500;
$response = new Response($this->template->assign_display('body'), $status_code);
$event->setResponse($response);

View file

@ -234,7 +234,9 @@ class manager
*/
public function enable($name)
{
// @codingStandardsIgnoreStart
while ($this->enable_step($name));
// @codingStandardsIgnoreEnd
}
/**
@ -311,7 +313,9 @@ class manager
*/
public function disable($name)
{
// @codingStandardsIgnoreStart
while ($this->disable_step($name));
// @codingStandardsIgnoreEnd
}
/**
@ -388,7 +392,9 @@ class manager
*/
public function purge($name)
{
// @codingStandardsIgnoreStart
while ($this->purge_step($name));
// @codingStandardsIgnoreEnd
}
/**

View file

@ -169,7 +169,7 @@ class metadata_manager
throw new \phpbb\extension\exception('file_get_contents failed on ' . $this->metadata_file);
}
if (($metadata = json_decode($file_contents, true)) === NULL)
if (($metadata = json_decode($file_contents, true)) === null)
{
throw new \phpbb\extension\exception('json_decode failed on ' . $this->metadata_file);
}

View file

@ -150,7 +150,7 @@ abstract class base
*/
function get($key)
{
return (isset($this->keys[$key])) ? $this->keys[$key] : NULL;
return (isset($this->keys[$key])) ? $this->keys[$key] : null;
}
function get_readable_forums()

View file

@ -850,7 +850,6 @@ class fulltext_native extends \phpbb\search\base
}
$this->db->sql_freeresult($result);
// if we use mysql and the total result count is not cached yet, retrieve it from the db
if (!$total_results && $is_mysql)
{

View file

@ -1235,7 +1235,6 @@ class session
$this->session_create(ANONYMOUS);
}
// Determine which message to output
$till_date = ($ban_row['ban_end']) ? $this->format_date($ban_row['ban_end']) : '';
$message = ($ban_row['ban_end']) ? 'BOARD_BAN_TIME' : 'BOARD_BAN_PERM';

View file

@ -285,7 +285,7 @@ class context
// Search array to get correct position
list($search_key, $search_value) = @each($key);
$key = NULL;
$key = null;
foreach ($block as $i => $val_ary)
{
if ($val_ary[$search_key] === $search_value)
@ -296,7 +296,7 @@ class context
}
// key/value pair not found
if ($key === NULL)
if ($key === null)
{
return false;
}

View file

@ -23,7 +23,7 @@ class includephp extends \Twig_Node
/** @var Twig_Environment */
protected $environment;
public function __construct(\Twig_Node_Expression $expr, \phpbb\template\twig\environment $environment, $ignoreMissing = false, $lineno, $tag = null)
public function __construct(\Twig_Node_Expression $expr, \phpbb\template\twig\environment $environment, $lineno, $ignoreMissing = false, $tag = null)
{
$this->environment = $environment;

View file

@ -43,7 +43,7 @@ class includephp extends \Twig_TokenParser
$stream->expect(\Twig_Token::BLOCK_END_TYPE);
return new \phpbb\template\twig\node\includephp($expr, $this->parser->getEnvironment(), $ignoreMissing, $token->getLine(), $this->getTag());
return new \phpbb\template\twig\node\includephp($expr, $this->parser->getEnvironment(), $token->getLine(), $ignoreMissing, $this->getTag());
}
/**

View file

@ -343,7 +343,6 @@ class user extends \phpbb\session
}
}
// Does the user need to change their password? If so, redirect to the
// ucp profile reg_details page ... of course do not redirect if we're already in the ucp
if (!defined('IN_ADMIN') && !defined('ADMIN_START') && $config['chg_passforce'] && !empty($this->data['is_registered']) && $auth->acl_get('u_chgpasswd') && $this->data['user_passchg'] < time() - ($config['chg_passforce'] * 86400))