From 73b2d9986625e556d18988b144817cd0bf6af1c4 Mon Sep 17 00:00:00 2001
From: jrfnl <jrfnl@users.noreply.github.com>
Date: Fri, 1 Jul 2022 15:30:11 +0200
Subject: [PATCH] CS: fix spacing for incrementors and decrementors

No space allowed between the operator and the variable it applies to.
---
 src/wp-admin/includes/template.php                        | 2 +-
 src/wp-includes/functions.php                             | 2 +-
 src/wp-includes/sitemaps/class-wp-sitemaps-provider.php   | 2 +-
 tests/phpunit/includes/wp-profiler.php                    | 4 ++--
 tests/phpunit/tests/date/theDate.php                      | 2 +-
 tests/phpunit/tests/meta/isProtectedMeta.php              | 8 ++++----
 tests/phpunit/tests/rest-api/rest-sidebars-controller.php | 2 +-
 tests/phpunit/tests/rest-api/rest-widgets-controller.php  | 2 +-
 .../phpunit/tests/rest-api/wpRestMenuItemsController.php  | 4 ++--
 tests/phpunit/tests/theme/wpThemeJsonResolver.php         | 2 +-
 10 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/wp-admin/includes/template.php b/src/wp-admin/includes/template.php
index deecc92c50..3194524717 100644
--- a/src/wp-admin/includes/template.php
+++ b/src/wp-admin/includes/template.php
@@ -626,7 +626,7 @@ function _list_meta_row( $entry, &$count ) {
 	}
 
 	$r = '';
