jenkins-bot has submitted this change and it was merged.

Change subject: stylize.php: Don't add whitespace in strange places
......................................................................


stylize.php: Don't add whitespace in strange places

For example, don't change this:

    $a = $b ?: $c->{ $d };

to this:

    $a = $b ? : $c-> { $d } ;

Specifically, do not add a space after '}' or between '?' and ':'
or '->' and '{'. This can be done merely by editing the tables.

Also, add a space on both sides of '?:' by adding a space after ':'.
As before, this is far from perfect because of case labels, and I
would like to keep more extensive code changes separate from these
simple table changes.

Change-Id: I0eb6e3dd9e6eb35ef37478a59cca1dc3f8aadaf3
---
M stylize.php
1 file changed, 4 insertions(+), 2 deletions(-)

Approvals:
  Bartosz Dziewoński: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/stylize.php b/stylize.php
index 8971534..7951f8d 100755
--- a/stylize.php
+++ b/stylize.php
@@ -155,7 +155,6 @@
                T_WHILE,
                T_XOR_EQUAL,
                '{',
-               '}',
                '%',
                '^',
                // '&', can be unary, we have a special case for =&
@@ -163,7 +162,6 @@
                '=',
                '+',
                '|',
-               // ':', can be a case label
                '.',
                '<',
                '>',
@@ -172,17 +170,21 @@
        );
        static $spaceBefore = array(
                ')',
+               '}',
                '-', // $foo = -1; shouldn't change to $foo = - 1;
        );
        static $spaceAfter = array(
                '(',
                ';',
                ',',
+               ':', // can be a case label
        );
        static $closePairs = array(
                '(' => ')',
                '=' => '&',
                '{' => '}',
+               '?' => ':',
+               T_OBJECT_OPERATOR => '{',
        );
 
        // Tokens that eat spaces after them

-- 
To view, visit https://gerrit.wikimedia.org/r/173106
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0eb6e3dd9e6eb35ef37478a59cca1dc3f8aadaf3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/code-utils
Gerrit-Branch: master
Gerrit-Owner: PleaseStand <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: IAlex <[email protected]>
Gerrit-Reviewer: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Platonides <[email protected]>
Gerrit-Reviewer: PleaseStand <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to