Use (int) rather than intval()
authorReedy <reedy@wikimedia.org>
Mon, 25 Feb 2019 00:38:33 +0000 (00:38 +0000)
committerReedy <reedy@wikimedia.org>
Mon, 25 Feb 2019 00:38:33 +0000 (00:38 +0000)
Bug: T216969
Change-Id: I4c06716c83b69d128f26fa7f68736808aa2d3d64

48 files changed:
includes/api/ApiBase.php
includes/api/ApiEditPage.php
includes/api/ApiFeedContributions.php
includes/api/ApiFeedWatchlist.php
includes/api/ApiImport.php
includes/api/ApiLogin.php
includes/api/ApiMain.php
includes/api/ApiPageSet.php
includes/api/ApiParamInfo.php
includes/api/ApiParse.php
includes/api/ApiPatrol.php
includes/api/ApiQueryAllCategories.php
includes/api/ApiQueryAllDeletedRevisions.php
includes/api/ApiQueryAllImages.php
includes/api/ApiQueryAllLinks.php
includes/api/ApiQueryAllPages.php
includes/api/ApiQueryAllUsers.php
includes/api/ApiQueryBacklinks.php
includes/api/ApiQueryBase.php
includes/api/ApiQueryCategories.php
includes/api/ApiQueryCategoryInfo.php
includes/api/ApiQueryCategoryMembers.php
includes/api/ApiQueryDeletedRevisions.php
includes/api/ApiQueryDeletedrevs.php
includes/api/ApiQueryExtLinksUsage.php
includes/api/ApiQueryIWBacklinks.php
includes/api/ApiQueryIWLinks.php
includes/api/ApiQueryImageInfo.php
includes/api/ApiQueryImages.php
includes/api/ApiQueryInfo.php
includes/api/ApiQueryLangBacklinks.php
includes/api/ApiQueryLangLinks.php
includes/api/ApiQueryLinks.php
includes/api/ApiQueryLogEvents.php
includes/api/ApiQueryPageProps.php
includes/api/ApiQueryPrefixSearch.php
includes/api/ApiQueryRecentChanges.php
includes/api/ApiQueryRevisions.php
includes/api/ApiQueryRevisionsBase.php
includes/api/ApiQuerySiteinfo.php
includes/api/ApiQueryTags.php
includes/api/ApiQueryUserContribs.php
includes/api/ApiQueryUserInfo.php
includes/api/ApiQueryWatchlist.php
includes/api/ApiQueryWatchlistRaw.php
includes/api/ApiRollback.php
includes/api/ApiSetNotificationTimestamp.php
includes/api/ApiUndelete.php

