Use (int) rather than intval()
[lhc/web/wiklou.git] / includes / api / ApiQueryWatchlist.php
index bb09838..236f6e0 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 use MediaWiki\MediaWikiServices;
+use MediaWiki\Revision\RevisionRecord;
 
 /**
  * This query action allows clients to retrieve a list of recently modified pages
@@ -194,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'];
                                }
                        }
                }
@@ -271,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;
 
@@ -293,22 +294,22 @@ 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'];
                                }
                        }
                }
 
                /* Add user data and 'anon' flag, if user is anonymous. */
                if ( $this->fld_user || $this->fld_userid ) {
-                       if ( $recentChangeInfo['rc_deleted'] & Revision::DELETED_USER ) {
+                       if ( $recentChangeInfo['rc_deleted'] & RevisionRecord::DELETED_USER ) {
                                $vals['userhidden'] = true;
                                $anyHidden = true;
                        }
-                       if ( Revision::userCanBitfield(
+                       if ( RevisionRecord::userCanBitfield(
                                $recentChangeInfo['rc_deleted'],
-                               Revision::DELETED_USER,
+                               RevisionRecord::DELETED_USER,
                                $user
                        ) ) {
                                if ( $this->fld_userid ) {
@@ -336,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. */
@@ -353,13 +354,13 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
 
                /* Add edit summary / log summary. */
                if ( $this->fld_comment || $this->fld_parsedcomment ) {
-                       if ( $recentChangeInfo['rc_deleted'] & Revision::DELETED_COMMENT ) {
+                       if ( $recentChangeInfo['rc_deleted'] & RevisionRecord::DELETED_COMMENT ) {
                                $vals['commenthidden'] = true;
                                $anyHidden = true;
                        }
-                       if ( Revision::userCanBitfield(
+                       if ( RevisionRecord::userCanBitfield(
                                $recentChangeInfo['rc_deleted'],
-                               Revision::DELETED_COMMENT,
+                               RevisionRecord::DELETED_COMMENT,
                                $user
                        ) ) {
                                $comment = $this->commentStore->getComment( 'rc_comment', $recentChangeInfo )->text;
@@ -390,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();
@@ -407,7 +408,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                        }
                }
 
-               if ( $anyHidden && ( $recentChangeInfo['rc_deleted'] & Revision::DELETED_RESTRICTED ) ) {
+               if ( $anyHidden && ( $recentChangeInfo['rc_deleted'] & RevisionRecord::DELETED_RESTRICTED ) ) {
                        $vals['suppressed'] = true;
                }