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
|
b
|
function _list_meta_row( $entry, &$count ) { |
626 | 626 | } |
627 | 627 | |
628 | 628 | $r = ''; |
629 | | ++ $count; |
| 629 | ++$count; |
630 | 630 | |
631 | 631 | if ( is_serialized( $entry['meta_value'] ) ) { |
632 | 632 | 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
|
b
|
function wp_date( $format, $timestamp = null, $timezone = null ) { |
262 | 262 | $month = $wp_locale->get_month( $datetime->format( 'm' ) ); |
263 | 263 | $weekday = $wp_locale->get_weekday( $datetime->format( 'w' ) ); |
264 | 264 | |
265 | | for ( $i = 0; $i < $format_length; $i ++ ) { |
| 265 | for ( $i = 0; $i < $format_length; $i++ ) { |
266 | 266 | switch ( $format[ $i ] ) { |
267 | 267 | case 'D': |
268 | 268 | $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
|
b
|
abstract class WP_Sitemaps_Provider { |
107 | 107 | $sitemap_types = $this->get_sitemap_type_data(); |
108 | 108 | |
109 | 109 | foreach ( $sitemap_types as $type ) { |
110 | | for ( $page = 1; $page <= $type['pages']; $page ++ ) { |
| 110 | for ( $page = 1; $page <= $type['pages']; $page++ ) { |
111 | 111 | $sitemap_entry = array( |
112 | 112 | 'loc' => $this->get_sitemap_url( $type['name'], $page ), |
113 | 113 | ); |
diff --git a/tests/phpunit/includes/wp-profiler.php b/tests/phpunit/includes/wp-profiler.php
index 17c79ee51b..ce78ba4c8e 100644
a
|
b
|
class WPProfiler { |
73 | 73 | |
74 | 74 | if ( isset( $this->profile[ $name ] ) ) { |
75 | 75 | $this->profile[ $name ]['time'] += $time; |
76 | | $this->profile[ $name ]['calls'] ++; |
| 76 | $this->profile[ $name ]['calls']++; |
77 | 77 | $this->profile[ $name ]['cache_cold_hits'] += ( $wp_object_cache->cold_cache_hits - $item['cache_cold_hits'] ); |
78 | 78 | $this->profile[ $name ]['cache_warm_hits'] += ( $wp_object_cache->warm_cache_hits - $item['cache_warm_hits'] ); |
79 | 79 | $this->profile[ $name ]['cache_misses'] += ( $wp_object_cache->cache_misses - $item['cache_misses'] ); |
… |
… |
class WPProfiler { |
143 | 143 | $sql = preg_replace( '/(WHERE \w+ =) \d+/', '$1 x', $sql ); |
144 | 144 | $sql = preg_replace( '/(WHERE \w+ =) \'\[-\w]+\'/', '$1 \'xxx\'', $sql ); |
145 | 145 | |
146 | | $out[ $sql ] ++; |
| 146 | $out[ $sql ]++; |
147 | 147 | } |
148 | 148 | asort( $out ); |
149 | 149 | return; |
diff --git a/tests/phpunit/tests/date/theDate.php b/tests/phpunit/tests/date/theDate.php
index b5fcb793df..2337ab61ec 100644
a
|
b
|
class Tests_Date_TheDate extends WP_UnitTestCase { |
80 | 80 | } |
81 | 81 | |
82 | 82 | public function count_hook( $input ) { |
83 | | $this->hooks_called[ current_filter() ] ++; |
| 83 | $this->hooks_called[ current_filter() ]++; |
84 | 84 | |
85 | 85 | return $input; |
86 | 86 | } |
diff --git a/tests/phpunit/tests/meta/isProtectedMeta.php b/tests/phpunit/tests/meta/isProtectedMeta.php
index c204d381f5..46f20e72fa 100644
a
|
b
|
class Tests_Meta_isProtectedMeta extends WP_UnitTestCase { |
17 | 17 | $protected_keys = array( |
18 | 18 | array( '_wp_attachment' ), |
19 | 19 | ); |
20 | | for ( $i = 0, $max = 31; $i < $max; $i ++ ) { |
| 20 | for ( $i = 0, $max = 31; $i < $max; $i++ ) { |
21 | 21 | $protected_keys[] = array( chr( $i ) . '_wp_attachment' ); |
22 | 22 | } |
23 | | for ( $i = 127, $max = 159; $i <= $max; $i ++ ) { |
| 23 | for ( $i = 127, $max = 159; $i <= $max; $i++ ) { |
24 | 24 | $protected_keys[] = array( chr( $i ) . '_wp_attachment' ); |
25 | 25 | } |
26 | 26 | $protected_keys[] = array( chr( 95 ) . '_wp_attachment' ); |
… |
… |
class Tests_Meta_isProtectedMeta extends WP_UnitTestCase { |
42 | 42 | array( 'ąŌ_not_so_protected_meta' ), |
43 | 43 | ); |
44 | 44 | |
45 | | for ( $i = 32, $max = 94; $i <= $max; $i ++ ) { |
| 45 | for ( $i = 32, $max = 94; $i <= $max; $i++ ) { |
46 | 46 | $unprotected_keys[] = array( chr( $i ) . '_wp_attachment' ); |
47 | 47 | } |
48 | | for ( $i = 96, $max = 126; $i <= $max; $i ++ ) { |
| 48 | for ( $i = 96, $max = 126; $i <= $max; $i++ ) { |
49 | 49 | $unprotected_keys[] = array( chr( $i ) . '_wp_attachment' ); |
50 | 50 | } |
51 | 51 | |
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
|
b
|
class WP_Test_REST_Sidebars_Controller extends WP_Test_REST_Controller_Testcase |
949 | 949 | if ( isset( $item['_links'] ) ) { |
950 | 950 | unset( $data[ $count ]['_links'] ); |
951 | 951 | } |
952 | | $count ++; |
| 952 | $count++; |
953 | 953 | } |
954 | 954 | |
955 | 955 | 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
|
b
|
class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase { |
1555 | 1555 | if ( is_array( $item ) && isset( $item['_links'] ) ) { |
1556 | 1556 | unset( $data[ $count ]['_links'] ); |
1557 | 1557 | } |
1558 | | $count ++; |
| 1558 | $count++; |
1559 | 1559 | } |
1560 | 1560 | |
1561 | 1561 | 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
|
b
|
class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro |
375 | 375 | $new_menu_id = wp_create_nav_menu( rand_str() ); |
376 | 376 | $expected = array(); |
377 | 377 | $actual = array(); |
378 | | for ( $i = 1; $i < 5; $i ++ ) { |
| 378 | for ( $i = 1; $i < 5; $i++ ) { |
379 | 379 | $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' ); |
380 | 380 | $request->add_header( 'content-type', 'application/x-www-form-urlencoded' ); |
381 | 381 | $params = $this->set_menu_item_data( |
… |
… |
class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro |
921 | 921 | foreach ( $taxonomies as $taxonomy ) { |
922 | 922 | $this->assertSame( $taxonomy->name, $links['https://api.w.org/term'][ $num ]['attributes']['taxonomy'] ); |
923 | 923 | $this->assertSame( add_query_arg( 'post', $data['id'], rest_url( 'wp/v2/' . $taxonomy->rest_base ) ), $links['https://api.w.org/term'][ $num ]['href'] ); |
924 | | $num ++; |
| 924 | $num++; |
925 | 925 | } |
926 | 926 | |
927 | 927 | 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
|
b
|
class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase { |
648 | 648 | $this->assertNotEmpty( $user_cpt, 'User CPT is expected not to be empty.' ); |
649 | 649 | |
650 | 650 | $global_styles_query_count = 0; |
651 | | for ( $i = 0; $i < 3; $i ++ ) { |
| 651 | for ( $i = 0; $i < 3; $i++ ) { |
652 | 652 | $new_user_cpt = WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( $theme ); |
653 | 653 | WP_Theme_JSON_Resolver::clean_cached_data(); |
654 | 654 | $this->assertSameSets( $user_cpt, $new_user_cpt, "User CPTs do not match on run {$i}." ); |