diff options
| author | Andreas Fischer <bantu@phpbb.com> | 2014-06-16 22:24:59 +0200 | 
|---|---|---|
| committer | Andreas Fischer <bantu@phpbb.com> | 2014-06-16 22:24:59 +0200 | 
| commit | 4d6afb26380d192efc556640499b6f5c43fbdf3c (patch) | |
| tree | 4517a02476b14ffcd3f51e8aa62634292ab28f32 | |
| parent | 0b106ab0e3f9fe94e42a55db27d1d989c06b5039 (diff) | |
| parent | ca3cdadd083dfa2e4e0596d17424c7d9b541785c (diff) | |
| download | forums-4d6afb26380d192efc556640499b6f5c43fbdf3c.tar forums-4d6afb26380d192efc556640499b6f5c43fbdf3c.tar.gz forums-4d6afb26380d192efc556640499b6f5c43fbdf3c.tar.bz2 forums-4d6afb26380d192efc556640499b6f5c43fbdf3c.tar.xz forums-4d6afb26380d192efc556640499b6f5c43fbdf3c.zip | |
Merge pull request #2604 from Nicofuma/ticket/12722
[ticket/12722] Add Generic.Formatting.SpaceAfterCast in the legacy ruleset
* Nicofuma/ticket/12722:
  [ticket/12722] Add Generic.Formatting.SpaceAfterCast in the legacy ruleset
