From 32c0ccbd46797c912152df9de57d1c6bdf71f041 Mon Sep 17 00:00:00 2001 From: Christopher Kanitz Date: Thu, 20 Jun 2019 12:03:00 +0200 Subject: [PATCH 01/17] Create OperatorSpacingStandard.xml --- .../WhiteSpace/OperatorSpacingStandard.xml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml diff --git a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml new file mode 100644 index 0000000000..4cefaafadb --- /dev/null +++ b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + From af4db405a41ef586ebf796b2a06cf5ee0137f8e1 Mon Sep 17 00:00:00 2001 From: Christopher Kanitz Date: Tue, 25 Jun 2019 16:24:30 +0200 Subject: [PATCH 02/17] only indent with spaces --- .../WhiteSpace/OperatorSpacingStandard.xml | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml index 4cefaafadb..6aa6bcb6c7 100644 --- a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml +++ b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml @@ -11,26 +11,26 @@ if ( $a === $b && $b === $c ) {} if ( ! $var ) {} ]]> - + - - - - + + + - - - + + + - - + ]]> + + From d1180d963cd8f72d3d5796dfcb383895ff531840 Mon Sep 17 00:00:00 2001 From: Christopher Kanitz Date: Tue, 25 Jun 2019 16:25:12 +0200 Subject: [PATCH 03/17] adjust invalid example --- WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml index 6aa6bcb6c7..3db7236bb2 100644 --- a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml +++ b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml @@ -22,7 +22,7 @@ if ( $a === $b From e73eaebb70275f93c4db7f0cce5540dfd79672b0 Mon Sep 17 00:00:00 2001 From: Christopher Kanitz Date: Tue, 2 Jul 2019 10:41:19 +0200 Subject: [PATCH 04/17] Update WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml Co-Authored-By: Juliette <663378+jrfnl@users.noreply.github.com> --- WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml index 3db7236bb2..99bec8f37e 100644 --- a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml +++ b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml @@ -1,7 +1,7 @@ From 26253a1d68684f724c0e50754d160bb7ccd971f4 Mon Sep 17 00:00:00 2001 From: Christopher Kanitz Date: Tue, 2 Jul 2019 10:41:28 +0200 Subject: [PATCH 05/17] Update WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml Co-Authored-By: Juliette <663378+jrfnl@users.noreply.github.com> --- WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml index 99bec8f37e..0e2c434112 100644 --- a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml +++ b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml @@ -7,7 +7,7 @@ === $b && $b === $c ) {} if ( ! $var ) {} ]]> From e98bb648af90ebc83035c33d27c1cceed6b9463e Mon Sep 17 00:00:00 2001 From: Christopher Kanitz Date: Tue, 2 Jul 2019 10:41:36 +0200 Subject: [PATCH 06/17] Update WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml Co-Authored-By: Juliette <663378+jrfnl@users.noreply.github.com> --- WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml index 0e2c434112..e3ec881ea0 100644 --- a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml +++ b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml @@ -13,7 +13,7 @@ if ( ! $var ) {} && $b === $c ) {} ]]> From 4b8374191e2ba4c8db9961bf3a67e3082d3000d4 Mon Sep 17 00:00:00 2001 From: Christopher Kanitz Date: Tue, 2 Jul 2019 10:41:47 +0200 Subject: [PATCH 07/17] Update WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml Co-Authored-By: Juliette <663378+jrfnl@users.noreply.github.com> --- WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml index e3ec881ea0..b6ed0b152f 100644 --- a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml +++ b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml @@ -14,7 +14,7 @@ if ( ! $var ) {} - && $b === $c + && $b === $c ) {} ]]> From d13feb70ecb22adc56abd6e0918bb72daeb23977 Mon Sep 17 00:00:00 2001 From: Christopher Kanitz Date: Tue, 2 Jul 2019 10:41:56 +0200 Subject: [PATCH 08/17] Update WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml Co-Authored-By: Juliette <663378+jrfnl@users.noreply.github.com> --- WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml index b6ed0b152f..5db7adb297 100644 --- a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml +++ b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml @@ -22,7 +22,7 @@ if ( $a === $b ===$b &&$b ===$c ) {} if ( !$var ) {} ]]> From 7fc6865a47ba515d7b67dd1aa4fdf3d2a49011a6 Mon Sep 17 00:00:00 2001 From: Christopher Kanitz Date: Tue, 2 Jul 2019 10:42:05 +0200 Subject: [PATCH 09/17] Update WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml Co-Authored-By: Juliette <663378+jrfnl@users.noreply.github.com> --- WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml index 5db7adb297..59e3f33db1 100644 --- a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml +++ b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml @@ -28,7 +28,7 @@ if ( !$var ) {} && $b === $c ) {} if ( ! $var ) {} ]]> From 4c5f5c6fda5c4a743bad1e37239b2b82e9bb33ee Mon Sep 17 00:00:00 2001 From: Christopher Kanitz Date: Tue, 2 Jul 2019 10:42:12 +0200 Subject: [PATCH 10/17] Update WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml Co-Authored-By: Juliette <663378+jrfnl@users.noreply.github.com> --- WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml index 59e3f33db1..a053fa46d2 100644 --- a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml +++ b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml @@ -29,7 +29,7 @@ if ( !$var ) {} && $b === $c ) {} -if ( ! $var ) {} +if ( ! $var ) {} ]]> From 6624d7da43256b5c7082a00868bc73bb345be3b5 Mon Sep 17 00:00:00 2001 From: Christopher Kanitz Date: Tue, 2 Jul 2019 10:42:21 +0200 Subject: [PATCH 11/17] Update WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml Co-Authored-By: Juliette <663378+jrfnl@users.noreply.github.com> --- WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml index a053fa46d2..d752e41933 100644 --- a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml +++ b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml @@ -23,7 +23,7 @@ if ( $a === $b ===$b &&$b ===$c ) {} -if ( !$var ) {} +if ( !$var ) {} ]]> From c40d6b3640fd3133bf6b8dd2181920e912d0a492 Mon Sep 17 00:00:00 2001 From: Christopher Kanitz Date: Tue, 2 Jul 2019 10:42:28 +0200 Subject: [PATCH 12/17] Update WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml Co-Authored-By: Juliette <663378+jrfnl@users.noreply.github.com> --- WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml index d752e41933..9f5f8fd14b 100644 --- a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml +++ b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml @@ -8,7 +8,7 @@ === $b && $b === $c ) {} -if ( ! $var ) {} +if ( ! $var ) {} ]]> From 4f405c4489f292398ffcb9dfadf6f258e9899873 Mon Sep 17 00:00:00 2001 From: Christopher Kanitz Date: Tue, 2 Jul 2019 10:52:00 +0200 Subject: [PATCH 13/17] rearange valid/invalid examples --- .../WhiteSpace/OperatorSpacingStandard.xml | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml index 9f5f8fd14b..72511c4bc5 100644 --- a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml +++ b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml @@ -11,25 +11,31 @@ if ( $a === $b && $b === $c ) {} if ( ! $var ) {} ]]> - + - && $b === $c -) {} +// Too much space. +if ( $a === $b && $b === $c ) {} +if ( ! $var ) {} + +// Too little space. +if ( $a===$b &&$b ===$c ) {} +if ( !$var ) {} ]]> - + ===$b &&$b ===$c ) {} -if ( !$var ) {} +if ( $a === $b + && $b === $c +) {} ]]> - + && $b === $c ) {} -if ( ! $var ) {} +if ( $a === $b + && $b === $c +) {} ]]> From aab1385e64bb947aa0d9f3d35379b68467cd06ce Mon Sep 17 00:00:00 2001 From: Christopher Kanitz Date: Mon, 15 Jul 2019 11:10:50 +0200 Subject: [PATCH 14/17] get rid of tabstops --- WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml index 72511c4bc5..2439b99648 100644 --- a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml +++ b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml @@ -31,7 +31,7 @@ if ( $a === $b ) {} ]]> - + && $b === $c From 5d6e552600fe6625ec7092a8c68c210dbf267242 Mon Sep 17 00:00:00 2001 From: Christopher Kanitz Date: Mon, 15 Jul 2019 11:11:50 +0200 Subject: [PATCH 15/17] adjust example description --- WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml index 2439b99648..9e287ae2b9 100644 --- a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml +++ b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml @@ -24,7 +24,7 @@ if ( !$var ) {} - + && $b === $c From b46e8a543e1dc09730ccfe8a1627e8cef89dea63 Mon Sep 17 00:00:00 2001 From: Christopher Kanitz Date: Mon, 15 Jul 2019 11:16:56 +0200 Subject: [PATCH 16/17] rephrase the description text --- WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml index 9e287ae2b9..d4a4ada5d8 100644 --- a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml +++ b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml @@ -1,7 +1,7 @@ From 030cd5ff6e3059a3ba75918718a8c9551587769c Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 16 May 2022 15:22:38 +0200 Subject: [PATCH 17/17] Docs/OperatorSpacing: minor fixes after review * Be more explicit about which operators are covered by the sniff and what is expected. * Add a code sample showing that for assignment operators, only the space after the operator is checked (as the space before is determined by alignment). --- .../WhiteSpace/OperatorSpacingStandard.xml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml index d4a4ada5d8..ca17e57ff5 100644 --- a/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml +++ b/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml @@ -1,11 +1,12 @@ - + === $b && $b === $c ) {} if ( ! $var ) {} @@ -39,4 +40,18 @@ if ( $a === $b ]]> + + + = 'foo'; +$all = 'foobar'; + ]]> + + + = 'foo'; +$all ='foobar'; + ]]> + +