Siebrand has uploaded a new change for review.
https://gerrit.wikimedia.org/r/275793
Change subject: Remove PHP4-isms in type casting
......................................................................
Remove PHP4-isms in type casting
Change-Id: I0ec1ecec14623a79ad52e7ff9285849398f48d3c
---
M Expr.php
M ParserFunctions_body.php
2 files changed, 10 insertions(+), 10 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ParserFunctions
refs/changes/93/275793/1
diff --git a/Expr.php b/Expr.php
index 394fd25..1ceb3fa 100644
--- a/Expr.php
+++ b/Expr.php
@@ -217,7 +217,7 @@
// Find the rest of it
$length = strspn( $expr, EXPR_NUMBER_CLASS, $p
);
// Convert it to float, silently removing
double decimal points
- $operands[] = floatval( substr( $expr, $p,
$length ) );
+ $operands[] = (float)substr( $expr, $p, $length
);
$p += $length;
$expecting = 'operator';
continue;
@@ -504,7 +504,7 @@
if ( count( $stack ) < 2 ) {
throw new ExprError( 'missing_operand',
$this->names[$op] );
}
- $digits = intval( array_pop( $stack ) );
+ $digits = (int)array_pop( $stack );
$value = array_pop( $stack );
$stack[] = round( $value, $digits );
break;
diff --git a/ParserFunctions_body.php b/ParserFunctions_body.php
index 3be2aa0..f8e58ac 100644
--- a/ParserFunctions_body.php
+++ b/ParserFunctions_body.php
@@ -63,7 +63,7 @@
try {
$ret = self::getExprParser()->doExpression( $expr );
if ( is_numeric( $ret ) ) {
- $ret = floatval( $ret );
+ $ret = (float)$ret;
}
if ( $ret ) {
return $then;
@@ -537,8 +537,8 @@
* @return string
*/
public static function titleparts( $parser, $title = '', $parts = 0,
$offset = 0 ) {
- $parts = intval( $parts );
- $offset = intval( $offset );
+ $parts = (int)$parts;
+ $offset = (int)$offset;
$ntitle = Title::newFromText( $title );
if ( $ntitle instanceof Title ) {
$bits = explode( '/', $ntitle->getPrefixedText(), 25 );
@@ -616,7 +616,7 @@
if ( $inNeedle === '' ) { $inNeedle = ' '; }
- $pos = mb_strpos( $inStr, $inNeedle, intval( $inOffset ) );
+ $pos = mb_strpos( $inStr, $inNeedle, (int)$inOffset );
if ( $pos === false ) { $pos = ""; }
return $pos;
@@ -676,10 +676,10 @@
return self::tooLongError();
}
- if ( intval( $inLength ) === 0 ) {
- $result = mb_substr( $inStr, intval( $inStart ) );
+ if ( (int)$inLength === 0 ) {
+ $result = mb_substr( $inStr, (int)$inStart );
} else {
- $result = mb_substr( $inStr, intval( $inStart ),
intval( $inLength ) );
+ $result = mb_substr( $inStr, (int)$inStart,
(int)$inLength );
}
return $result;
@@ -753,7 +753,7 @@
$limit = -1;
}
- $inLimit = intval( $inLimit );
+ $inLimit = (int)$inLimit;
if ( $inLimit >= 0 ) {
if ( $limit > $inLimit || $limit === -1 ) {
$limit = $inLimit;
--
To view, visit https://gerrit.wikimedia.org/r/275793
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0ec1ecec14623a79ad52e7ff9285849398f48d3c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ParserFunctions
Gerrit-Branch: master
Gerrit-Owner: Siebrand <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits