PleaseStand has uploaded a new change for review.
https://gerrit.wikimedia.org/r/173106
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(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/code-utils
refs/changes/06/173106/1
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: newchange
Gerrit-Change-Id: I0eb6e3dd9e6eb35ef37478a59cca1dc3f8aadaf3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/code-utils
Gerrit-Branch: master
Gerrit-Owner: PleaseStand <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits