Passed
Pull Request — development (#3799)
by Spuds
06:23
created
sources/ElkArte/SettingsForm/SettingsFormAdapter/File.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -486,7 +486,7 @@
 block discarded – undo
486 486
 	{
487 487
 		// Now loop through the remaining (database-based) settings.
488 488
 		$this->configVars = array_map(
489
-			static function ($configVar) {
489
+			static function($configVar) {
490 490
 				// We just saved the file-based settings, so skip their definitions.
491 491
 				if (!is_array($configVar) || $configVar[2] === 'file')
492 492
 				{
Please login to merge, or discard this patch.
sources/ElkArte/Search/API/Sphinxql.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -275,7 +275,7 @@
 block discarded – undo
275 275
 	{
276 276
 		global $modSettings;
277 277
 
278
-		set_error_handler(static function () { /* ignore errors */ });
278
+		set_error_handler(static function() { /* ignore errors */ });
279 279
 		try
280 280
 		{
281 281
 			$mySphinx = mysqli_connect(($modSettings['sphinx_searchd_server'] === 'localhost' ? '127.0.0.1' : $modSettings['sphinx_searchd_server']), '', '', '', (int) $modSettings['sphinxql_searchd_port']);
Please login to merge, or discard this patch.
sources/ElkArte/Http/FsockFetchWebdata.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -210,7 +210,7 @@
 block discarded – undo
210 210
 		// no socket, then we need to open one to do much
211 211
 		if (!is_resource($this->_fp))
212 212
 		{
213
-			set_error_handler(static function () { /* ignore errors */ });
213
+			set_error_handler(static function() { /* ignore errors */ });
214 214
 			try
215 215
 			{
216 216
 				$this->_fp = fsockopen($this->_url['host'], $this->_url['port'], $errno, $errstr, 5);
Please login to merge, or discard this patch.
sources/ElkArte/Emoji.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	public function emojiFromHTML($string)
164 164
 	{
165 165
 		// If there are 4byte encoded values &#x1f123, change those back to utf8 characters
166
-		return preg_replace_callback(self::POSSIBLE_HTML_EMOJI, static function ($match) {
166
+		return preg_replace_callback(self::POSSIBLE_HTML_EMOJI, static function($match) {
167 167
 			$replace = html_entity_decode($match[0], ENT_NOQUOTES | ENT_SUBSTITUTE | ENT_HTML401, 'UTF-8');
168 168
 
169 169
 			// The Fitzpatrick Scale modifiers are not (well) supported across all graphics sets.  For now
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 			return $string;
265 265
 		}
266 266
 
267
-		$result = preg_replace_callback($this->emoji_regex, function ($match) {
267
+		$result = preg_replace_callback($this->emoji_regex, function($match) {
268 268
 			$hex_str = $this->unicodeCharacterToNumber($match[0]);
269 269
 			$found = $this->findEmojiByCode($hex_str);
270 270
 
Please login to merge, or discard this patch.
sources/ElkArte/Controller/MessageIndex.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -777,7 +777,7 @@
 block discarded – undo
777 777
 		updateTopicStats();
778 778
 		require_once(SUBSDIR . '/Messages.subs.php');
779 779
 		updateMessageStats();
780
-		updateSettings(['calendar_updated' => time(),]);
780
+		updateSettings(['calendar_updated' => time(), ]);
781 781
 
782 782
 		if (!empty($affectedBoards))
783 783
 		{
Please login to merge, or discard this patch.
themes/default/PersonalMessage.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -230,7 +230,7 @@
 block discarded – undo
230 230
 								</div>';
231 231
 		}
232 232
 
233
-		$has_top_border =(!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled'])
233
+		$has_top_border = (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled'])
234 234
 			|| (!empty($message['member']['custom_fields']) && empty($options['show_no_signatures']) && $context['signature_enabled']);
235 235
 
236 236
 		echo '
Please login to merge, or discard this patch.
sources/ElkArte/Mail/Mail.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -274,7 +274,7 @@
 block discarded – undo
274 274
 		global $txt;
275 275
 
276 276
 		// Try to connect to the SMTP server... if it doesn't exist, only wait three seconds.
277
-		set_error_handler(static function () { /* ignore errors */ });
277
+		set_error_handler(static function() { /* ignore errors */ });
278 278
 		try
279 279
 		{
280 280
 			$socket = fsockopen($smtp_host, $smtp_port, $errno, $errstr, 3);
Please login to merge, or discard this patch.
sources/ext/JavaScriptMinifier.php 1 patch
Spacing   +110 added lines, -111 removed lines patch added patch discarded remove patch
@@ -1205,7 +1205,7 @@  discard block
 block discarded – undo
1205 1205
 	 */
1206 1206
 	private static function ensureExpandedStates() {
1207 1207
 		// Already done?
1208
-		if ( self::$expandedStates ) {
1208
+		if (self::$expandedStates) {
1209 1209
 			return;
1210 1210
 		}
1211 1211
 		self::$expandedStates = true;
@@ -1213,12 +1213,12 @@  discard block
 block discarded – undo
1213 1213
 		// Add copies of all states (except FUNC and GENFUNC) with negative numbers.
1214 1214
 		// These negative states represent states inside generator functions. When in these states,
1215 1215
 		// TYPE_YIELD is treated as TYPE_RETURN, otherwise as TYPE_LITERAL
1216
-		foreach ( self::$model as $state => $transitions ) {
1217
-			if ( $state !== self::FUNC && $state !== self::GENFUNC ) {
1218
-				foreach ( $transitions as $tokenType => $actions ) {
1219
-					foreach ( $actions as $action => $target ) {
1220
-						if ( is_array( $target ) ) {
1221
-							foreach ( $target as $subaction => $subtarget ) {
1216
+		foreach (self::$model as $state => $transitions) {
1217
+			if ($state !== self::FUNC && $state !== self::GENFUNC) {
1218
+				foreach ($transitions as $tokenType => $actions) {
1219
+					foreach ($actions as $action => $target) {
1220
+						if (is_array($target)) {
1221
+							foreach ($target as $subaction => $subtarget) {
1222 1222
 								self::$model[-$state][$tokenType][$action][$subaction] =
1223 1223
 									$subtarget === self::FUNC || $subtarget === true || $subtarget === self::GENFUNC
1224 1224
 									? $subtarget : -$subtarget;
@@ -1237,10 +1237,10 @@  discard block
 block discarded – undo
1237 1237
 		self::$model[-self::PROPERTY_ASSIGNMENT][self::TYPE_BRACE_OPEN][self::ACTION_GOTO] = self::STATEMENT;
1238 1238
 
1239 1239
 		// Also add negative versions of states to the other arrays
1240
-		foreach ( self::$semicolon as $state => $value ) {
1240
+		foreach (self::$semicolon as $state => $value) {
1241 1241
 			self::$semicolon[-$state] = $value;
1242 1242
 		}
1243
-		foreach ( self::$divStates as $state => $value ) {
1243
+		foreach (self::$divStates as $state => $value) {
1244 1244
 			self::$divStates[-$state] = $value;
1245 1245
 		}
1246 1246
 	}
@@ -1251,8 +1251,8 @@  discard block
 block discarded – undo
1251 1251
 	 * @param string $s JavaScript code to minify
1252 1252
 	 * @return string|bool Minified code or false on failure
1253 1253
 	 */
1254
-	public static function minify( $s ) {
1255
-		return self::minifyInternal( $s );
1254
+	public static function minify($s) {
1255
+		return self::minifyInternal($s);
1256 1256
 	}
1257 1257
 
1258 1258
 	/**
@@ -1297,14 +1297,14 @@  discard block
 block discarded – undo
1297 1297
 	 * @param MappingsGenerator|null $mapGenerator
1298 1298
 	 * @return bool|string
1299 1299
 	 */
1300
-	public static function minifyInternal( $s, $mapGenerator = null ) {
1300
+	public static function minifyInternal($s, $mapGenerator = null) {
1301 1301
 		self::ensureExpandedStates();
1302 1302
 
1303 1303
 		// Here's where the minifying takes place: Loop through the input, looking for tokens
1304 1304
 		// and output them to $out, taking actions to the above defined rules when appropriate.
1305 1305
 		$out = '';
1306 1306
 		$pos = 0;
1307
-		$length = strlen( $s );
1307
+		$length = strlen($s);
1308 1308
 		$lineLength = 0;
1309 1309
 		$dotlessNum = false;
1310 1310
 		$lastDotlessNum = false;
@@ -1313,26 +1313,26 @@  discard block
 block discarded – undo
1313 1313
 		$stack = [];
1314 1314
 		$topOfStack = null; // Optimization: calling end( $stack ) repeatedly is expensive
1315 1315
 		$last = ';'; // Pretend that we have seen a semicolon yet
1316
-		while ( $pos < $length ) {
1316
+		while ($pos < $length) {
1317 1317
 			// First, skip over any whitespace and multiline comments, recording whether we
1318 1318
 			// found any newline character
1319
-			$skip = strspn( $s, " \t\n\r\xb\xc", $pos );
1320
-			if ( !$skip ) {
1319
+			$skip = strspn($s, " \t\n\r\xb\xc", $pos);
1320
+			if (!$skip) {
1321 1321
 				$ch = $s[$pos];
1322
-				if ( $ch === '/' && substr( $s, $pos, 2 ) === '/*' ) {
1322
+				if ($ch === '/' && substr($s, $pos, 2) === '/*') {
1323 1323
 					// Multiline comment. Search for the end token or EOT.
1324
-					$end = strpos( $s, '*/', $pos + 2 );
1324
+					$end = strpos($s, '*/', $pos + 2);
1325 1325
 					$skip = $end === false ? $length - $pos : $end - $pos + 2;
1326 1326
 				}
1327 1327
 			}
1328
-			if ( $skip ) {
1328
+			if ($skip) {
1329 1329
 				// The semicolon insertion mechanism needs to know whether there was a newline
1330 1330
 				// between two tokens, so record it now.
1331
-				if ( !$newlineFound && strcspn( $s, "\r\n", $pos, $skip ) !== $skip ) {
1331
+				if (!$newlineFound && strcspn($s, "\r\n", $pos, $skip) !== $skip) {
1332 1332
 					$newlineFound = true;
1333 1333
 				}
1334
-				if ( $mapGenerator ) {
1335
-					$mapGenerator->consumeSource( $skip );
1334
+				if ($mapGenerator) {
1335
+					$mapGenerator->consumeSource($skip);
1336 1336
 				}
1337 1337
 				$pos += $skip;
1338 1338
 				continue;
@@ -1341,13 +1341,13 @@  discard block
 block discarded – undo
1341 1341
 			// comments by the browser, regardless of whether the end tag is on the same line.
1342 1342
 			// Handle --> the same way, but only if it's at the beginning of the line
1343 1343
 			// @phan-suppress-next-line PhanPossiblyUndeclaredVariable
1344
-			if ( ( $ch === '/' && substr( $s, $pos, 2 ) === '//' )
1345
-				|| ( $ch === '<' && substr( $s, $pos, 4 ) === '<!--' )
1346
-				|| ( $ch === '-' && $newlineFound && substr( $s, $pos, 3 ) === '-->' )
1344
+			if (($ch === '/' && substr($s, $pos, 2) === '//')
1345
+				|| ($ch === '<' && substr($s, $pos, 4) === '<!--')
1346
+				|| ($ch === '-' && $newlineFound && substr($s, $pos, 3) === '-->')
1347 1347
 			) {
1348
-				$skip = strcspn( $s, "\r\n", $pos );
1349
-				if ( $mapGenerator ) {
1350
-					$mapGenerator->consumeSource( $skip );
1348
+				$skip = strcspn($s, "\r\n", $pos);
1349
+				if ($mapGenerator) {
1350
+					$mapGenerator->consumeSource($skip);
1351 1351
 				}
1352 1352
 				$pos += $skip;
1353 1353
 				continue;
@@ -1361,7 +1361,7 @@  discard block
 block discarded – undo
1361 1361
 			// of any next token in the stream.
1362 1362
 			$end = $pos + 1;
1363 1363
 			// Handle string literals
1364
-			if ( $ch === "'" || $ch === '"' ) {
1364
+			if ($ch === "'" || $ch === '"') {
1365 1365
 				// Search to the end of the string literal, skipping over backslash escapes
1366 1366
 				$search = $ch . '\\';
1367 1367
 				do {
@@ -1369,13 +1369,13 @@  discard block
 block discarded – undo
1369 1369
 					// the next iteration will start 2 characters further (one for the
1370 1370
 					// backslash, one for the escaped character).
1371 1371
 					// We'll correct this outside the loop.
1372
-					$end += strcspn( $s, $search, $end ) + 2;
1372
+					$end += strcspn($s, $search, $end) + 2;
1373 1373
 					// If the last character in our search for a quote or a backlash
1374 1374
 					// matched a backslash and we haven't reached the end, keep searching..
1375
-				} while ( $end - 2 < $length && $s[$end - 2] === '\\' );
1375
+				} while ($end - 2 < $length && $s[$end - 2] === '\\');
1376 1376
 				// Correction (1): Undo speculative add, keep only one (end of string literal)
1377 1377
 				$end--;
1378
-				if ( $end > $length ) {
1378
+				if ($end > $length) {
1379 1379
 					// Correction (2): Loop wrongly assumed an end quote ended the search,
1380 1380
 					// but search ended because we've reached the end. Correct $end.
1381 1381
 					// TODO: This is invalid and should throw.
@@ -1384,33 +1384,33 @@  discard block
 block discarded – undo
1384 1384
 
1385 1385
 			// Handle template strings, either from "`" to begin a new string,
1386 1386
 			// or continuation after the "}" that ends a "${"-expression.
1387
-			} elseif ( $ch === '`' || ( $ch === '}' && $topOfStack === self::TEMPLATE_STRING_TAIL ) ) {
1388
-				if ( $ch === '}' ) {
1387
+			} elseif ($ch === '`' || ($ch === '}' && $topOfStack === self::TEMPLATE_STRING_TAIL)) {
1388
+				if ($ch === '}') {
1389 1389
 					// Pop the TEMPLATE_STRING_TAIL state off the stack
1390 1390
 					// We don't let it get popped off the stack the normal way, to avoid the newline
1391 1391
 					// and comment stripping code above running on the continuation of the literal
1392
-					array_pop( $stack );
1392
+					array_pop($stack);
1393 1393
 					// Also pop the previous state off the stack
1394
-					$state = array_pop( $stack );
1395
-					$topOfStack = end( $stack );
1394
+					$state = array_pop($stack);
1395
+					$topOfStack = end($stack);
1396 1396
 				}
1397 1397
 				// Search until we reach either a closing ` or a ${, skipping over backslash escapes
1398 1398
 				// and $ characters followed by something other than { or `
1399 1399
 				do {
1400
-					$end += strcspn( $s, '`$\\', $end ) + 1;
1401
-					if ( $end - 1 < $length && $s[$end - 1] === '`' ) {
1400
+					$end += strcspn($s, '`$\\', $end) + 1;
1401
+					if ($end - 1 < $length && $s[$end - 1] === '`') {
1402 1402
 						// End of the string, stop
1403 1403
 						// We don't do this in the while() condition because the $end++ in the
1404 1404
 						// backslash escape branch makes it difficult to do so without incorrectly
1405 1405
 						// considering an escaped backtick (\`) the end of the string
1406 1406
 						break;
1407 1407
 					}
1408
-					if ( $end - 1 < $length && $s[$end - 1] === '\\' ) {
1408
+					if ($end - 1 < $length && $s[$end - 1] === '\\') {
1409 1409
 						// Backslash escape. Skip the next character, and keep going
1410 1410
 						$end++;
1411 1411
 						continue;
1412 1412
 					}
1413
-					if ( $end < $length && $s[$end - 1] === '$' && $s[$end] === '{' ) {
1413
+					if ($end < $length && $s[$end - 1] === '$' && $s[$end] === '{') {
1414 1414
 						// Beginning of an expression in ${ ... }. Skip the {, and stop
1415 1415
 						$end++;
1416 1416
 						// Push the current state to the stack. We'll pop this off later when hitting
@@ -1423,8 +1423,8 @@  discard block
 block discarded – undo
1423 1423
 						$state = self::TEMPLATE_STRING_HEAD;
1424 1424
 						break;
1425 1425
 					}
1426
-				} while ( $end - 1 < $length );
1427
-				if ( $end > $length ) {
1426
+				} while ($end - 1 < $length);
1427
+				if ($end > $length) {
1428 1428
 					// Loop wrongly assumed an end quote or ${ ended the search,
1429 1429
 					// but search ended because we've reached the end. Correct $end.
1430 1430
 					// TODO: This is invalid and should throw.
@@ -1433,28 +1433,28 @@  discard block
 block discarded – undo
1433 1433
 
1434 1434
 			// We have to distinguish between regexp literals and division operators
1435 1435
 			// A division operator is only possible in certain states
1436
-			} elseif ( $ch === '/' && !isset( self::$divStates[$state] ) ) {
1436
+			} elseif ($ch === '/' && !isset(self::$divStates[$state])) {
1437 1437
 				// Regexp literal
1438
-				for ( ; ; ) {
1438
+				for (;;) {
1439 1439
 					// Search until we find "/" (end of regexp), "\" (backslash escapes),
1440 1440
 					// or "[" (start of character classes).
1441 1441
 					do {
1442 1442
 						// Speculatively add 2 to ensure next iteration skips
1443 1443
 						// over backslash and escaped character.
1444 1444
 						// We'll correct this outside the loop.
1445
-						$end += strcspn( $s, '/[\\', $end ) + 2;
1445
+						$end += strcspn($s, '/[\\', $end) + 2;
1446 1446
 						// If backslash escape, keep searching...
1447
-					} while ( $end - 2 < $length && $s[$end - 2] === '\\' );
1447
+					} while ($end - 2 < $length && $s[$end - 2] === '\\');
1448 1448
 					// Correction (1): Undo speculative add, keep only one (end of regexp)
1449 1449
 					$end--;
1450
-					if ( $end > $length ) {
1450
+					if ($end > $length) {
1451 1451
 						// Correction (2): Loop wrongly assumed end slash was seen
1452 1452
 						// String ended without end of regexp. Correct $end.
1453 1453
 						// TODO: This is invalid and should throw.
1454 1454
 						$end--;
1455 1455
 						break;
1456 1456
 					}
1457
-					if ( $s[$end - 1] === '/' ) {
1457
+					if ($s[$end - 1] === '/') {
1458 1458
 						break;
1459 1459
 					}
1460 1460
 					// (Implicit else), we must've found the start of a char class,
@@ -1462,12 +1462,12 @@  discard block
 block discarded – undo
1462 1462
 					do {
1463 1463
 						// Speculatively add 2 for backslash escape.
1464 1464
 						// We'll substract one outside the loop.
1465
-						$end += strcspn( $s, ']\\', $end ) + 2;
1465
+						$end += strcspn($s, ']\\', $end) + 2;
1466 1466
 						// If backslash escape, keep searching...
1467
-					} while ( $end - 2 < $length && $s[$end - 2] === '\\' );
1467
+					} while ($end - 2 < $length && $s[$end - 2] === '\\');
1468 1468
 					// Correction (1): Undo speculative add, keep only one (end of regexp)
1469 1469
 					$end--;
1470
-					if ( $end > $length ) {
1470
+					if ($end > $length) {
1471 1471
 						// Correction (2): Loop wrongly assumed "]" was seen
1472 1472
 						// String ended without ending char class or regexp. Correct $end.
1473 1473
 						// TODO: This is invalid and should throw.
@@ -1476,21 +1476,21 @@  discard block
 block discarded – undo
1476 1476
 					}
1477 1477
 				}
1478 1478
 				// Search past the regexp modifiers (gi)
1479
-				while ( $end < $length && ctype_alpha( $s[$end] ) ) {
1479
+				while ($end < $length && ctype_alpha($s[$end])) {
1480 1480
 					$end++;
1481 1481
 				}
1482 1482
 			} elseif (
1483 1483
 				$ch === '0'
1484
-				&& ( $pos + 1 < $length ) && ( $s[$pos + 1] === 'x' || $s[$pos + 1] === 'X' )
1484
+				&& ($pos + 1 < $length) && ($s[$pos + 1] === 'x' || $s[$pos + 1] === 'X')
1485 1485
 			) {
1486 1486
 				// Hex numeric literal
1487 1487
 				$end++; // x or X
1488
-				$len = strspn( $s, '0123456789ABCDEFabcdef', $end );
1489
-				if ( !$len ) {
1488
+				$len = strspn($s, '0123456789ABCDEFabcdef', $end);
1489
+				if (!$len) {
1490 1490
 					return self::parseError(
1491 1491
 						$s,
1492 1492
 						$pos,
1493
-						'Expected a hexadecimal number but found ' . substr( $s, $pos, 5 ) . '...'
1493
+						'Expected a hexadecimal number but found ' . substr($s, $pos, 5) . '...'
1494 1494
 					);
1495 1495
 				}
1496 1496
 				$end += $len;
@@ -1501,30 +1501,30 @@  discard block
 block discarded – undo
1501 1501
 				// numbers, and exponents (e.g. strings like "+012.34e6"). But, it is fine here
1502 1502
 				// because we know $ch is a single character, and we believe the only single
1503 1503
 				// characters that is_numeric() accepts are ASCII digits 0-9.
1504
-				is_numeric( $ch )
1505
-				|| ( $ch === '.' && $pos + 1 < $length && is_numeric( $s[$pos + 1] ) )
1504
+				is_numeric($ch)
1505
+				|| ($ch === '.' && $pos + 1 < $length && is_numeric($s[$pos + 1]))
1506 1506
 			) {
1507
-				$end += strspn( $s, '0123456789', $end );
1508
-				$decimal = strspn( $s, '.', $end );
1509
-				if ( $decimal ) {
1510
-					if ( $decimal > 2 ) {
1511
-						return self::parseError( $s, $end, 'The number has too many decimal points' );
1507
+				$end += strspn($s, '0123456789', $end);
1508
+				$decimal = strspn($s, '.', $end);
1509
+				if ($decimal) {
1510
+					if ($decimal > 2) {
1511
+						return self::parseError($s, $end, 'The number has too many decimal points');
1512 1512
 					}
1513
-					$end += strspn( $s, '0123456789', $end + 1 ) + $decimal;
1513
+					$end += strspn($s, '0123456789', $end + 1) + $decimal;
1514 1514
 				} else {
1515 1515
 					$dotlessNum = true;
1516 1516
 				}
1517
-				$exponent = strspn( $s, 'eE', $end );
1518
-				if ( $exponent ) {
1519
-					if ( $exponent > 1 ) {
1520
-						return self::parseError( $s, $end, 'Number with several E' );
1517
+				$exponent = strspn($s, 'eE', $end);
1518
+				if ($exponent) {
1519
+					if ($exponent > 1) {
1520
+						return self::parseError($s, $end, 'Number with several E');
1521 1521
 					}
1522 1522
 					$end++;
1523 1523
 
1524 1524
 					// + sign is optional; - sign is required.
1525
-					$end += strspn( $s, '-+', $end );
1526
-					$len = strspn( $s, '0123456789', $end );
1527
-					if ( !$len ) {
1525
+					$end += strspn($s, '-+', $end);
1526
+					$len = strspn($s, '0123456789', $end);
1527
+					if (!$len) {
1528 1528
 						return self::parseError(
1529 1529
 							$s,
1530 1530
 							$pos,
@@ -1533,12 +1533,12 @@  discard block
 block discarded – undo
1533 1533
 					}
1534 1534
 					$end += $len;
1535 1535
 				}
1536
-			} elseif ( isset( self::$opChars[$ch] ) ) {
1536
+			} elseif (isset(self::$opChars[$ch])) {
1537 1537
 				// Punctuation character. Search for the longest matching operator.
1538
-				for ( $tokenLength = self::LONGEST_PUNCTUATION_TOKEN; $tokenLength > 1; $tokenLength-- ) {
1538
+				for ($tokenLength = self::LONGEST_PUNCTUATION_TOKEN; $tokenLength > 1; $tokenLength--) {
1539 1539
 					if (
1540 1540
 						$pos + $tokenLength <= $length &&
1541
-						isset( self::$tokenTypes[ substr( $s, $pos, $tokenLength ) ] )
1541
+						isset(self::$tokenTypes[substr($s, $pos, $tokenLength)])
1542 1542
 					) {
1543 1543
 						$end = $pos + $tokenLength;
1544 1544
 						break;
@@ -1547,29 +1547,29 @@  discard block
 block discarded – undo
1547 1547
 			} else {
1548 1548
 				// Identifier or reserved word. Search for the end by excluding whitespace and
1549 1549
 				// punctuation.
1550
-				$end += strcspn( $s, " \t\n.;,=<>+-{}()[]?:*/%'\"`!&|^~\xb\xc\r", $end );
1550
+				$end += strcspn($s, " \t\n.;,=<>+-{}()[]?:*/%'\"`!&|^~\xb\xc\r", $end);
1551 1551
 			}
1552 1552
 
1553 1553
 			// Now get the token type from our type array
1554
-			$token = substr( $s, $pos, $end - $pos ); // so $end - $pos == strlen( $token )
1555
-			$type = isset( self::$model[$state][self::TYPE_SPECIAL][$token] )
1554
+			$token = substr($s, $pos, $end - $pos); // so $end - $pos == strlen( $token )
1555
+			$type = isset(self::$model[$state][self::TYPE_SPECIAL][$token])
1556 1556
 				? self::TYPE_SPECIAL
1557 1557
 				: self::$tokenTypes[$token] ?? self::TYPE_LITERAL;
1558
-			if ( $type === self::TYPE_YIELD ) {
1558
+			if ($type === self::TYPE_YIELD) {
1559 1559
 				// yield is treated as TYPE_RETURN inside a generator function (negative state)
1560 1560
 				// but as TYPE_LITERAL when not in a generator function (positive state)
1561 1561
 				$type = $state < 0 ? self::TYPE_RETURN : self::TYPE_LITERAL;
1562 1562
 			}
1563 1563
 
1564 1564
 			$pad = '';
1565
-			if ( $newlineFound && isset( self::$semicolon[$state][$type] ) ) {
1565
+			if ($newlineFound && isset(self::$semicolon[$state][$type])) {
1566 1566
 				// This token triggers the semicolon insertion mechanism of javascript. While we
1567 1567
 				// could add the ; token here ourselves, keeping the newline has a few advantages.
1568 1568
 				$pad = "\n";
1569 1569
 				$state = $state < 0 ? -self::STATEMENT : self::STATEMENT;
1570 1570
 				$lineLength = 0;
1571
-			} elseif ( $lineLength + $end - $pos > self::$maxLineLength &&
1572
-				!isset( self::$semicolon[$state][$type] ) &&
1571
+			} elseif ($lineLength + $end - $pos > self::$maxLineLength &&
1572
+				!isset(self::$semicolon[$state][$type]) &&
1573 1573
 				$type !== self::TYPE_INCR_OP &&
1574 1574
 				$type !== self::TYPE_ARROW
1575 1575
 			) {
@@ -1580,27 +1580,27 @@  discard block
 block discarded – undo
1580 1580
 				$pad = "\n";
1581 1581
 				$lineLength = 0;
1582 1582
 			// Check, whether we have to separate the token from the last one with whitespace
1583
-			} elseif ( !isset( self::$opChars[$last] ) && !isset( self::$opChars[$ch] ) ) {
1583
+			} elseif (!isset(self::$opChars[$last]) && !isset(self::$opChars[$ch])) {
1584 1584
 				$pad = ' ';
1585 1585
 				$lineLength++;
1586 1586
 			// Don't accidentally create ++, -- or // tokens
1587
-			} elseif ( $last === $ch && ( $ch === '+' || $ch === '-' || $ch === '/' ) ) {
1587
+			} elseif ($last === $ch && ($ch === '+' || $ch === '-' || $ch === '/')) {
1588 1588
 				$pad = ' ';
1589 1589
 				$lineLength++;
1590 1590
 			// Don't create invalid dot notation after number literal (T303827).
1591 1591
 			// Keep whitespace in "42. foo".
1592 1592
 			// But keep minifying "foo.bar", "42..foo", and "42.0.foo" per $opChars.
1593
-			} elseif ( $lastDotlessNum && $type === self::TYPE_DOT ) {
1593
+			} elseif ($lastDotlessNum && $type === self::TYPE_DOT) {
1594 1594
 				$pad = ' ';
1595 1595
 				$lineLength++;
1596 1596
 			}
1597 1597
 
1598 1598
 			// self::debug( $topOfStack, $last, $lastType, $state, $ch, $token, $type, );
1599 1599
 
1600
-			if ( $mapGenerator ) {
1601
-				$mapGenerator->outputSpace( $pad );
1602
-				$mapGenerator->outputToken( $token );
1603
-				$mapGenerator->consumeSource( $end - $pos );
1600
+			if ($mapGenerator) {
1601
+				$mapGenerator->outputSpace($pad);
1602
+				$mapGenerator->outputToken($token);
1603
+				$mapGenerator->consumeSource($end - $pos);
1604 1604
 			}
1605 1605
 			$out .= $pad;
1606 1606
 			$out .= $token;
@@ -1613,18 +1613,17 @@  discard block
 block discarded – undo
1613 1613
 
1614 1614
 			// Now that we have output our token, transition into the new state.
1615 1615
 			$actions = $type === self::TYPE_SPECIAL ?
1616
-				self::$model[$state][$type][$token] :
1617
-				self::$model[$state][$type] ?? [];
1618
-			if ( isset( $actions[self::ACTION_PUSH] ) &&
1619
-				count( $stack ) < self::STACK_LIMIT
1616
+				self::$model[$state][$type][$token] : self::$model[$state][$type] ?? [];
1617
+			if (isset($actions[self::ACTION_PUSH]) &&
1618
+				count($stack) < self::STACK_LIMIT
1620 1619
 			) {
1621 1620
 				$topOfStack = $actions[self::ACTION_PUSH];
1622 1621
 				$stack[] = $topOfStack;
1623 1622
 			}
1624
-			if ( $stack && isset( $actions[self::ACTION_POP] ) ) {
1625
-				$state = array_pop( $stack );
1626
-				$topOfStack = end( $stack );
1627
-			} elseif ( isset( $actions[self::ACTION_GOTO] ) ) {
1623
+			if ($stack && isset($actions[self::ACTION_POP])) {
1624
+				$state = array_pop($stack);
1625
+				$topOfStack = end($stack);
1626
+			} elseif (isset($actions[self::ACTION_GOTO])) {
1628 1627
 				$state = $actions[self::ACTION_GOTO];
1629 1628
 			}
1630 1629
 		}
@@ -1637,7 +1636,7 @@  discard block
 block discarded – undo
1637 1636
 	 * @param string $errorMsg
1638 1637
 	 * @return bool
1639 1638
 	 */
1640
-	public static function parseError( $fullJavascript, $position, $errorMsg ) {
1639
+	public static function parseError($fullJavascript, $position, $errorMsg) {
1641 1640
 		// TODO: Handle the error: trigger_error, throw exception, return false...
1642 1641
 		return false;
1643 1642
 	}
@@ -1656,32 +1655,32 @@  discard block
 block discarded – undo
1656 1655
 		int $state, string $ch, string $token, int $type
1657 1656
 	) {
1658 1657
 		static $first = true;
1659
-		$self = new \ReflectionClass( self::class );
1658
+		$self = new \ReflectionClass(self::class);
1660 1659
 		$constants = $self->getConstants();
1661 1660
 
1662
-		foreach ( $self->getConstants() as $name => $value ) {
1663
-			if ( $value === $top ) {
1661
+		foreach ($self->getConstants() as $name => $value) {
1662
+			if ($value === $top) {
1664 1663
 				$top = $name;
1665 1664
 			}
1666
-			if ( $value === $lastType ) {
1665
+			if ($value === $lastType) {
1667 1666
 				$lastType = $name;
1668 1667
 			}
1669
-			if ( $value === $state ) {
1668
+			if ($value === $state) {
1670 1669
 				$state = $name;
1671 1670
 			}
1672
-			if ( $value === $type ) {
1671
+			if ($value === $type) {
1673 1672
 				$type = $name;
1674 1673
 			}
1675 1674
 		}
1676 1675
 
1677
-		if ( $first ) {
1678
-			print sprintf( "| %-29s | %-4s | %-29s | %-29s | %-2s | %-10s | %-29s\n",
1679
-				'topOfStack', 'last', 'lastType', 'state', 'ch', 'token', 'type' );
1680
-			print sprintf( "| %'-29s | %'-4s | %'-29s | %'-29s | %'-2s | %'-10s | %'-29s\n",
1681
-				'', '', '', '', '', '', '' );
1676
+		if ($first) {
1677
+			print sprintf("| %-29s | %-4s | %-29s | %-29s | %-2s | %-10s | %-29s\n",
1678
+				'topOfStack', 'last', 'lastType', 'state', 'ch', 'token', 'type');
1679
+			print sprintf("| %'-29s | %'-4s | %'-29s | %'-29s | %'-2s | %'-10s | %'-29s\n",
1680
+				'', '', '', '', '', '', '');
1682 1681
 			$first = false;
1683 1682
 		}
1684
-		print sprintf( "| %-29s | %-4s | %-29s | %-29s | %-2s | %-10s | %-29s\n",
1685
-			(string)$top, $last, $lastType, $state, $ch, $token, $type );
1683
+		print sprintf("| %-29s | %-4s | %-29s | %-29s | %-2s | %-10s | %-29s\n",
1684
+			(string) $top, $last, $lastType, $state, $ch, $token, $type);
1686 1685
 	}
1687 1686
 }
Please login to merge, or discard this patch.
sources/subs/Stats.subs.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 			'limit_posts' => $limit,
155 155
 		]
156 156
 	)->fetch_callback(
157
-		function ($row) use (&$top_posters, &$max_num_posts) {
157
+		function($row) use (&$top_posters, &$max_num_posts) {
158 158
 			$href = getUrl('profile', ['action' => 'profile', 'u' => $row['id_member'], 'name' => $row['real_name']]);
159 159
 
160 160
 			// Build general member information for each top poster
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 			'current_member' => User::$info->id,
230 230
 		]
231 231
 	)->fetch_callback(
232
-		function ($row) use (&$top_boards, &$max_num_posts, $read_status) {
232
+		function($row) use (&$top_boards, &$max_num_posts, $read_status) {
233 233
 			$href = getUrl('board', ['board' => $row['id_board'], 'start' => '0', 'name' => $row['name']]);
234 234
 
235 235
 			// Load the boards info, number of posts, topics etc
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 			'recycle_board' => $modSettings['recycle_board'],
300 300
 		]
301 301
 	)->fetch_callback(
302
-		function ($row) use (&$topic_ids) {
302
+		function($row) use (&$topic_ids) {
303 303
 			$topic_ids[$row['id_topic']] = $row['num_replies'];
304 304
 		}
305 305
 	);
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 			'topic_list' => array_keys($topic_ids),
322 322
 		]
323 323
 	)->fetch_callback(
324
-		function ($row) use (&$top_topics_replies, &$max_num_replies) {
324
+		function($row) use (&$top_topics_replies, &$max_num_replies) {
325 325
 			$href = getUrl('topic', ['topic' => $row['id_topic'], 'start' => '0', 'subject' => $row['subject']]);
326 326
 
327 327
 			// Build out this topics details for controller use
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 	);
340 340
 
341 341
 	// @todo dedupe this
342
-	usort($top_topics_replies, static function ($a, $b) {
342
+	usort($top_topics_replies, static function($a, $b) {
343 343
 		return $b['num_replies'] <=> $a['num_replies'];
344 344
 	});
345 345
 
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 				'no_views' => 0,
387 387
 			]
388 388
 		)->fetch_callback(
389
-			function ($row) use (&$topic_ids) {
389
+			function($row) use (&$topic_ids) {
390 390
 				$topic_ids[] = $row['id_topic'];
391 391
 			}
392 392
 		);
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 			'topic_views' => $limit,
414 414
 		]
415 415
 	)->fetch_callback(
416
-		function ($row) use (&$top_topics_views, &$max_num_views) {
416
+		function($row) use (&$top_topics_views, &$max_num_views) {
417 417
 			$board_href = getUrl('board', ['board' => $row['id_board'], 'start' => '0', 'name' => $row['name']]);
418 418
 			$topic_href = getUrl('topic', ['topic' => $row['id_topic'], 'start' => '0', 'subject' => $row['subject']]);
419 419
 
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 				'recycle_board' => $modSettings['recycle_board'],
481 481
 			]
482 482
 		)->fetch_callback(
483
-			function ($row) use (&$members) {
483
+			function($row) use (&$members) {
484 484
 				if ($row['id_member_started'] !== '0')
485 485
 				{
486 486
 					$members[(int) $row['id_member_started']] = (int) $row['hits'];
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 			'member_list' => array_keys($members),
511 511
 		]
512 512
 	)->fetch_callback(
513
-		function ($row) use (&$top_starters, $members, $max_num_topics) {
513
+		function($row) use (&$top_starters, $members, $max_num_topics) {
514 514
 			$href = getUrl('profile', ['action' => 'profile', 'u' => $row['id_member'], 'name' => $row['real_name']]);
515 515
 
516 516
 			// Our array of spammers, er topic starters !
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	);
528 528
 
529 529
 	// Even spammers must be orderly.
530
-	uksort($top_starters, static function ($a, $b) use ($members) {
530
+	uksort($top_starters, static function($a, $b) use ($members) {
531 531
 		return $members[$b] <=> $members[$a];
532 532
 	});
533 533
 
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
 		ORDER BY stats_day DESC',
724 724
 		$condition_parameters
725 725
 	)->fetch_callback(
726
-		function ($row) {
726
+		function($row) {
727 727
 			global $context;
728 728
 
729 729
 			$context['yearly'][$row['stats_year']]['months'][(int) $row['stats_month']]['days'][] = [
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
 			'limit' => (int) $limit,
872 872
 		]
873 873
 	)->fetch_callback(
874
-		function ($row) use (&$popular_boards, $memID) {
874
+		function($row) use (&$popular_boards, $memID) {
875 875
 			$href = getUrl('board', ['board' => $row['id_board'], 'start' => '0', 'name' => $row['name']]);
876 876
 			$posts = (int) MembersList::get($memID)->posts;
877 877
 
Please login to merge, or discard this patch.