| -rw-r--r-- | build/code_sniffer/ruleset-php-legacy.xml | 3 | ||||
| -rw-r--r-- | phpBB/includes/acp/acp_jabber.php | 14 | ||||
| -rw-r--r-- | phpBB/includes/acp/auth.php | 2 | ||||
| -rw-r--r-- | phpBB/includes/functions_convert.php | 4 | ||||
| -rw-r--r-- | phpBB/includes/functions_user.php | 14 | ||||
| -rw-r--r-- | phpBB/includes/mcp/mcp_main.php | 2 | ||||
| -rw-r--r-- | phpBB/includes/utf/utf_tools.php | 2 | ||||
| -rw-r--r-- | phpBB/install/convertors/functions_phpbb20.php | 2 | ||||
| -rw-r--r-- | phpBB/phpbb/feed/post_base.php | 4 | ||||
| -rw-r--r-- | phpBB/phpbb/feed/topic_base.php | 4 | ||||
| -rw-r--r-- | phpBB/phpbb/search/fulltext_sphinx.php | 4 | 
11 files changed, 29 insertions, 26 deletions
| diff --git a/build/code_sniffer/ruleset-php-legacy.xml b/build/code_sniffer/ruleset-php-legacy.xml index 716215b48f..272c4840b6 100644 --- a/build/code_sniffer/ruleset-php-legacy.xml +++ b/build/code_sniffer/ruleset-php-legacy.xml @@ -20,6 +20,9 @@   <!-- Call-time pass-by-reference MUST not be used. -->   <rule ref="Generic.Functions.CallTimePassByReference.NotAllowed" /> + <!-- There MUST be exactly one space after a cast. --> + <rule ref="Generic.Formatting.SpaceAfterCast" /> +   <!-- Class constants MUST be declared in all upper case with underscore separators. -->   <rule ref="Generic.NamingConventions.UpperCaseConstantName" /> diff --git a/phpBB/includes/acp/acp_jabber.php b/phpBB/includes/acp/acp_jabber.php index 5b88035fa4..8d2e9d41a3 100644 --- a/phpBB/includes/acp/acp_jabber.php +++ b/phpBB/includes/acp/acp_jabber.php @@ -47,13 +47,13 @@ class acp_jabber  		$this->tpl_name = 'acp_jabber';  		$this->page_title = 'ACP_JABBER_SETTINGS'; -		$jab_enable			= request_var('jab_enable',			(bool)		$config['jab_enable']); -		$jab_host			= request_var('jab_host',			(string)	$config['jab_host']); -		$jab_port			= request_var('jab_port',			(int)		$config['jab_port']); -		$jab_username		= request_var('jab_username',		(string)	$config['jab_username']); -		$jab_password		= request_var('jab_password',		(string)	$config['jab_password']); -		$jab_package_size	= request_var('jab_package_size',	(int)		$config['jab_package_size']); -		$jab_use_ssl		= request_var('jab_use_ssl',		(bool)		$config['jab_use_ssl']); +		$jab_enable			= request_var('jab_enable',			(bool) $config['jab_enable']); +		$jab_host			= request_var('jab_host',			(string) $config['jab_host']); +		$jab_port			= request_var('jab_port',			(int) $config['jab_port']); +		$jab_username		= request_var('jab_username',		(string) $config['jab_username']); +		$jab_password		= request_var('jab_password',		(string) $config['jab_password']); +		$jab_package_size	= request_var('jab_package_size',	(int) $config['jab_package_size']); +		$jab_use_ssl		= request_var('jab_use_ssl',		(bool) $config['jab_use_ssl']);  		$form_name = 'acp_jabber';  		add_form_key($form_name); diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php index 8fa9dba57b..7bb8e824d6 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -835,7 +835,7 @@ class auth_admin extends \phpbb\auth\auth  		}  		// Remove current auth options... -		$auth_option_ids = array((int)$any_option_id); +		$auth_option_ids = array((int) $any_option_id);  		foreach ($auth as $auth_option => $auth_setting)  		{  			$auth_option_ids[] = (int) $this->acl_options['id'][$auth_option]; diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 186e3b50f0..e8f8151d6f 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -1007,8 +1007,8 @@ function get_remote_avatar_dim($src, $axis)  		{  			$bigger = ($remote_avatar_cache[$src][0] > $remote_avatar_cache[$src][1]) ? 0 : 1;  			$ratio = $default[$bigger] / $remote_avatar_cache[$src][$bigger]; -			$remote_avatar_cache[$src][0] = (int)($remote_avatar_cache[$src][0] * $ratio); -			$remote_avatar_cache[$src][1] = (int)($remote_avatar_cache[$src][1] * $ratio); +			$remote_avatar_cache[$src][0] = (int) ($remote_avatar_cache[$src][0] * $ratio); +			$remote_avatar_cache[$src][1] = (int) ($remote_avatar_cache[$src][1] * $ratio);  		}  	} diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index d728ed7d78..5a10f9f411 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -755,7 +755,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas  		else  		{  			$ban_other = explode('-', $ban_len_other); -			if (sizeof($ban_other) == 3 && ((int)$ban_other[0] < 9999) && +			if (sizeof($ban_other) == 3 && ((int) $ban_other[0] < 9999) &&  				(strlen($ban_other[0]) == 4) && (strlen($ban_other[1]) == 2) && (strlen($ban_other[2]) == 2))  			{  				$ban_end = max($current_time, $user->create_datetime() @@ -2086,7 +2086,7 @@ function avatar_delete($mode, $row, $clean_db = false)  	// Check if the users avatar is actually *not* a group avatar  	if ($mode == 'user')  	{ -		if (strpos($row['user_avatar'], 'g') === 0 || (((int)$row['user_avatar'] !== 0) && ((int)$row['user_avatar'] !== (int)$row['user_id']))) +		if (strpos($row['user_avatar'], 'g') === 0 || (((int) $row['user_avatar'] !== 0) && ((int) $row['user_avatar'] !== (int) $row['user_id'])))  		{  			return false;  		} @@ -2419,7 +2419,7 @@ function group_correct_avatar($group_id, $old_entry)  {  	global $config, $db, $phpbb_root_path; -	$group_id		= (int)$group_id; +	$group_id		= (int) $group_id;  	$ext 			= substr(strrchr($old_entry, '.'), 1);  	$old_filename 	= get_avatar_filename($old_entry);  	$new_filename 	= $config['avatar_salt'] . "_g$group_id.$ext"; @@ -2844,7 +2844,7 @@ function remove_default_avatar($group_id, $user_ids)  	$sql = 'SELECT *  		FROM ' . GROUPS_TABLE . ' -		WHERE group_id = ' . (int)$group_id; +		WHERE group_id = ' . (int) $group_id;  	$result = $db->sql_query($sql);  	if (!$row = $db->sql_fetchrow($result))  	{ @@ -2885,7 +2885,7 @@ function remove_default_rank($group_id, $user_ids)  	$sql = 'SELECT *  		FROM ' . GROUPS_TABLE . ' -		WHERE group_id = ' . (int)$group_id; +		WHERE group_id = ' . (int) $group_id;  	$result = $db->sql_query($sql);  	if (!$row = $db->sql_fetchrow($result))  	{ @@ -2896,9 +2896,9 @@ function remove_default_rank($group_id, $user_ids)  	$sql = 'UPDATE ' . USERS_TABLE . '  		SET user_rank = 0 -		WHERE group_id = ' . (int)$group_id . ' +		WHERE group_id = ' . (int) $group_id . '  			AND user_rank <> 0 -			AND user_rank = ' . (int)$row['group_rank'] . ' +			AND user_rank = ' . (int) $row['group_rank'] . '  			AND ' . $db->sql_in_set('user_id', $user_ids);  	$db->sql_query($sql);  } diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 9d1afb7dc5..9a2b4d2a4e 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -567,7 +567,7 @@ function mcp_move_topic($topic_ids)  					'topic_last_poster_id'	=>	(int) $row['topic_last_poster_id'],  					'topic_last_poster_colour'=>(string) $row['topic_last_poster_colour'],  					'topic_last_poster_name'=>	(string) $row['topic_last_poster_name'], -					'topic_last_post_subject'=>	(string)  $row['topic_last_post_subject'], +					'topic_last_post_subject'=>	(string) $row['topic_last_post_subject'],  					'topic_last_post_time'	=>	(int) $row['topic_last_post_time'],  					'topic_last_view_time'	=>	(int) $row['topic_last_view_time'],  					'topic_moved_id'		=>	(int) $row['topic_id'], diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php index 958291fa06..e60a40a195 100644 --- a/phpBB/includes/utf/utf_tools.php +++ b/phpBB/includes/utf/utf_tools.php @@ -534,7 +534,7 @@ else  					return '';  				} -				$lx = (int)((-$length) / 65535); +				$lx = (int) ((-$length) / 65535);  				$ly = (-$length) % 65535;  				// negative length requires ... capture everything diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php index ff20154d03..a2bfabd2fd 100644 --- a/phpBB/install/convertors/functions_phpbb20.php +++ b/phpBB/install/convertors/functions_phpbb20.php @@ -223,7 +223,7 @@ function phpbb_insert_forums()  			'forum_desc'		=> htmlspecialchars(phpbb_set_default_encoding($row['forum_desc']), ENT_COMPAT, 'UTF-8'),  			'forum_type'		=> FORUM_POST,  			'forum_status'		=> is_item_locked($row['forum_status']), -			'enable_prune'		=> ($prune_enabled) ? (int)$row['prune_enable'] : 0, +			'enable_prune'		=> ($prune_enabled) ? (int) $row['prune_enable'] : 0,  			'prune_next'		=> (int) null_to_zero($row['prune_next']),  			'prune_days'		=> (int) null_to_zero($row['prune_days']),  			'prune_viewed'		=> 0, diff --git a/phpBB/phpbb/feed/post_base.php b/phpBB/phpbb/feed/post_base.php index fe11fd2a79..011775b6af 100644 --- a/phpBB/phpbb/feed/post_base.php +++ b/phpBB/phpbb/feed/post_base.php @@ -48,8 +48,8 @@ abstract class post_base extends \phpbb\feed\attachments_base  		{  			$item_row['statistics'] = $this->user->lang['POSTED'] . ' ' . $this->user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row)  				. ' ' . $this->separator_stats . ' ' . $this->user->format_date($row[$this->get('published')]) -				. (($this->is_moderator_approve_forum($row['forum_id']) && (int)$row['post_visibility'] === ITEM_UNAPPROVED) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POST_UNAPPROVED'] : '') -				. (($this->is_moderator_approve_forum($row['forum_id']) && (int)$row['post_visibility'] === ITEM_DELETED) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POST_DELETED'] : ''); +				. (($this->is_moderator_approve_forum($row['forum_id']) && (int) $row['post_visibility'] === ITEM_UNAPPROVED) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POST_UNAPPROVED'] : '') +				. (($this->is_moderator_approve_forum($row['forum_id']) && (int) $row['post_visibility'] === ITEM_DELETED) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POST_DELETED'] : '');  		}  	}  } diff --git a/phpBB/phpbb/feed/topic_base.php b/phpBB/phpbb/feed/topic_base.php index 4fbb498272..f9ff368cba 100644 --- a/phpBB/phpbb/feed/topic_base.php +++ b/phpBB/phpbb/feed/topic_base.php @@ -52,11 +52,11 @@ abstract class topic_base extends \phpbb\feed\attachments_base  			if ($this->is_moderator_approve_forum($row['forum_id']))  			{ -				if ( (int)$row['topic_visibility'] === ITEM_DELETED) +				if ((int) $row['topic_visibility'] === ITEM_DELETED)  				{  					$item_row['statistics'] .= ' ' . $this->separator_stats . ' ' . $this->user->lang['TOPIC_DELETED'];  				} -				else if ((int)$row['topic_visibility'] === ITEM_UNAPPROVED) +				else if ((int) $row['topic_visibility'] === ITEM_UNAPPROVED)  				{  					$item_row['statistics'] .= ' ' . $this->separator_stats . ' ' . $this->user->lang['TOPIC_UNAPPROVED'];  				} diff --git a/phpBB/phpbb/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php index c6c636562e..9008af338b 100644 --- a/phpBB/phpbb/search/fulltext_sphinx.php +++ b/phpBB/phpbb/search/fulltext_sphinx.php @@ -693,7 +693,7 @@ class fulltext_sphinx  	{  		if ($mode == 'edit')  		{ -			$this->sphinx->UpdateAttributes($this->indexes, array('forum_id', 'poster_id'), array((int)$post_id => array((int)$forum_id, (int)$poster_id))); +			$this->sphinx->UpdateAttributes($this->indexes, array('forum_id', 'poster_id'), array((int) $post_id => array((int) $forum_id, (int) $poster_id)));  		}  		else if ($mode != 'post' && $post_id)  		{ @@ -718,7 +718,7 @@ class fulltext_sphinx  			$post_time = time();  			while ($row = $this->db->sql_fetchrow($result))  			{ -				$post_updates[(int)$row['post_id']] = array($post_time); +				$post_updates[(int) $row['post_id']] = array($post_time);  			}  			$this->db->sql_freeresult($result); | 
