r85004 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85003‎ | r85004 | r85005 >
Date:12:04, 30 March 2011
Author:reedy
Status:ok (Comments)
Tags:
Comment:
Fixup some ambiguously defined variables

Cast a substr back to int
Modified paths:
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/languages/Language.php
@@ -1086,7 +1086,7 @@
10871087 private static function tsToIranian( $ts ) {
10881088 $gy = substr( $ts, 0, 4 ) -1600;
10891089 $gm = substr( $ts, 4, 2 ) -1;
1090 - $gd = substr( $ts, 6, 2 ) -1;
 1090+ $gd = (int)substr( $ts, 6, 2 ) -1;
10911091
10921092 # Days passed from the beginning (including leap years)
10931093 $gDayNo = 365 * $gy
@@ -2503,8 +2503,9 @@
25042504 $tagType = 0; // 0-open, 1-close
25052505 $bracketState = 0; // 1-tag start, 2-tag name, 0-neither
25062506 $entityState = 0; // 0-not entity, 1-entity
2507 - $tag = $ret = ''; // accumulated tag name, accumulated result string
 2507+ $tag = $ret = $pRet = ''; // accumulated tag name, accumulated result string
25082508 $openTags = array(); // open tag stack
 2509+ $pOpenTags = array();
25092510
25102511 $textLen = strlen( $text );
25112512 $neLength = max( 0, $length - strlen( $ellipsis ) ); // non-ellipsis len if truncated

Follow-up revisions

RevisionCommit summaryAuthorDate
r89680remove useless type hint (fu r85004)hashar19:58, 7 June 2011

Comments

#Comment by Hashar (talk | contribs)   19:59, 7 June 2011

type hint removed in 89680.

Either cast them all ($gy, $gm, $gd) or none. Hint cast seems useless anyway and just make code harder to read there.

Status & tagging log