Failed Conditions
Branch release-2.1 (74931e)
by Rick
05:07
created
Sources/random_compat/cast_to_int.php 2 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -28,50 +28,50 @@
 block discarded – undo
28 28
 
29 29
 if (!is_callable('RandomCompat_intval')) {
30 30
 
31
-    /**
32
-     * Cast to an integer if we can, safely.
33
-     *
34
-     * If you pass it a float in the range (~PHP_INT_MAX, PHP_INT_MAX)
35
-     * (non-inclusive), it will sanely cast it to an int. If you it's equal to
36
-     * ~PHP_INT_MAX or PHP_INT_MAX, we let it fail as not an integer. Floats
37
-     * lose precision, so the <= and => operators might accidentally let a float
38
-     * through.
39
-     *
40
-     * @param int|float $number    The number we want to convert to an int
41
-     * @param bool      $fail_open Set to true to not throw an exception
42
-     *
43
-     * @return float|int
44
-     * @psalm-suppress InvalidReturnType
45
-     *
46
-     * @throws TypeError
47
-     */
48
-    function RandomCompat_intval($number, $fail_open = false)
49
-    {
50
-        if (is_int($number) || is_float($number)) {
51
-            $number += 0;
52
-        } elseif (is_numeric($number)) {
53
-            /** @psalm-suppress InvalidOperand */
54
-            $number += 0;
55
-        }
56
-        /** @var int|float $number */
31
+	/**
32
+	 * Cast to an integer if we can, safely.
33
+	 *
34
+	 * If you pass it a float in the range (~PHP_INT_MAX, PHP_INT_MAX)
35
+	 * (non-inclusive), it will sanely cast it to an int. If you it's equal to
36
+	 * ~PHP_INT_MAX or PHP_INT_MAX, we let it fail as not an integer. Floats
37
+	 * lose precision, so the <= and => operators might accidentally let a float
38
+	 * through.
39
+	 *
40
+	 * @param int|float $number    The number we want to convert to an int
41
+	 * @param bool      $fail_open Set to true to not throw an exception
42
+	 *
43
+	 * @return float|int
44
+	 * @psalm-suppress InvalidReturnType
45
+	 *
46
+	 * @throws TypeError
47
+	 */
48
+	function RandomCompat_intval($number, $fail_open = false)
49
+	{
50
+		if (is_int($number) || is_float($number)) {
51
+			$number += 0;
52
+		} elseif (is_numeric($number)) {
53
+			/** @psalm-suppress InvalidOperand */
54
+			$number += 0;
55
+		}
56
+		/** @var int|float $number */
57 57
 
58
-        if (
59
-            is_float($number)
60
-                &&
61
-            $number > ~PHP_INT_MAX
62
-                &&
63
-            $number < PHP_INT_MAX
64
-        ) {
65
-            $number = (int) $number;
66
-        }
58
+		if (
59
+			is_float($number)
60
+				&&
61
+			$number > ~PHP_INT_MAX
62
+				&&
63
+			$number < PHP_INT_MAX
64
+		) {
65
+			$number = (int) $number;
66
+		}
67 67
 
68
-        if (is_int($number)) {
69
-            return (int) $number;
70
-        } elseif (!$fail_open) {
71
-            throw new TypeError(
72
-                'Expected an integer.'
73
-            );
74
-        }
75
-        return $number;
76
-    }
68
+		if (is_int($number)) {
69
+			return (int) $number;
70
+		} elseif (!$fail_open) {
71
+			throw new TypeError(
72
+				'Expected an integer.'
73
+			);
74
+		}
75
+		return $number;
76
+	}
77 77
 }
Please login to merge, or discard this patch.
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,7 +26,8 @@  discard block
 block discarded – undo
26 26
  * SOFTWARE.
27 27
  */
28 28
 
