Hashar has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/66961


Change subject: restore 'no space after cast' rule
......................................................................

restore 'no space after cast' rule

We had that debate at the beginning of 2013, when type casting, do not
use a space after the cast:

 (int)$foo;

http://www.mediawiki.org/w/index.php?title=Manual:Coding_conventions/PHP&diff=652478&oldid=648613

We do not want to use spaces:

 (int) $bar;

http://www.mediawiki.org/w/index.php?title=Manual:Coding_conventions/PHP&diff=674672&oldid=673901

Before this patch phpcs gaves out:

 (int)$foo;   // A cast statement must be followed by a single space
 ( int )$bar; // A cast statement must be followed by a single space
 ( int ) $bar;  // considered valid, should not
 ( int ) $bar;  // considered valid, should not

That is happening since 51dc215e https://gerrit.wikimedia.org/r/#/c/58637/
which did the following change:

-       <rule ref="Generic.Formatting.NoSpaceAfterCast" />
+       <rule ref="Generic.Formatting.SpaceAfterCast" />

We need to revert it again, aka like what I did in aa8c4d92
https://gerrit.wikimedia.org/r/#/c/45142/ :

-       <rule ref="Generic.Formatting.SpaceAfterCast" />
+       <rule ref="Generic.Formatting.NoSpaceAfterCast" />

This is what this patch is doing:

 (int)$foo;   // considered valid
 ( int )$bar; // considered valid
 ( int ) $bar;  // A cast statement must not be followed by a space
 ( int ) $bar;  // A cast statement must not be followed by a space

bug: 48450
Change-Id: I641535209fd477e7d56d8659015bb9c66f10ac68
---
M MediaWiki/ruleset.xml
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/codesniffer 
refs/changes/61/66961/1

diff --git a/MediaWiki/ruleset.xml b/MediaWiki/ruleset.xml
index ad1f88d..48a7a70 100644
--- a/MediaWiki/ruleset.xml
+++ b/MediaWiki/ruleset.xml
@@ -33,7 +33,8 @@
        <rule 
ref="Generic.Formatting.MultipleStatementAlignment.NotSameWarning">
                <severity>0</severity>
        </rule>
-       <rule ref="Generic.Formatting.SpaceAfterCast" />
+       <!-- Make sure we do NOT use space after a cast statement (bug 48450) 
-->
+       <rule ref="Generic.Formatting.NoSpaceAfterCast" />
        <rule ref="Generic.Functions.CallTimePassByReference" />
        <rule ref="Generic.Functions.FunctionCallArgumentSpacing" />
        <rule 
ref="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma">

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I641535209fd477e7d56d8659015bb9c66f10ac68
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/codesniffer
Gerrit-Branch: master
Gerrit-Owner: Hashar <[email protected]>

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

Reply via email to