index dfaff8b..4898385 100644 (file)
@@ -1282,7 +1282,7 @@ abstract class ApiBase extends ContextSource {
                                                                }
                                                        }
                                                } else {
-                                                       $value = intval( $value );
+                                                       $value = (int)$value;
                                                        if ( !is_null( $min ) || !is_null( $max ) ) {
                                                                $this->validateLimit( $paramName, $value, $min, $max, null, $enforceLimits );
                                                        }
@@ -1311,7 +1311,7 @@ abstract class ApiBase extends ContextSource {
                                                                : $paramSettings[self::PARAM_MAX];
                                                        $this->getResult()->addParsedLimit( $this->getModuleName(), $value );
                                                } else {
-                                                       $value = intval( $value );
+                                                       $value = (int)$value;
                                                        $this->validateLimit(
                                                                $paramName,
                                                                $value,
index 8131ea5..d0a0523 100644 (file)
@@ -427,15 +427,15 @@ class ApiEditPage extends ApiBase {
 
                        case EditPage::AS_SUCCESS_UPDATE:
                                $r['result'] = 'Success';
-                               $r['pageid'] = intval( $titleObj->getArticleID() );
+                               $r['pageid'] = (int)$titleObj->getArticleID();
                                $r['title'] = $titleObj->getPrefixedText();
                                $r['contentmodel'] = $articleObject->getContentModel();
                                $newRevId = $articleObject->getLatest();
                                if ( $newRevId == $oldRevId ) {
                                        $r['nochange'] = true;
                                } else {
-                                       $r['oldrevid'] = intval( $oldRevId );
-                                       $r['newrevid'] = intval( $newRevId );
+                                       $r['oldrevid'] = (int)$oldRevId;
+                                       $r['newrevid'] = (int)$newRevId;
                                        $r['newtimestamp'] = wfTimestamp( TS_ISO_8601,
                                                $pageObj->getTimestamp() );
                                }
index 2492db2..ed3b7b8 100644 (file)
@@ -137,7 +137,7 @@ class ApiFeedContributions extends ApiBase {
                }
 
                // Hook completed and did not return a valid feed item
-               $title = Title::makeTitle( intval( $row->page_namespace ), $row->page_title );
+               $title = Title::makeTitle( (int)$row->page_namespace, $row->page_title );
                if ( $title && $title->userCan( 'read', $this->getUser() ) ) {
                        $date = $row->rev_timestamp;
                        $comments = $title->getTalkPage()->getFullURL();
index 8c0b42d..935bb09 100644 (file)
@@ -61,7 +61,7 @@ class ApiFeedWatchlist extends ApiBase {
                        }
 
                        // limit to the number of hours going from now back
-                       $endTime = wfTimestamp( TS_MW, time() - intval( $params['hours'] * 60 * 60 ) );
+                       $endTime = wfTimestamp( TS_MW, time() - (int)$params['hours'] * 60 * 60 );
 
                        // Prepare parameters for nested request
                        $fauxReqArr = [
index 822711a..596ab75 100644 (file)
@@ -207,7 +207,7 @@ class ApiImportReporter extends ImportReporter {
                        $r['invalid'] = true;
                } else {
                        ApiQueryBase::addTitleInfo( $r, $title );
-                       $r['revisions'] = intval( $successCount );
+                       $r['revisions'] = (int)$successCount;
                }
 
                $this->mResultArr[] = $r;
index 8f2e759..133f0ce 100644 (file)
@@ -197,7 +197,7 @@ class ApiLogin extends ApiBase {
                                $injected_html = '';
                                Hooks::run( 'UserLoginComplete', [ &$user, &$injected_html, true ] );
 
-                               $result['lguserid'] = intval( $user->getId() );
+                               $result['lguserid'] = (int)$user->getId();
                                $result['lgusername'] = $user->getName();
                                break;
 
index 3cc3407..634ebd1 100644 (file)
@@ -1277,8 +1277,8 @@ class ApiMain extends ApiBase {
                        if ( $lagInfo['lag'] > $maxLag ) {
                                $response = $this->getRequest()->response();
 
-                               $response->header( 'Retry-After: ' . max( intval( $maxLag ), 5 ) );
-                               $response->header( 'X-Database-Lag: ' . intval( $lagInfo['lag'] ) );
+                               $response->header( 'Retry-After: ' . max( (int)$maxLag, 5 ) );
+                               $response->header( 'X-Database-Lag: ' . (int)$lagInfo['lag'] );
 
                                if ( $this->getConfig()->get( 'ShowHostnames' ) ) {
                                        $this->dieWithError(
index 4ffe873..450ebb6 100644 (file)
@@ -760,7 +760,7 @@ class ApiPageSet extends ApiBase {
                $linkCache = MediaWikiServices::getInstance()->getLinkCache();
                $linkCache->addGoodLinkObjFromRow( $title, $row );
 
-               $pageId = intval( $row->page_id );
+               $pageId = (int)$row->page_id;
                $this->mAllPages[$row->page_namespace][$row->page_title] = $pageId;
                $this->mTitles[] = $title;
 
@@ -869,7 +869,7 @@ class ApiPageSet extends ApiBase {
                $usernames = [];
                if ( $res ) {
                        foreach ( $res as $row ) {
-                               $pageId = intval( $row->page_id );
+                               $pageId = (int)$row->page_id;
 
                                // Remove found page from the list of remaining items
                                if ( isset( $remaining ) ) {
@@ -953,8 +953,8 @@ class ApiPageSet extends ApiBase {
                        // Get pageIDs data from the `page` table
                        $res = $db->select( $tables, $fields, $where, __METHOD__ );
                        foreach ( $res as $row ) {
-                               $revid = intval( $row->rev_id );
-                               $pageid = intval( $row->rev_page );
+                               $revid = (int)$row->rev_id;
+                               $pageid = (int)$row->rev_page;
                                $this->mGoodRevIDs[$revid] = $pageid;
                                $this->mLiveRevIDs[$revid] = $pageid;
                                $pageids[$pageid] = '';
@@ -977,7 +977,7 @@ class ApiPageSet extends ApiBase {
                        $res = $db->select( $tables, $fields, $where, __METHOD__ );
                        $titles = [];
                        foreach ( $res as $row ) {
-                               $revid = intval( $row->ar_rev_id );
+                               $revid = (int)$row->ar_rev_id;
                                $titles[$revid] = Title::makeTitle( $row->ar_namespace, $row->ar_title );
                                unset( $remaining[$revid] );
                        }
@@ -1068,7 +1068,7 @@ class ApiPageSet extends ApiBase {
                                        __METHOD__
                                );
                        foreach ( $res as $row ) {
-                               $rdfrom = intval( $row->rd_from );
+                               $rdfrom = (int)$row->rd_from;
                                $from = $this->mPendingRedirectIDs[$rdfrom]->getPrefixedText();
                                $to = Title::makeTitle(
                                        $row->rd_namespace,
index c81cf7e..f196735 100644 (file)
@@ -361,7 +361,7 @@ class ApiParamInfo extends ApiBase {
                                                break;
                                        case 'integer':
                                        case 'limit':
-                                               $item['default'] = intval( $settings[ApiBase::PARAM_DFLT] );
+                                               $item['default'] = (int)$settings[ApiBase::PARAM_DFLT];
                                                break;
                                        case 'timestamp':
                                                $item['default'] = wfTimestamp( TS_ISO_8601, $settings[ApiBase::PARAM_DFLT] );
index 9f561b7..855b73d 100644 (file)
@@ -330,7 +330,7 @@ class ApiParse extends ApiBase {
                }
 
                if ( !is_null( $oldid ) ) {
-                       $result_array['revid'] = intval( $oldid );
+                       $result_array['revid'] = (int)$oldid;
                }
 
                if ( $params['redirects'] && !is_null( $redirValues ) ) {
index 2b65f95..d1212f3 100644 (file)
@@ -71,7 +71,7 @@ class ApiPatrol extends ApiBase {
                        $this->dieStatus( $this->errorArrayToStatus( $retval, $user ) );
                }
 
-               $result = [ 'rcid' => intval( $rc->getAttribute( 'rc_id' ) ) ];
+               $result = [ 'rcid' => (int)$rc->getAttribute( 'rc_id' ) ];
                ApiQueryBase::addTitleInfo( $result, $rc->getTitle() );
                $this->getResult()->addValue( null, $this->getModuleName(), $result );
        }
index 4f833e0..37fbe86 100644 (file)
@@ -126,10 +126,10 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase {
                                $item = [];
                                ApiResult::setContentValue( $item, 'category', $titleObj->getText() );
                                if ( isset( $prop['size'] ) ) {
-                                       $item['size'] = intval( $row->cat_pages );
+                                       $item['size'] = (int)$row->cat_pages;
                                        $item['pages'] = $row->cat_pages - $row->cat_subcats - $row->cat_files;
-                                       $item['files'] = intval( $row->cat_files );
-                                       $item['subcats'] = intval( $row->cat_subcats );
+                                       $item['files'] = (int)$row->cat_files;
+                                       $item['subcats'] = (int)$row->cat_subcats;
                                }
                                if ( isset( $prop['hidden'] ) ) {
                                        $item['hidden'] = (bool)$row->cat_hidden;
index 7a1c461..8855615 100644 (file)
@@ -258,14 +258,14 @@ class ApiQueryAllDeletedRevisions extends ApiQueryRevisionsBase {
                        $op = ( $dir == 'newer' ? '>' : '<' );
                        if ( $optimizeGenerateTitles ) {
                                $this->dieContinueUsageIf( count( $cont ) != 2 );
-                               $ns = intval( $cont[0] );
+                               $ns = (int)$cont[0];
                                $this->dieContinueUsageIf( strval( $ns ) !== $cont[0] );
                                $title = $db->addQuotes( $cont[1] );
                                $this->addWhere( "ar_namespace $op $ns OR " .
                                        "(ar_namespace = $ns AND ar_title $op= $title)" );
                        } elseif ( $mode == 'all' ) {
                                $this->dieContinueUsageIf( count( $cont ) != 4 );
-                               $ns = intval( $cont[0] );
+                               $ns = (int)$cont[0];
                                $this->dieContinueUsageIf( strval( $ns ) !== $cont[0] );
                                $title = $db->addQuotes( $cont[1] );
                                $ts = $db->addQuotes( $db->timestamp( $cont[2] ) );
index c7a0cbc..acd11fd 100644 (file)
@@ -217,11 +217,11 @@ class ApiQueryAllImages extends ApiQueryGeneratorBase {
 
                // Filters not depending on sort
                if ( isset( $params['minsize'] ) ) {
-                       $this->addWhere( 'img_size>=' . intval( $params['minsize'] ) );
+                       $this->addWhere( 'img_size>=' . (int)$params['minsize'] );
                }
 
                if ( isset( $params['maxsize'] ) ) {
-                       $this->addWhere( 'img_size<=' . intval( $params['maxsize'] ) );
+                       $this->addWhere( 'img_size<=' . (int)$params['maxsize'] );
                }
 
                $sha1 = false;
index 8377e74..fc23caa 100644 (file)
@@ -140,7 +140,7 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
                        } else {
                                $this->dieContinueUsageIf( count( $continueArr ) != 2 );
                                $continueTitle = $db->addQuotes( $continueArr[0] );
-                               $continueFrom = intval( $continueArr[1] );
+                               $continueFrom = (int)$continueArr[1];
                                $this->addWhere(
                                        "{$pfx}{$fieldTitle} $op $continueTitle OR " .
                                        "({$pfx}{$fieldTitle} = $continueTitle AND " .
@@ -204,7 +204,7 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
                                        ApiResult::META_TYPE => 'assoc',
                                ];
                                if ( $fld_ids ) {
-                                       $vals['fromid'] = intval( $row->pl_from );
+                                       $vals['fromid'] = (int)$row->pl_from;
                                }
                                if ( $fld_title ) {
                                        $title = Title::makeTitle( $namespace, $row->pl_title );
index 40909a4..1940600 100644 (file)
@@ -122,12 +122,12 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
                $this->addFields( $selectFields );
                $forceNameTitleIndex = true;
                if ( isset( $params['minsize'] ) ) {
-                       $this->addWhere( 'page_len>=' . intval( $params['minsize'] ) );
+                       $this->addWhere( 'page_len>=' . (int)$params['minsize'] );
                        $forceNameTitleIndex = false;
                }
 
                if ( isset( $params['maxsize'] ) ) {
-                       $this->addWhere( 'page_len<=' . intval( $params['maxsize'] ) );
+                       $this->addWhere( 'page_len<=' . (int)$params['maxsize'] );
                        $forceNameTitleIndex = false;
                }
 
@@ -238,8 +238,8 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
                        if ( is_null( $resultPageSet ) ) {
                                $title = Title::makeTitle( $row->page_namespace, $row->page_title );
                                $vals = [
-                                       'pageid' => intval( $row->page_id ),
-                                       'ns' => intval( $title->getNamespace() ),
+                                       'pageid' => (int)$row->page_id,
+                                       'ns' => (int)$title->getNamespace(),
                                        'title' => $title->getPrefixedText()
                                ];
                                $fit = $result->addValue( [ 'query', $this->getModuleName() ], null, $vals );
index 7b5df50..a540661 100644 (file)
@@ -281,10 +281,10 @@ class ApiQueryAllUsers extends ApiQueryBase {
                                $data['hidden'] = true;
                        }
                        if ( $fld_editcount ) {
-                               $data['editcount'] = intval( $row->user_editcount );
+                               $data['editcount'] = (int)$row->user_editcount;
                        }
                        if ( $params['activeusers'] ) {
-                               $data['recentactions'] = intval( $row->recentactions );
+                               $data['recentactions'] = (int)$row->recentactions;
                                // @todo 'recenteditcount' is set for BC, remove in 1.25
                                $data['recenteditcount'] = $data['recentactions'];
                        }
index f4e7463..f82a559 100644 (file)
@@ -187,7 +187,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                        }
 
                        if ( is_null( $resultPageSet ) ) {
-                               $a = [ 'pageid' => intval( $row->page_id ) ];
+                               $a = [ 'pageid' => (int)$row->page_id ];
                                ApiQueryBase::addTitleInfo( $a, $t );
                                if ( $row->page_is_redirect ) {
                                        $a['redirect'] = true;
@@ -306,7 +306,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                        }
 
                        if ( is_null( $resultPageSet ) ) {
-                               $a['pageid'] = intval( $row->page_id );
+                               $a['pageid'] = (int)$row->page_id;
                                ApiQueryBase::addTitleInfo( $a, Title::makeTitle( $row->page_namespace, $row->page_title ) );
                                if ( $row->page_is_redirect ) {
                                        $a['redirect'] = true;
@@ -336,7 +336,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                        $this->params['limit'] = $this->getMain()->canApiHighLimits() ? $botMax : $userMax;
                        $result->addParsedLimit( $this->getModuleName(), $this->params['limit'] );
                } else {
-                       $this->params['limit'] = intval( $this->params['limit'] );
+                       $this->params['limit'] = (int)$this->params['limit'];
                        $this->validateLimit( 'limit', $this->params['limit'], 1, $userMax, $botMax );
                }
 
index c92f037..3070665 100644 (file)
@@ -510,7 +510,7 @@ abstract class ApiQueryBase extends ApiBase {
         * @param string $prefix Module prefix
         */
        public static function addTitleInfo( &$arr, $title, $prefix = '' ) {
-               $arr[$prefix . 'ns'] = intval( $title->getNamespace() );
+               $arr[$prefix . 'ns'] = (int)$title->getNamespace();
                $arr[$prefix . 'title'] = $title->getPrefixedText();
        }
 
@@ -524,7 +524,7 @@ abstract class ApiQueryBase extends ApiBase {
                $result = $this->getResult();
                ApiResult::setIndexedTagName( $data, $this->getModulePrefix() );
 
-               return $result->addValue( [ 'query', 'pages', intval( $pageId ) ],
+               return $result->addValue( [ 'query', 'pages', (int)$pageId ],
                        $this->getModuleName(),
                        $data );
        }
index 7b447cb..547a4e8 100644 (file)
@@ -86,7 +86,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
                        $cont = explode( '|', $params['continue'] );
                        $this->dieContinueUsageIf( count( $cont ) != 2 );
                        $op = $params['dir'] == 'descending' ? '<' : '>';
-                       $clfrom = intval( $cont[0] );
+                       $clfrom = (int)$cont[0];
                        $clto = $this->getDB()->addQuotes( $cont[1] );
                        $this->addWhere(
                                "cl_from $op $clfrom OR " .
index 02361a2..bb48290 100644 (file)
@@ -78,10 +78,10 @@ class ApiQueryCategoryInfo extends ApiQueryBase {
                $catids = array_flip( $cattitles );
                foreach ( $res as $row ) {
                        $vals = [];
-                       $vals['size'] = intval( $row->cat_pages );
+                       $vals['size'] = (int)$row->cat_pages;
                        $vals['pages'] = $row->cat_pages - $row->cat_subcats - $row->cat_files;
-                       $vals['files'] = intval( $row->cat_files );
-                       $vals['subcats'] = intval( $row->cat_subcats );
+                       $vals['files'] = (int)$row->cat_files;
+                       $vals['subcats'] = (int)$row->cat_subcats;
                        $vals['hidden'] = (bool)$row->cat_hidden;
                        $fit = $this->addPageSubItems( $catids[$row->cat_title], $vals );
                        if ( !$fit ) {
index 37d0788..0152434 100644 (file)
@@ -135,7 +135,7 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
                                // Add a WHERE clause for sortkey and from
                                $this->dieContinueUsageIf( !$this->validateHexSortkey( $cont[1] ) );
                                $escSortkey = $this->getDB()->addQuotes( hex2bin( $cont[1] ) );
-                               $from = intval( $cont[2] );
+                               $from = (int)$cont[2];
                                $op = $dir == 'newer' ? '>' : '<';
                                // $contWhere is used further down
                                $contWhere = "cl_sortkey $op $escSortkey OR " .
@@ -245,7 +245,7 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
                                        ApiResult::META_TYPE => 'assoc',
                                ];
                                if ( $fld_ids ) {
-                                       $vals['pageid'] = intval( $row->page_id );
+                                       $vals['pageid'] = (int)$row->page_id;
                                }
                                if ( $fld_title ) {
                                        $title = Title::makeTitle( $row->page_namespace, $row->page_title );
index 9275a7c..c156341 100644 (file)
@@ -155,7 +155,7 @@ class ApiQueryDeletedRevisions extends ApiQueryRevisionsBase {
                        $op = ( $dir == 'newer' ? '>' : '<' );
                        if ( $revCount !== 0 ) {
                                $this->dieContinueUsageIf( count( $cont ) != 2 );
-                               $rev = intval( $cont[0] );
+                               $rev = (int)$cont[0];
                                $this->dieContinueUsageIf( strval( $rev ) !== $cont[0] );
                                $ar_id = (int)$cont[1];
                                $this->dieContinueUsageIf( strval( $ar_id ) !== $cont[1] );
@@ -164,7 +164,7 @@ class ApiQueryDeletedRevisions extends ApiQueryRevisionsBase {
                                        "ar_id $op= $ar_id)" );
                        } else {
                                $this->dieContinueUsageIf( count( $cont ) != 4 );
-                               $ns = intval( $cont[0] );
+                               $ns = (int)$cont[0];
                                $this->dieContinueUsageIf( strval( $ns ) !== $cont[0] );
                                $title = $db->addQuotes( $cont[1] );
                                $ts = $db->addQuotes( $db->timestamp( $cont[2] ) );
index 8540190..3ee75f5 100644 (file)
@@ -238,7 +238,7 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
                        $op = ( $dir == 'newer' ? '>' : '<' );
                        if ( $mode == 'all' || $mode == 'revs' ) {
                                $this->dieContinueUsageIf( count( $cont ) != 4 );
-                               $ns = intval( $cont[0] );
+                               $ns = (int)$cont[0];
                                $this->dieContinueUsageIf( strval( $ns ) !== $cont[0] );
                                $title = $db->addQuotes( $cont[1] );
                                $ts = $db->addQuotes( $db->timestamp( $cont[2] ) );
@@ -307,10 +307,10 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
 
                        $rev['timestamp'] = wfTimestamp( TS_ISO_8601, $row->ar_timestamp );
                        if ( $fld_revid ) {
-                               $rev['revid'] = intval( $row->ar_rev_id );
+                               $rev['revid'] = (int)$row->ar_rev_id;
                        }
                        if ( $fld_parentid && !is_null( $row->ar_parent_id ) ) {
-                               $rev['parentid'] = intval( $row->ar_parent_id );
+                               $rev['parentid'] = (int)$row->ar_parent_id;
                        }
                        if ( $fld_user || $fld_userid ) {
                                if ( $row->ar_deleted & Revision::DELETED_USER ) {
index d508c55..4294f0a 100644 (file)
@@ -155,7 +155,7 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase {
                                        ApiResult::META_TYPE => 'assoc',
                                ];
                                if ( $fld_ids ) {
-                                       $vals['pageid'] = intval( $row->page_id );
+                                       $vals['pageid'] = (int)$row->page_id;
                                }
                                if ( $fld_title ) {
                                        $title = Title::makeTitle( $row->page_namespace, $row->page_title );
index 3037a72..b015223 100644 (file)
@@ -67,7 +67,7 @@ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase {
                        $op = $params['dir'] == 'descending' ? '<' : '>';
                        $prefix = $db->addQuotes( $cont[0] );
                        $title = $db->addQuotes( $cont[1] );
-                       $from = intval( $cont[2] );
+                       $from = (int)$cont[2];
                        $this->addWhere(
                                "iwl_prefix $op $prefix OR " .
                                "(iwl_prefix = $prefix AND " .
index 08c8abf..e841788 100644 (file)
@@ -73,7 +73,7 @@ class ApiQueryIWLinks extends ApiQueryBase {
                        $this->dieContinueUsageIf( count( $cont ) != 3 );
                        $op = $params['dir'] == 'descending' ? '<' : '>';
                        $db = $this->getDB();
-                       $iwlfrom = intval( $cont[0] );
+                       $iwlfrom = (int)$cont[0];
                        $iwlprefix = $db->addQuotes( $cont[1] );
                        $iwltitle = $db->addQuotes( $cont[2] );
                        $this->addWhere(
index 37a7ff3..333b769 100644 (file)
@@ -115,7 +115,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
                                                $info['imagerepository'] = '';
                                        } else {
                                                $result->addValue(
-                                                       [ 'query', 'pages', intval( $pageId ) ],
+                                                       [ 'query', 'pages', (int)$pageId ],
                                                        'imagerepository', ''
                                                );
                                                // The above can't fail because it doesn't increase the result size
@@ -146,7 +146,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
                                        $info['badfile'] = (bool)wfIsBadImage( $title, $badFileContextTitle );
                                }
 
-                               $fit = $result->addValue( [ 'query', 'pages' ], intval( $pageId ), $info );
+                               $fit = $result->addValue( [ 'query', 'pages' ], (int)$pageId, $info );
                                if ( !$fit ) {
                                        if ( count( $pageIds[NS_FILE] ) == 1 ) {
                                                // The user is screwed. imageinfo can't be solely
@@ -312,7 +312,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
                }
 
                if ( isset( $paramList['width'] ) && isset( $thumbParams['width'] ) ) {
-                       if ( intval( $paramList['width'] ) != intval( $thumbParams['width'] ) ) {
+                       if ( (int)$paramList['width'] != (int)$thumbParams['width'] ) {
                                $this->addWarning(
                                        [ 'apiwarn-urlparamwidth', $p, $paramList['width'], $thumbParams['width'] ]
                                );
@@ -429,9 +429,9 @@ class ApiQueryImageInfo extends ApiQueryBase {
                // This is shown even if the file is revdelete'd in interface
                // so do same here.
                if ( isset( $prop['size'] ) || isset( $prop['dimensions'] ) ) {
-                       $vals['size'] = intval( $file->getSize() );
-                       $vals['width'] = intval( $file->getWidth() );
-                       $vals['height'] = intval( $file->getHeight() );
+                       $vals['size'] = (int)$file->getSize();
+                       $vals['width'] = (int)$file->getWidth();
+                       $vals['height'] = (int)$file->getHeight();
 
                        $pageCount = $file->pageCount();
                        if ( $pageCount !== false ) {
@@ -510,11 +510,11 @@ class ApiQueryImageInfo extends ApiQueryBase {
                                                // T25834 - If the URLs are the same, we haven't resized it, so shouldn't give the wanted
                                                // thumbnail sizes for the thumbnail actual size
                                                if ( $mto->getUrl() !== $file->getUrl() ) {
-                                                       $vals['thumbwidth'] = intval( $mto->getWidth() );
-                                                       $vals['thumbheight'] = intval( $mto->getHeight() );
+                                                       $vals['thumbwidth'] = (int)$mto->getWidth();
+                                                       $vals['thumbheight'] = (int)$mto->getHeight();
                                                } else {
-                                                       $vals['thumbwidth'] = intval( $file->getWidth() );
-                                                       $vals['thumbheight'] = intval( $file->getHeight() );
+                                                       $vals['thumbwidth'] = (int)$file->getWidth();
+                                                       $vals['thumbheight'] = (int)$file->getHeight();
                                                }
 
                                                if ( isset( $prop['thumbmime'] ) && $file->getHandler() ) {
index 06a3ba0..153d1a4 100644 (file)
@@ -60,7 +60,7 @@ class ApiQueryImages extends ApiQueryGeneratorBase {
                        $cont = explode( '|', $params['continue'] );
                        $this->dieContinueUsageIf( count( $cont ) != 2 );
                        $op = $params['dir'] == 'descending' ? '<' : '>';
-                       $ilfrom = intval( $cont[0] );
+                       $ilfrom = (int)$cont[0];
                        $ilto = $this->getDB()->addQuotes( $cont[1] );
                        $this->addWhere(
                                "il_from $op $ilfrom OR " .
index 33d971b..3d358b9 100644 (file)
@@ -411,8 +411,8 @@ class ApiQueryInfo extends ApiQueryBase {
 
                if ( $titleExists ) {
                        $pageInfo['touched'] = wfTimestamp( TS_ISO_8601, $this->pageTouched[$pageid] );
-                       $pageInfo['lastrevid'] = intval( $this->pageLatest[$pageid] );
-                       $pageInfo['length'] = intval( $this->pageLength[$pageid] );
+                       $pageInfo['lastrevid'] = (int)$this->pageLatest[$pageid];
+                       $pageInfo['length'] = (int)$this->pageLength[$pageid];
 
                        if ( isset( $this->pageIsRedir[$pageid] ) && $this->pageIsRedir[$pageid] ) {
                                $pageInfo['redirect'] = true;
@@ -738,10 +738,10 @@ class ApiQueryInfo extends ApiQueryBase {
                foreach ( $res as $row ) {
                        if ( MWNamespace::isTalk( $row->page_namespace ) ) {
                                $this->talkids[MWNamespace::getSubject( $row->page_namespace )][$row->page_title] =
-                                       intval( $row->page_id );
+                                       (int)$row->page_id;
                        } else {
                                $this->subjectids[MWNamespace::getTalk( $row->page_namespace )][$row->page_title] =
-                                       intval( $row->page_id );
+                                       (int)$row->page_id;
                        }
                }
        }
index 7145d4d..818a3f7 100644 (file)
@@ -67,7 +67,7 @@ class ApiQueryLangBacklinks extends ApiQueryGeneratorBase {
                        $op = $params['dir'] == 'descending' ? '<' : '>';
                        $prefix = $db->addQuotes( $cont[0] );
                        $title = $db->addQuotes( $cont[1] );
-                       $from = intval( $cont[2] );
+                       $from = (int)$cont[2];
                        $this->addWhere(
                                "ll_lang $op $prefix OR " .
                                "(ll_lang = $prefix AND " .
index f33a67f..b8c30ac 100644 (file)
@@ -70,7 +70,7 @@ class ApiQueryLangLinks extends ApiQueryBase {
                        $cont = explode( '|', $params['continue'] );
                        $this->dieContinueUsageIf( count( $cont ) != 2 );
                        $op = $params['dir'] == 'descending' ? '<' : '>';
-                       $llfrom = intval( $cont[0] );
+                       $llfrom = (int)$cont[0];
                        $lllang = $this->getDB()->addQuotes( $cont[1] );
                        $this->addWhere(
                                "ll_from $op $llfrom OR " .
index 144c758..200fda8 100644 (file)
@@ -117,8 +117,8 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
                        $cont = explode( '|', $params['continue'] );
                        $this->dieContinueUsageIf( count( $cont ) != 3 );
                        $op = $params['dir'] == 'descending' ? '<' : '>';
-                       $plfrom = intval( $cont[0] );
-                       $plns = intval( $cont[1] );
+                       $plfrom = (int)$cont[0];
+                       $plns = (int)$cont[1];
                        $pltitle = $this->getDB()->addQuotes( $cont[2] );
                        $this->addWhere(
                                "{$this->prefix}_from $op $plfrom OR " .
index edf7002..0934ab3 100644 (file)
@@ -264,7 +264,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
                $user = $this->getUser();
 
                if ( $this->fld_ids ) {
-                       $vals['logid'] = intval( $row->log_id );
+                       $vals['logid'] = (int)$row->log_id;
                }
 
                if ( $this->fld_title || $this->fld_parsedcomment ) {
@@ -281,8 +281,8 @@ class ApiQueryLogEvents extends ApiQueryBase {
                                        ApiQueryBase::addTitleInfo( $vals, $title );
                                }
                                if ( $this->fld_ids ) {
-                                       $vals['pageid'] = intval( $row->page_id );
-                                       $vals['logpage'] = intval( $row->log_page );
+                                       $vals['pageid'] = (int)$row->page_id;
+                                       $vals['logpage'] = (int)$row->log_page;
                                }
                                if ( $this->fld_details ) {
                                        $vals['params'] = LogFormatter::newFromEntry( $logEntry )->formatParametersForApi();
@@ -305,7 +305,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
                                        $vals['user'] = $row->user_name ?? $row->log_user_text;
                                }
                                if ( $this->fld_userid ) {
-                                       $vals['userid'] = intval( $row->log_user );
+                                       $vals['userid'] = (int)$row->log_user;
                                }
 
                                if ( !$row->log_user ) {
index 3258004..61d8a94 100644 (file)
@@ -39,7 +39,7 @@ class ApiQueryPageProps extends ApiQueryBase {
 
                $this->params = $this->extractRequestParams();
                if ( $this->params['continue'] ) {
-                       $continueValue = intval( $this->params['continue'] );
+                       $continueValue = (int)$this->params['continue'];
                        $this->dieContinueUsageIf( strval( $continueValue ) !== $this->params['continue'] );
                        $filteredPages = [];
                        foreach ( $pages as $id => $page ) {
index 04d3f2c..e5f611f 100644 (file)
@@ -74,13 +74,13 @@ class ApiQueryPrefixSearch extends ApiQueryGeneratorBase {
                        $count = 0;
                        foreach ( $titles as $title ) {
                                $vals = [
-                                       'ns' => intval( $title->getNamespace() ),
+                                       'ns' => (int)$title->getNamespace(),
                                        'title' => $title->getPrefixedText(),
                                ];
                                if ( $title->isSpecialPage() ) {
                                        $vals['special'] = true;
                                } else {
-                                       $vals['pageid'] = intval( $title->getArticleID() );
+                                       $vals['pageid'] = (int)$title->getArticleID();
                                }
                                $fit = $result->addValue( [ 'query', $this->getModuleName() ], null, $vals );
                                ++$count;
index 779d601..2d5c987 100644 (file)
@@ -159,7 +159,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
                        $this->dieContinueUsageIf( count( $cont ) != 2 );
                        $db = $this->getDB();
                        $timestamp = $db->addQuotes( $db->timestamp( $cont[0] ) );
-                       $id = intval( $cont[1] );
+                       $id = (int)$cont[1];
                        $this->dieContinueUsageIf( $id != $cont[1] );
                        $op = $params['dir'] === 'older' ? '<' : '>';
                        $this->addWhere(
@@ -483,7 +483,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
                /* Our output data. */
                $vals = [];
 
-               $type = intval( $row->rc_type );
+               $type = (int)$row->rc_type;
                $vals['type'] = RecentChange::parseFromRCType( $type );
 
                $anyHidden = false;
@@ -501,15 +501,15 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
                                        ApiQueryBase::addTitleInfo( $vals, $title );
                                }
                                if ( $this->fld_ids ) {
-                                       $vals['pageid'] = intval( $row->rc_cur_id );
-                                       $vals['revid'] = intval( $row->rc_this_oldid );
-                                       $vals['old_revid'] = intval( $row->rc_last_oldid );
+                                       $vals['pageid'] = (int)$row->rc_cur_id;
+                                       $vals['revid'] = (int)$row->rc_this_oldid;
+                                       $vals['old_revid'] = (int)$row->rc_last_oldid;
                                }
                        }
                }
 
                if ( $this->fld_ids ) {
-                       $vals['rcid'] = intval( $row->rc_id );
+                       $vals['rcid'] = (int)$row->rc_id;
                }
 
                /* Add user data and 'anon' flag, if user is anonymous. */
@@ -542,8 +542,8 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
 
                /* Add sizes of each revision. (Only available on 1.10+) */
                if ( $this->fld_sizes ) {
-                       $vals['oldlen'] = intval( $row->rc_old_len );
-                       $vals['newlen'] = intval( $row->rc_new_len );
+                       $vals['oldlen'] = (int)$row->rc_old_len;
+                       $vals['newlen'] = (int)$row->rc_new_len;
                }
 
                /* Add the timestamp. */
@@ -588,7 +588,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
                                $anyHidden = true;
                        }
                        if ( LogEventsList::userCanBitfield( $row->rc_deleted, LogPage::DELETED_ACTION, $user ) ) {
-                               $vals['logid'] = intval( $row->rc_logid );
+                               $vals['logid'] = (int)$row->rc_logid;
                                $vals['logtype'] = $row->rc_log_type;
                                $vals['logaction'] = $row->rc_log_action;
                                $vals['logparams'] = LogFormatter::newFromRow( $row )->formatParametersForApi();
index cb2f616..9301f81 100644 (file)
@@ -292,7 +292,7 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase {
                                        $ts = $db->addQuotes( $db->timestampOrNull( $params['start'] ) );
                                        if ( $params['startid'] !== null ) {
                                                $this->addWhere( "$tsField $op $ts OR "
-                                                       . "$tsField = $ts AND $idField $op= " . intval( $params['startid'] ) );
+                                                       . "$tsField = $ts AND $idField $op= " . (int)$params['startid'] );
                                        } else {
                                                $this->addWhere( "$tsField $op= $ts" );
                                        }
@@ -302,7 +302,7 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase {
                                        $ts = $db->addQuotes( $db->timestampOrNull( $params['end'] ) );
                                        if ( $params['endid'] !== null ) {
                                                $this->addWhere( "$tsField $op $ts OR "
-                                                       . "$tsField = $ts AND $idField $op= " . intval( $params['endid'] ) );
+                                                       . "$tsField = $ts AND $idField $op= " . (int)$params['endid'] );
                                        } else {
                                                $this->addWhere( "$tsField $op= $ts" );
                                        }
@@ -354,7 +354,7 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase {
                        $this->addWhereFld( 'rev_id', array_keys( $revs ) );
 
                        if ( $params['continue'] !== null ) {
-                               $this->addWhere( 'rev_id >= ' . intval( $params['continue'] ) );
+                               $this->addWhere( 'rev_id >= ' . (int)$params['continue'] );
                        }
                        $this->addOption( 'ORDER BY', 'rev_id' );
                } elseif ( $pageCount > 0 ) {
@@ -374,8 +374,8 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase {
                        if ( $params['continue'] !== null ) {
                                $cont = explode( '|', $params['continue'] );
                                $this->dieContinueUsageIf( count( $cont ) != 2 );
-                               $pageid = intval( $cont[0] );
-                               $revid = intval( $cont[1] );
+                               $pageid = (int)$cont[0];
+                               $revid = (int)$cont[1];
                                $this->addWhere(
                                        "rev_page > $pageid OR " .
                                        "(rev_page = $pageid AND " .
@@ -403,12 +403,12 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase {
                                // additional pages to be had. Stop here...
                                if ( $enumRevMode ) {
                                        $this->setContinueEnumParameter( 'continue',
-                                               $row->rev_timestamp . '|' . intval( $row->rev_id ) );
+                                               $row->rev_timestamp . '|' . (int)$row->rev_id );
                                } elseif ( $revCount > 0 ) {
-                                       $this->setContinueEnumParameter( 'continue', intval( $row->rev_id ) );
+                                       $this->setContinueEnumParameter( 'continue', (int)$row->rev_id );
                                } else {
-                                       $this->setContinueEnumParameter( 'continue', intval( $row->rev_page ) .
-                                               '|' . intval( $row->rev_id ) );
+                                       $this->setContinueEnumParameter( 'continue', (int)$row->rev_page .
+                                               '|' . (int)$row->rev_id );
                                }
                                break;
                        }
@@ -438,12 +438,12 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase {
                                if ( !$fit ) {
                                        if ( $enumRevMode ) {
                                                $this->setContinueEnumParameter( 'continue',
-                                                       $row->rev_timestamp . '|' . intval( $row->rev_id ) );
+                                                       $row->rev_timestamp . '|' . (int)$row->rev_id );
                                        } elseif ( $revCount > 0 ) {
-                                               $this->setContinueEnumParameter( 'continue', intval( $row->rev_id ) );
+                                               $this->setContinueEnumParameter( 'continue', (int)$row->rev_id );
                                        } else {
-                                               $this->setContinueEnumParameter( 'continue', intval( $row->rev_page ) .
-                                                       '|' . intval( $row->rev_id ) );
+                                               $this->setContinueEnumParameter( 'continue', (int)$row->rev_page .
+                                                       '|' . (int)$row->rev_id );
                                        }
                                        break;
                                }
index 0d2aeab..51f4d41 100644 (file)
@@ -229,9 +229,9 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
                $anyHidden = false;
 
                if ( $this->fld_ids ) {
-                       $vals['revid'] = intval( $revision->getId() );
+                       $vals['revid'] = (int)$revision->getId();
                        if ( !is_null( $revision->getParentId() ) ) {
-                               $vals['parentid'] = intval( $revision->getParentId() );
+                               $vals['parentid'] = (int)$revision->getParentId();
                        }
                }
 
@@ -267,7 +267,7 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
 
                if ( $this->fld_size ) {
                        try {
-                               $vals['size'] = intval( $revision->getSize() );
+                               $vals['size'] = (int)$revision->getSize();
                        } catch ( RevisionAccessException $e ) {
                                // Back compat: If there's no size, return 0.
                                // @todo: GergÅ‘ says to mention T198099 as a "todo" here.
@@ -410,7 +410,7 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
                ApiResult::setArrayType( $vals, 'assoc' );
 
                if ( $this->fld_slotsize ) {
-                       $vals['size'] = intval( $slot->getSize() );
+                       $vals['size'] = (int)$slot->getSize();
                }
 
                if ( $this->fld_slotsha1 ) {
index d134eda..96fa8a1 100644 (file)
@@ -228,7 +228,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                $tz = $config->get( 'Localtimezone' );
                $offset = $config->get( 'LocalTZoffset' );
                $data['timezone'] = $tz;
-               $data['timeoffset'] = intval( $offset );
+               $data['timeoffset'] = (int)$offset;
                $data['articlepath'] = $config->get( 'ArticlePath' );
                $data['scriptpath'] = $config->get( 'ScriptPath' );
                $data['script'] = $config->get( 'Script' );
@@ -287,7 +287,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                        as $ns => $title
                ) {
                        $data[$ns] = [
-                               'id' => intval( $ns ),
+                               'id' => (int)$ns,
                                'case' => MWNamespace::isCapitalized( $ns ) ? 'first-letter' : 'case-sensitive',
                        ];
                        ApiResult::setContentValue( $data[$ns], 'name', $title );
@@ -326,7 +326,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                                continue;
                        }
                        $item = [
-                               'id' => intval( $ns )
+                               'id' => (int)$ns
                        ];
                        ApiResult::setContentValue( $item, 'alias', strtr( $title, '_', ' ' ) );
                        $data[] = $item;
@@ -472,14 +472,14 @@ class ApiQuerySiteinfo extends ApiQueryBase {
 
        protected function appendStatistics( $property ) {
                $data = [];
-               $data['pages'] = intval( SiteStats::pages() );
-               $data['articles'] = intval( SiteStats::articles() );
-               $data['edits'] = intval( SiteStats::edits() );
-               $data['images'] = intval( SiteStats::images() );
-               $data['users'] = intval( SiteStats::users() );
-               $data['activeusers'] = intval( SiteStats::activeUsers() );
-               $data['admins'] = intval( SiteStats::numberingroup( 'sysop' ) );
-               $data['jobs'] = intval( SiteStats::jobs() );
+               $data['pages'] = (int)SiteStats::pages();
+               $data['articles'] = (int)SiteStats::articles();
+               $data['edits'] = (int)SiteStats::edits();
+               $data['images'] = (int)SiteStats::images();
+               $data['users'] = (int)SiteStats::users();
+               $data['activeusers'] = (int)SiteStats::activeUsers();
+               $data['admins'] = (int)SiteStats::numberingroup( 'sysop' );
+               $data['jobs'] = (int)SiteStats::jobs();
 
                Hooks::run( 'APIQuerySiteInfoStatisticsInfo', [ &$data ] );
 
index ed5fe8a..f104383 100644 (file)
@@ -85,7 +85,7 @@ class ApiQueryTags extends ApiQueryBase {
                        }
 
                        if ( $fld_hitcount ) {
-                               $tag['hitcount'] = intval( $tagHitcounts[$tagName] );
+                               $tag['hitcount'] = (int)$tagHitcounts[$tagName];
                        }
 
                        $isSoftware = isset( $softwareDefinedTags[$tagName] );
index ae1be0d..0ca0b20 100644 (file)
@@ -523,12 +523,12 @@ class ApiQueryUserContribs extends ApiQueryBase {
                        $anyHidden = true;
                }
                if ( $this->fld_ids ) {
-                       $vals['pageid'] = intval( $row->rev_page );
-                       $vals['revid'] = intval( $row->rev_id );
-                       // $vals['textid'] = intval( $row->rev_text_id ); // todo: Should this field be exposed?
+                       $vals['pageid'] = (int)$row->rev_page;
+                       $vals['revid'] = (int)$row->rev_id;
+                       // $vals['textid'] = (int)$row->rev_text_id; // todo: Should this field be exposed?
 
                        if ( !is_null( $row->rev_parent_id ) ) {
-                               $vals['parentid'] = intval( $row->rev_parent_id );
+                               $vals['parentid'] = (int)$row->rev_parent_id;
                        }
                }
 
@@ -577,7 +577,7 @@ class ApiQueryUserContribs extends ApiQueryBase {
                }
 
                if ( $this->fld_size && !is_null( $row->rev_len ) ) {
-                       $vals['size'] = intval( $row->rev_len );
+                       $vals['size'] = (int)$row->rev_len;
                }
 
                if ( $this->fld_sizediff
@@ -585,7 +585,7 @@ class ApiQueryUserContribs extends ApiQueryBase {
                        && !is_null( $row->rev_parent_id )
                ) {
                        $parentLen = $this->parentLens[$row->rev_parent_id] ?? 0;
-                       $vals['sizediff'] = intval( $row->rev_len - $parentLen );
+                       $vals['sizediff'] = (int)$row->rev_len - $parentLen;
                }
 
                if ( $this->fld_tags ) {
index 44e2703..a38d877 100644 (file)
@@ -119,7 +119,7 @@ class ApiQueryUserInfo extends ApiQueryBase {
        protected function getCurrentUserInfo() {
                $user = $this->getUser();
                $vals = [];
-               $vals['id'] = intval( $user->getId() );
+               $vals['id'] = (int)$user->getId();
                $vals['name'] = $user->getName();
 
                if ( $user->isAnon() ) {
@@ -189,7 +189,7 @@ class ApiQueryUserInfo extends ApiQueryBase {
                if ( isset( $this->prop['editcount'] ) ) {
                        // use intval to prevent null if a non-logged-in user calls
                        // api.php?format=jsonfm&action=query&meta=userinfo&uiprop=editcount
-                       $vals['editcount'] = intval( $user->getEditCount() );
+                       $vals['editcount'] = (int)$user->getEditCount();
                }
 
                if ( isset( $this->prop['ratelimits'] ) ) {
@@ -284,8 +284,8 @@ class ApiQueryUserInfo extends ApiQueryBase {
                foreach ( $this->getConfig()->get( 'RateLimits' ) as $action => $limits ) {
                        foreach ( $categories as $cat ) {
                                if ( isset( $limits[$cat] ) && !is_null( $limits[$cat] ) ) {
-                                       $retval[$action][$cat]['hits'] = intval( $limits[$cat][0] );
-                                       $retval[$action][$cat]['seconds'] = intval( $limits[$cat][1] );
+                                       $retval[$action][$cat]['hits'] = (int)$limits[$cat][0];
+                                       $retval[$action][$cat]['seconds'] = (int)$limits[$cat][1];
                                }
                        }
                }
index 95fbd3d..236f6e0 100644 (file)
@@ -195,9 +195,9 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                                }
                        } else {
                                if ( $params['allrev'] ) {
-                                       $ids[] = intval( $recentChangeInfo['rc_this_oldid'] );
+                                       $ids[] = (int)$recentChangeInfo['rc_this_oldid'];
                                } else {
-                                       $ids[] = intval( $recentChangeInfo['rc_cur_id'] );
+                                       $ids[] = (int)$recentChangeInfo['rc_cur_id'];
                                }
                        }
                }
@@ -272,7 +272,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
 
                /* Our output data. */
                $vals = [];
-               $type = intval( $recentChangeInfo['rc_type'] );
+               $type = (int)$recentChangeInfo['rc_type'];
                $vals['type'] = RecentChange::parseFromRCType( $type );
                $anyHidden = false;
 
@@ -294,9 +294,9 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                                        ApiQueryBase::addTitleInfo( $vals, $title );
                                }
                                if ( $this->fld_ids ) {
-                                       $vals['pageid'] = intval( $recentChangeInfo['rc_cur_id'] );
-                                       $vals['revid'] = intval( $recentChangeInfo['rc_this_oldid'] );
-                                       $vals['old_revid'] = intval( $recentChangeInfo['rc_last_oldid'] );
+                                       $vals['pageid'] = (int)$recentChangeInfo['rc_cur_id'];
+                                       $vals['revid'] = (int)$recentChangeInfo['rc_this_oldid'];
+                                       $vals['old_revid'] = (int)$recentChangeInfo['rc_last_oldid'];
                                }
                        }
                }
@@ -337,8 +337,8 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
 
                /* Add sizes of each revision. (Only available on 1.10+) */
                if ( $this->fld_sizes ) {
-                       $vals['oldlen'] = intval( $recentChangeInfo['rc_old_len'] );
-                       $vals['newlen'] = intval( $recentChangeInfo['rc_new_len'] );
+                       $vals['oldlen'] = (int)$recentChangeInfo['rc_old_len'];
+                       $vals['newlen'] = (int)$recentChangeInfo['rc_new_len'];
                }
 
                /* Add the timestamp. */
@@ -391,7 +391,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                                LogPage::DELETED_ACTION,
                                $user
                        ) ) {
-                               $vals['logid'] = intval( $recentChangeInfo['rc_logid'] );
+                               $vals['logid'] = (int)$recentChangeInfo['rc_logid'];
                                $vals['logtype'] = $recentChangeInfo['rc_log_type'];
                                $vals['logaction'] = $recentChangeInfo['rc_log_action'];
                                $vals['logparams'] = LogFormatter::newFromRow( $recentChangeInfo )->formatParametersForApi();
index 0adbfdb..743e974 100644 (file)
@@ -73,7 +73,7 @@ class ApiQueryWatchlistRaw extends ApiQueryGeneratorBase {
                if ( isset( $params['continue'] ) ) {
                        $cont = explode( '|', $params['continue'] );
                        $this->dieContinueUsageIf( count( $cont ) != 2 );
-                       $ns = intval( $cont[0] );
+                       $ns = (int)$cont[0];
                        $this->dieContinueUsageIf( strval( $ns ) !== $cont[0] );
                        $title = $cont[1];
                        $options['startFrom'] = new TitleValue( $ns, $title );
index 18aa6da..7c313d5 100644 (file)
@@ -85,13 +85,13 @@ class ApiRollback extends ApiBase {
 
                $info = [
                        'title' => $titleObj->getPrefixedText(),
-                       'pageid' => intval( $details['current']->getPage() ),
+                       'pageid' => (int)$details['current']->getPage(),
                        'summary' => $details['summary'],
-                       'revid' => intval( $details['newid'] ),
+                       'revid' => (int)$details['newid'],
                        // The revision being reverted (previously the current revision of the page)
-                       'old_revid' => intval( $details['current']->getID() ),
+                       'old_revid' => (int)$details['current']->getID(),
                        // The revision being restored (the last revision before revision(s) by the reverted user)
-                       'last_revid' => intval( $details['target']->getID() )
+                       'last_revid' => (int)$details['target']->getID()
                ];
 
                $this->getResult()->addValue( null, $this->getModuleName(), $info );
index 41c207b..c9ebfa8 100644 (file)
@@ -161,7 +161,7 @@ class ApiSetNotificationTimestamp extends ApiBase {
                                        $ns = $title->getNamespace();
                                        $dbkey = $title->getDBkey();
                                        $r = [
-                                               'ns' => intval( $ns ),
+                                               'ns' => (int)$ns,
                                                'title' => $title->getPrefixedText(),
                                        ];
                                        if ( !$title->exists() ) {
index 840ef1b..07a6aae 100644 (file)
@@ -84,8 +84,8 @@ class ApiUndelete extends ApiBase {
                $this->setWatch( $params['watchlist'], $titleObj );
 
                $info['title'] = $titleObj->getPrefixedText();
-               $info['revisions'] = intval( $retval[0] );
-               $info['fileversions'] = intval( $retval[1] );
+               $info['revisions'] = (int)$retval[0];
+               $info['fileversions'] = (int)$retval[1];
                $info['reason'] = $retval[2];
                $this->getResult()->addValue( null, $this->getModuleName(), $info );
        }