29
-if (!is_callable('RandomCompat_intval')) {
29
+if (!is_callable('RandomCompat_intval'))
30
+{
30 31
 
31 32
     /**
32 33
      * Cast to an integer if we can, safely.
@@ -47,9 +48,12 @@  discard block
 block discarded – undo
47 48
      */
48 49
     function RandomCompat_intval($number, $fail_open = false)
49 50
     {
50
-        if (is_int($number) || is_float($number)) {
51
+        if (is_int($number) || is_float($number))
52
+        {
51 53
             $number += 0;
52
-        } elseif (is_numeric($number)) {
54
+        }
55
+        elseif (is_numeric($number))
56
+        {
53 57
             /** @psalm-suppress InvalidOperand */
54 58
             $number += 0;
55 59
         }
@@ -65,9 +69,12 @@  discard block
 block discarded – undo
65 69
             $number = (int) $number;
66 70
         }
67 71
 
68
-        if (is_int($number)) {
72
+        if (is_int($number))
73
+        {
69 74
             return (int) $number;
70
-        } elseif (!$fail_open) {
75
+        }
76
+        elseif (!$fail_open)
77
+        {
71 78
             throw new TypeError(
72 79
                 'Expected an integer.'
73 80
             );
Please login to merge, or discard this patch.
Sources/ManageSmileys.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1997,7 +1997,7 @@
 block discarded – undo
1997 1997
 	// Remove anything that isn't actually new from our list of files
1998 1998
 	foreach ($to_unset as $key => $ids)
1999 1999
 	{
2000
-		if (array_reduce($ids, function ($carry, $item) { return $carry * $item; }, true) == true)
2000
+		if (array_reduce($ids, function($carry, $item) { return $carry * $item; }, true) == true)
2001 2001
 			unset($smiley_files[$key]);
2002 2002
 	}
2003 2003
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1997,7 +1997,9 @@
 block discarded – undo
1997 1997
 	// Remove anything that isn't actually new from our list of files
1998 1998
 	foreach ($to_unset as $key => $ids)
1999 1999
 	{
2000
-		if (array_reduce($ids, function ($carry, $item) { return $carry * $item; }, true) == true)
2000
+		if (array_reduce($ids, function ($carry, $item)
2001
+		{
2002
+return $carry * $item; }, true) == true)
2001 2003
 			unset($smiley_files[$key]);
2002 2004
 	}
2003 2005
 
Please login to merge, or discard this patch.
Sources/Subs-Post.php 1 patch
Braces   -1 removed lines patch added patch discarded remove patch
@@ -1298,7 +1298,6 @@
 block discarded – undo
1298 1298
 
1299 1299
 		return array($charset, $string, 'base64');
1300 1300
 	}
1301
-
1302 1301
 	else
1303 1302
 		return array($charset, $string, '7bit');
1304 1303
 }
Please login to merge, or discard this patch.
Sources/Themes.php 1 patch
Braces   -1 removed lines patch added patch discarded remove patch
@@ -1287,7 +1287,6 @@
 block discarded – undo
1287 1287
 		// return all the info.
1288 1288
 		return $context['to_install'];
1289 1289
 	}
1290
-
1291 1290
 	else
1292 1291
 		fatal_lang_error('theme_install_error_title', false);
1293 1292
 }
Please login to merge, or discard this patch.
Sources/Subs-Db-mysql.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -982,7 +982,7 @@
 block discarded – undo
982 982
 	else
983 983
 	{
984 984
 		$return = array();
985
-		while($row = mysqli_fetch_assoc($request))
985
+		while ($row = mysqli_fetch_assoc($request))
986 986
 			$return[] = $row;
987 987
 	}
988 988
 	return !empty($return) ? $return : array();
Please login to merge, or discard this patch.
Sources/Subs.php 2 patches
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 			{
392 392
 				$val = 'CASE ';
393 393
 				foreach ($members as $k => $v)
394
-					$val .= 'WHEN id_member = ' . $v . ' THEN '. alert_count($v, true) . ' ';
394
+					$val .= 'WHEN id_member = ' . $v . ' THEN ' . alert_count($v, true) . ' ';
395 395
 				$val = $val . ' END';
396 396
 				$type = 'raw';
397 397
 			}
@@ -1051,11 +1051,11 @@  discard block
 block discarded – undo
1051 1051
 			// Anything that isn't a specification, punctuation mark, or whitespace.
1052 1052
 			'~(?<!%)\p{L}|[^\p{L}\p{P}\s]~u',
1053 1053
 			// A series of punctuation marks (except %), possibly separated by whitespace.
1054
-			'~([^%\P{P}])(\s*)(?'.'>(\1|[^%\P{Po}])\s*(?!$))*~u',
1054
+			'~([^%\P{P}])(\s*)(?' . '>(\1|[^%\P{Po}])\s*(?!$))*~u',
1055 1055
 			// Unwanted trailing punctuation and whitespace.
1056
-			'~(?'.'>([\p{Pd}\p{Ps}\p{Pi}\p{Pc}]|[^%\P{Po}])\s*)*$~u',
1056
+			'~(?' . '>([\p{Pd}\p{Ps}\p{Pi}\p{Pc}]|[^%\P{Po}])\s*)*$~u',
1057 1057
 			// Unwanted opening punctuation and whitespace.
1058
-			'~^\s*(?'.'>([\p{Pd}\p{Pe}\p{Pf}\p{Pc}]|[^%\P{Po}])\s*)*~u',
1058
+			'~^\s*(?' . '>([\p{Pd}\p{Pe}\p{Pf}\p{Pc}]|[^%\P{Po}])\s*)*~u',
1059 1059
 		),