-	++ $count;
+	++$count;
 
 	if ( is_serialized( $entry['meta_value'] ) ) {
 		if ( is_serialized_string( $entry['meta_value'] ) ) {
diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
index 91fc777d82..a1e8bf9863 100644
--- a/src/wp-includes/functions.php
+++ b/src/wp-includes/functions.php
@@ -262,7 +262,7 @@ function wp_date( $format, $timestamp = null, $timezone = null ) {
 		$month         = $wp_locale->get_month( $datetime->format( 'm' ) );
 		$weekday       = $wp_locale->get_weekday( $datetime->format( 'w' ) );
 
-		for ( $i = 0; $i < $format_length; $i ++ ) {
+		for ( $i = 0; $i < $format_length; $i++ ) {
 			switch ( $format[ $i ] ) {
 				case 'D':
 					$new_format .= addcslashes( $wp_locale->get_weekday_abbrev( $weekday ), '\\A..Za..z' );
diff --git a/src/wp-includes/sitemaps/class-wp-sitemaps-provider.php b/src/wp-includes/sitemaps/class-wp-sitemaps-provider.php
index 81464c1bdb..1ff4987eca 100644
--- a/src/wp-includes/sitemaps/class-wp-sitemaps-provider.php
+++ b/src/wp-includes/sitemaps/class-wp-sitemaps-provider.php
@@ -107,7 +107,7 @@ abstract class WP_Sitemaps_Provider {
 		$sitemap_types = $this->get_sitemap_type_data();
 
 		foreach ( $sitemap_types as $type ) {
-			for ( $page = 1; $page <= $type['pages']; $page ++ ) {
+			for ( $page = 1; $page <= $type['pages']; $page++ ) {
 				$sitemap_entry = array(
 					'loc' => $this->get_sitemap_url( $type['name'], $page ),
 				);
diff --git a/tests/phpunit/includes/wp-profiler.php b/tests/phpunit/includes/wp-profiler.php
index 17c79ee51b..ce78ba4c8e 100644
--- a/tests/phpunit/includes/wp-profiler.php
+++ b/tests/phpunit/includes/wp-profiler.php
@@ -73,7 +73,7 @@ class WPProfiler {
 
 		if ( isset( $this->profile[ $name ] ) ) {
 			$this->profile[ $name ]['time'] += $time;
-			$this->profile[ $name ]['calls'] ++;
+			$this->profile[ $name ]['calls']++;
 			$this->profile[ $name ]['cache_cold_hits']    += ( $wp_object_cache->cold_cache_hits - $item['cache_cold_hits'] );
 			$this->profile[ $name ]['cache_warm_hits']    += ( $wp_object_cache->warm_cache_hits - $item['cache_warm_hits'] );
 			$this->profile[ $name ]['cache_misses']       += ( $wp_object_cache->cache_misses - $item['cache_misses'] );
@@ -143,7 +143,7 @@ class WPProfiler {
 			$sql = preg_replace( '/(WHERE \w+ =) \d+/', '$1 x', $sql );
 			$sql = preg_replace( '/(WHERE \w+ =) \'\[-\w]+\'/', '$1 \'xxx\'', $sql );
 
-			$out[ $sql ] ++;
+			$out[ $sql ]++;
 		}
 		asort( $out );
 		return;
diff --git a/tests/phpunit/tests/date/theDate.php b/tests/phpunit/tests/date/theDate.php
index b5fcb793df..2337ab61ec 100644
--- a/tests/phpunit/tests/date/theDate.php
+++ b/tests/phpunit/tests/date/theDate.php
@@ -80,7 +80,7 @@ class Tests_Date_TheDate extends WP_UnitTestCase {
 	}
 
 	public function count_hook( $input ) {
-		$this->hooks_called[ current_filter() ] ++;
+		$this->hooks_called[ current_filter() ]++;
 
 		return $input;
 	}
diff --git a/tests/phpunit/tests/meta/isProtectedMeta.php b/tests/phpunit/tests/meta/isProtectedMeta.php
index c204d381f5..46f20e72fa 100644
--- a/tests/phpunit/tests/meta/isProtectedMeta.php
+++ b/tests/phpunit/tests/meta/isProtectedMeta.php
@@ -17,10 +17,10 @@ class Tests_Meta_isProtectedMeta extends WP_UnitTestCase {
 		$protected_keys = array(
 			array( '_wp_attachment' ),
 		);
-		for ( $i = 0, $max = 31; $i < $max; $i ++ ) {
+		for ( $i = 0, $max = 31; $i < $max; $i++ ) {
 			$protected_keys[] = array( chr( $i ) . '_wp_attachment' );
 		}
-		for ( $i = 127, $max = 159; $i <= $max; $i ++ ) {
+		for ( $i = 127, $max = 159; $i <= $max; $i++ ) {
 			$protected_keys[] = array( chr( $i ) . '_wp_attachment' );
 		}
 		$protected_keys[] = array( chr( 95 ) . '_wp_attachment' );
@@ -42,10 +42,10 @@ class Tests_Meta_isProtectedMeta extends WP_UnitTestCase {
 			array( 'ąŌ_not_so_protected_meta' ),
 		);
 
-		for ( $i = 32, $max = 94; $i <= $max; $i ++ ) {
+		for ( $i = 32, $max = 94; $i <= $max; $i++ ) {
 			$unprotected_keys[] = array( chr( $i ) . '_wp_attachment' );
 		}
-		for ( $i = 96, $max = 126; $i <= $max; $i ++ ) {
+		for ( $i = 96, $max = 126; $i <= $max; $i++ ) {
 			$unprotected_keys[] = array( chr( $i ) . '_wp_attachment' );
 		}
 
diff --git a/tests/phpunit/tests/rest-api/rest-sidebars-controller.php b/tests/phpunit/tests/rest-api/rest-sidebars-controller.php
index e15a7f910a..e2745f519f 100644
--- a/tests/phpunit/tests/rest-api/rest-sidebars-controller.php
+++ b/tests/phpunit/tests/rest-api/rest-sidebars-controller.php
@@ -949,7 +949,7 @@ class WP_Test_REST_Sidebars_Controller extends WP_Test_REST_Controller_Testcase
 			if ( isset( $item['_links'] ) ) {
 				unset( $data[ $count ]['_links'] );
 			}
-			$count ++;
+			$count++;
 		}
 
 		return $data;
diff --git a/tests/phpunit/tests/rest-api/rest-widgets-controller.php b/tests/phpunit/tests/rest-api/rest-widgets-controller.php
index 28ac8bc6e3..05ea0cae64 100644
--- a/tests/phpunit/tests/rest-api/rest-widgets-controller.php
+++ b/tests/phpunit/tests/rest-api/rest-widgets-controller.php
@@ -1555,7 +1555,7 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
 			if ( is_array( $item ) && isset( $item['_links'] ) ) {
 				unset( $data[ $count ]['_links'] );
 			}
-			$count ++;
+			$count++;
 		}
 
 		return $data;
diff --git a/tests/phpunit/tests/rest-api/wpRestMenuItemsController.php b/tests/phpunit/tests/rest-api/wpRestMenuItemsController.php
index 9ef5b87d99..5eecd99d43 100644
--- a/tests/phpunit/tests/rest-api/wpRestMenuItemsController.php
+++ b/tests/phpunit/tests/rest-api/wpRestMenuItemsController.php
@@ -375,7 +375,7 @@ class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro
 		$new_menu_id = wp_create_nav_menu( rand_str() );
 		$expected    = array();
 		$actual      = array();
-		for ( $i = 1; $i < 5; $i ++ ) {
+		for ( $i = 1; $i < 5; $i++ ) {
 			$request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' );
 			$request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
 			$params = $this->set_menu_item_data(
@@ -921,7 +921,7 @@ class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro
 			foreach ( $taxonomies as $taxonomy ) {
 				$this->assertSame( $taxonomy->name, $links['https://api.w.org/term'][ $num ]['attributes']['taxonomy'] );
 				$this->assertSame( add_query_arg( 'post', $data['id'], rest_url( 'wp/v2/' . $taxonomy->rest_base ) ), $links['https://api.w.org/term'][ $num ]['href'] );
-				$num ++;
+				$num++;
 			}
 
 			if ( 'post_type' === $data['type'] ) {
diff --git a/tests/phpunit/tests/theme/wpThemeJsonResolver.php b/tests/phpunit/tests/theme/wpThemeJsonResolver.php
index 1cbc519255..795b3029aa 100644
--- a/tests/phpunit/tests/theme/wpThemeJsonResolver.php
+++ b/tests/phpunit/tests/theme/wpThemeJsonResolver.php
@@ -648,7 +648,7 @@ class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase {
 		$this->assertNotEmpty( $user_cpt, 'User CPT is expected not to be empty.' );
 
 		$global_styles_query_count = 0;
-		for ( $i = 0; $i < 3; $i ++ ) {
+		for ( $i = 0; $i < 3; $i++ ) {
 			$new_user_cpt = WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( $theme );
 			WP_Theme_JSON_Resolver::clean_cached_data();
 			$this->assertSameSets( $user_cpt, $new_user_cpt, "User CPTs do not match on run {$i}." );
-- 
2.38.1.windows.1

