1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 05:50:42 +02:00

[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

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

@@ -34,7 +34,7 @@ class approve_topic extends \phpbb\notification\type\topic
{
return 'approve_topic';
}
/**
* Language key used to output the text
*

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