1060 1060
 		array(
1061 1061
 			'',
@@ -1595,7 +1595,7 @@  discard block
 block discarded – undo
1595 1595
 				'type' => 'unparsed_commas_content',
1596 1596
 				'test' => '\d+,\d+\]',
1597 1597
 				'content' => '<a href="$1" target="_blank" rel="noopener">$1</a>',
1598
-				'validate' => function (&$tag, &$data, $disabled)
1598
+				'validate' => function(&$tag, &$data, $disabled)
1599 1599
 				{
1600 1600
 					$scheme = parse_url($data[0], PHP_URL_SCHEME);
1601 1601
 					if (empty($scheme))
@@ -2155,7 +2155,7 @@  discard block
 block discarded – undo
2155 2155
 		$codes[] = array(
2156 2156
 			'tag' => 'cowsay',
2157 2157
 			'parameters' => array(
2158
-				'e' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => 'oo', 'validate' => function ($eyes) use ($smcFunc)
2158
+				'e' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => 'oo', 'validate' => function($eyes) use ($smcFunc)
2159 2159
 					{
2160 2160
 						static $css_added;
2161 2161
 
@@ -2172,7 +2172,7 @@  discard block
 block discarded – undo
2172 2172
 						return $smcFunc['substr']($eyes . 'oo', 0, 2);
2173 2173
 					},
2174 2174
 				),
2175
-				't' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => '  ', 'validate' => function ($tongue) use ($smcFunc)
2175
+				't' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => '  ', 'validate' => function($tongue) use ($smcFunc)
2176 2176
 					{
2177 2177
 						return $smcFunc['substr']($tongue . '  ', 0, 2);
2178 2178
 					},
@@ -4145,7 +4145,7 @@  discard block
 block discarded – undo
4145 4145
 	$toMinify = array();
4146 4146
 	$normal = array();
4147 4147
 
4148
-	usort($context['css_files'], function ($a, $b)
4148
+	usort($context['css_files'], function($a, $b)
4149 4149
 	{
4150 4150
 		return $a['options']['order_pos'] < $b['options']['order_pos'] ? -1 : ($a['options']['order_pos'] > $b['options']['order_pos'] ? 1 : 0);
4151 4151
 	});
@@ -5610,15 +5610,15 @@  discard block
 block discarded – undo
5610 5610
 
5611 5611
 	// UTF-8 occurences of MS special characters
5612 5612
 	$findchars_utf8 = array(
5613
-		"\xe2\x80\x9a",	// single low-9 quotation mark
5614
-		"\xe2\x80\x9e",	// double low-9 quotation mark
5615
-		"\xe2\x80\xa6",	// horizontal ellipsis
5616
-		"\xe2\x80\x98",	// left single curly quote
5617
-		"\xe2\x80\x99",	// right single curly quote
5618
-		"\xe2\x80\x9c",	// left double curly quote
5619
-		"\xe2\x80\x9d",	// right double curly quote
5620
-		"\xe2\x80\x93",	// en dash
5621
-		"\xe2\x80\x94",	// em dash
5613
+		"\xe2\x80\x9a", // single low-9 quotation mark
5614
+		"\xe2\x80\x9e", // double low-9 quotation mark
5615
+		"\xe2\x80\xa6", // horizontal ellipsis
5616
+		"\xe2\x80\x98", // left single curly quote
5617
+		"\xe2\x80\x99", // right single curly quote
5618
+		"\xe2\x80\x9c", // left double curly quote
5619
+		"\xe2\x80\x9d", // right double curly quote
5620
+		"\xe2\x80\x93", // en dash
5621
+		"\xe2\x80\x94", // em dash
5622 5622
 	);
5623 5623
 
5624 5624
 	// windows 1252 / iso equivalents
@@ -5636,15 +5636,15 @@  discard block
 block discarded – undo
5636 5636
 
5637 5637
 	// safe replacements
5638 5638
 	$replacechars = array(
5639
-		',',	// &sbquo;
5640
-		',,',	// &bdquo;
5641
-		'...',	// &hellip;
5642
-		"'",	// &lsquo;
5643
-		"'",	// &rsquo;
5644
-		'"',	// &ldquo;
5645
-		'"',	// &rdquo;
5646
-		'-',	// &ndash;
5647
-		'--',	// &mdash;
5639
+		',', // &sbquo;
5640
+		',,', // &bdquo;
5641
+		'...', // &hellip;
5642
+		"'", // &lsquo;
5643
+		"'", // &rsquo;
5644
+		'"', // &ldquo;
5645
+		'"', // &rdquo;
5646
+		'-', // &ndash;
5647
+		'--', // &mdash;
5648 5648
 	);
5649 5649
 
5650 5650
 	if ($context['utf8'])
@@ -6774,7 +6774,7 @@  discard block
 block discarded – undo
6774 6774
 			EXISTS (
6775 6775
 				SELECT bpv.id_board
6776 6776
 				FROM ' . $db_prefix . 'board_permissions_view AS bpv
6777
-				WHERE bpv.id_group IN ('. implode(',', $groups) .')
6777
+				WHERE bpv.id_group IN ('. implode(',', $groups) . ')
6778 6778
 					AND bpv.deny = 0
6779 6779
 					AND bpv.id_board = b.id_board
6780 6780
 			)';
@@ -6784,7 +6784,7 @@  discard block
 block discarded – undo
6784 6784
 			AND NOT EXISTS (
6785 6785
 				SELECT bpv.id_board
6786 6786
 				FROM ' . $db_prefix . 'board_permissions_view AS bpv
6787
-				WHERE bpv.id_group IN ( '. implode(',', $groups) .')
6787
+				WHERE bpv.id_group IN ( '. implode(',', $groups) . ')
6788 6788
 					AND bpv.deny = 1
6789 6789
 					AND bpv.id_board = b.id_board
6790 6790
 			)';
@@ -7047,8 +7047,8 @@  discard block
 block discarded – undo
7047 7047
 	$i = 0;
7048 7048
 	while (empty($done))
7049 7049
 	{
7050
-		if (strpos($format, '{'. --$i . '}') !== false)
7051
-			$replacements['{'. $i . '}'] = array_pop($list);
7050
+		if (strpos($format, '{' . --$i . '}') !== false)
7051
+			$replacements['{' . $i . '}'] = array_pop($list);
7052 7052
 		else
7053 7053
 			$done = true;
7054 7054
 	}
@@ -7058,8 +7058,8 @@  discard block
 block discarded – undo
7058 7058
 	$i = 0;
7059 7059
 	while (empty($done))
7060 7060
 	{
7061
-		if (strpos($format, '{'. ++$i . '}') !== false)
7062
-			$replacements['{'. $i . '}'] = array_shift($list);
7061
+		if (strpos($format, '{' . ++$i . '}') !== false)
7062
+			$replacements['{' . $i . '}'] = array_shift($list);
7063 7063
 		else
7064 7064
 			$done = true;
7065 7065
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -302,7 +302,6 @@  discard block
 block discarded – undo
302 302
 		$condition = 'id_member IN ({array_int:members})';
303 303
 		$parameters['members'] = $members;
304 304
 	}
305
-
306 305
 	elseif ($members === null)
307 306
 		$condition = '1=1';
308 307
 
@@ -2156,7 +2155,7 @@  discard block
 block discarded – undo
2156 2155
 			'tag' => 'cowsay',
2157 2156
 			'parameters' => array(
2158 2157
 				'e' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => 'oo', 'validate' => function ($eyes) use ($smcFunc)
2159
-					{
2158
+				{
2160 2159
 						static $css_added;
2161 2160
 
2162 2161
 						if (empty($css_added))
@@ -2173,7 +2172,7 @@  discard block
 block discarded – undo
2173 2172
 					},
2174 2173
 				),
2175 2174
 				't' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => '  ', 'validate' => function ($tongue) use ($smcFunc)
2176
-					{
2175
+				{
2177 2176
 						return $smcFunc['substr']($tongue . '  ', 0, 2);
2178 2177
 					},
2179 2178
 				),
@@ -3280,7 +3279,7 @@  discard block
 block discarded – undo
3280 3279
 
3281 3280
 	// Replace away!
3282 3281
 	$message = preg_replace_callback($smileyPregSearch, function($matches) use ($smileyPregReplacements)
3283
-		{
3282
+	{
3284 3283
 			return $smileyPregReplacements[$matches[1]];
3285 3284
 		}, $message);
3286 3285
 }
@@ -4067,7 +4066,6 @@  discard block
 block discarded – undo
4067 4066
 				if (!isset($minSeed) && isset($js_file['options']['seed']))
4068 4067
 					$minSeed = $js_file['options']['seed'];
4069 4068
 			}
4070
-
4071 4069
 			else
4072 4070
 			{
4073 4071
 				echo '
@@ -6255,7 +6253,6 @@  discard block
 block discarded – undo
6255 6253
 			$isWritable = true;
6256 6254
 			break;
6257 6255
 		}
6258
-
6259 6256
 		else
6260 6257
 			@chmod($file, $val);
6261 6258
 	}
Please login to merge, or discard this patch.
Sources/Class-Punycode.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 				}
146 146
 				if ($c === $n) {
147 147
 					$q = $delta;
148
-					for ($k = static::BASE;; $k += static::BASE) {
148
+					for ($k = static::BASE; ; $k += static::BASE) {
149 149
 						$t = $this->calculateThreshold($k, $bias);
150 150
 						if ($q < $t) {
151 151
 							break;
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 			$oldi = $i;
228 228
 			$w = 1;
229 229
 
230
-			for ($k = static::BASE;; $k += static::BASE)
230
+			for ($k = static::BASE; ; $k += static::BASE)
231 231
 			{
232 232
 				$digit = static::$decodeTable[$input[$pos++]];
233 233
 				$i = $i + ($digit * $w);
Please login to merge, or discard this patch.
Braces   +20 added lines, -10 removed lines patch added patch discarded remove patch
@@ -94,7 +94,8 @@  discard block
 block discarded – undo
94 94
 	{
95 95
 		$input = mb_strtolower($input, $this->encoding);
96 96
 		$parts = explode('.', $input);
97
-		foreach ($parts as &$part) {
97
+		foreach ($parts as &$part)
98
+		{
98 99
 			$part = $this->encodePart($part);
99 100
 		}
100 101
 		$output = implode('.', $parts);
@@ -119,13 +120,16 @@  discard block
 block discarded – undo
119 120
 		$h = $b = count($codePoints['basic']);
120 121
 
121 122
 		$output = '';
122
-		foreach ($codePoints['basic'] as $code) {
123
+		foreach ($codePoints['basic'] as $code)
124
+		{
123 125
 			$output .= $this->codePointToChar($code);
124 126
 		}
125
-		if ($input === $output) {
127
+		if ($input === $output)
128
+		{
126 129
 			return $output;
127 130
 		}
128
-		if ($b > 0) {
131
+		if ($b > 0)
132
+		{
129 133
 			$output .= static::DELIMITER;
130 134
 		}
131 135
 
@@ -134,20 +138,26 @@  discard block
 block discarded – undo
134 138
 
135 139
 		$i = 0;
136 140
 		$length = mb_strlen($input, $this->encoding);
137
-		while ($h < $length) {
141
+		while ($h < $length)
142
+		{
138 143
 			$m = $codePoints['nonBasic'][$i++];
139 144
 			$delta = $delta + ($m - $n) * ($h + 1);
140 145
 			$n = $m;
141 146
 
142
-			foreach ($codePoints['all'] as $c) {
143
-				if ($c < $n || $c < static::INITIAL_N) {
147
+			foreach ($codePoints['all'] as $c)
148
+			{
149
+				if ($c < $n || $c < static::INITIAL_N)
150
+				{
144 151
 					$delta++;
145 152
 				}
146
-				if ($c === $n) {
153
+				if ($c === $n)
154
+				{
147 155
 					$q = $delta;
148
-					for ($k = static::BASE;; $k += static::BASE) {
156
+					for ($k = static::BASE;; $k += static::BASE)
157
+					{
149 158
 						$t = $this->calculateThreshold($k, $bias);
150
-						if ($q < $t) {
159
+						if ($q < $t)
160
+						{
151 161
 							break;
152 162
 						}
153 163
 
Please login to merge, or discard this patch.
Sources/Likes.php 1 patch
Braces   -1 removed lines patch added patch discarded remove patch
@@ -222,7 +222,6 @@
 block discarded – undo
222 222
 
223 223
 			$this->_validLikes['can_like'] = ($this->_user['id'] == $topicOwner ? 'cannot_like_content' : (allowedTo('likes_like') ? true : 'cannot_like_content'));
224 224
 		}
225
-
226 225
 		else
227 226
 		{
228 227
 			// Modders: This will give you whatever the user offers up in terms of liking, e.g. $this->_type=msg, $this->_content=1
Please login to merge, or discard this patch.
Sources/Post.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1241,7 +1241,7 @@
 block discarded – undo
1241 1241
 	// File Upload.
1242 1242
 	if ($context['can_post_attachment'])
1243 1243
 	{
1244
-		$acceptedFiles = implode(',', array_map(function ($val) use ($smcFunc)
1244
+		$acceptedFiles = implode(',', array_map(function($val) use ($smcFunc)
1245 1245
 		{
1246 1246
 			return '.' . $smcFunc['htmltrim']($val);
1247 1247
 		}, explode(',', $context['allowed_extensions'])));
Please login to merge, or discard this patch.