jenkins-bot has submitted this change and it was merged. Change subject: Replace intval() with faster (int) cast ......................................................................
Replace intval() with faster (int) cast intval() is about 5 times slower than a type cast, no matter if it's done explicit (by explicitly stating (int)$string) or implicit (via $string > 0). The difference between the two is that intval() accepts a base, which is not needed in these cases. Following the arguments given in https://forge.typo3.org/issues/54265 Change-Id: I2089e5d0ff43281d1de564d66f6cab8eb45708f3 --- M client/includes/Usage/SiteLinkUsageLookup.php M client/maintenance/populateEntityUsage.php M lib/includes/ChangesTable.php M lib/includes/PidLock.php M lib/includes/store/ChunkCache.php M lib/includes/store/sql/SiteLinkTable.php M lib/includes/store/sql/TermSqlIndex.php M lib/tests/phpunit/store/MockChunkAccess.php M repo/includes/ChangeDispatcher.php M repo/includes/EditEntity.php M repo/includes/api/ApiWikibase.php M repo/includes/api/CreateClaim.php M repo/includes/api/MergeItems.php M repo/includes/api/ModifyEntity.php M repo/includes/api/RemoveClaims.php M repo/includes/api/RemoveQualifiers.php M repo/includes/api/RemoveReferences.php M repo/includes/api/ResultBuilder.php M repo/includes/api/SetClaim.php M repo/includes/api/SetClaimValue.php M repo/includes/api/SetQualifier.php M repo/includes/api/SetReference.php M repo/includes/content/EntityContentFactory.php M repo/includes/store/sql/DispatchStats.php M repo/includes/store/sql/EntityPerPageTable.php M repo/includes/store/sql/WikiPageEntityStore.php M repo/maintenance/dispatchChanges.php M repo/maintenance/pruneChanges.php M repo/maintenance/rebuildEntityPerPage.php M repo/maintenance/rebuildItemsPerSite.php M repo/maintenance/rebuildPropertyInfo.php M repo/maintenance/rebuildTermsSearchKey.php M view/src/EntityViewPlaceholderExpander.php 33 files changed, 57 insertions(+), 54 deletions(-) Approvals: Addshore: Looks good to me, approved jenkins-bot: Verified diff --git a/client/includes/Usage/SiteLinkUsageLookup.php b/client/includes/Usage/SiteLinkUsageLookup.php index 5b52bdb..582c081 100644 --- a/client/includes/Usage/SiteLinkUsageLookup.php +++ b/client/includes/Usage/SiteLinkUsageLookup.php @@ -161,7 +161,7 @@ private function getItemIdsFromSiteLinkRows( array $rows ) { $itemIds = array_map( function ( array $row ) { - return intval( $row[2] ); + return (int)$row[2]; }, $rows ); diff --git a/client/maintenance/populateEntityUsage.php b/client/maintenance/populateEntityUsage.php index 74d4c27..985f43a 100644 --- a/client/maintenance/populateEntityUsage.php +++ b/client/maintenance/populateEntityUsage.php @@ -43,7 +43,7 @@ exit; } - $startPage = intval( $this->getOption( 'start-page', 0 ) ); + $startPage = (int)$this->getOption( 'start-page', 0 ); $reporter = new ObservableMessageReporter(); $reporter->registerReporterCallback( diff --git a/lib/includes/ChangesTable.php b/lib/includes/ChangesTable.php index 65f0139..66e1f7d 100644 --- a/lib/includes/ChangesTable.php +++ b/lib/includes/ChangesTable.php @@ -151,7 +151,7 @@ return $this->selectObjects( null, array( - 'id >= ' . intval( $start ) + 'id >= ' . (int)$start ), array( 'LIMIT' => $size, diff --git a/lib/includes/PidLock.php b/lib/includes/PidLock.php index 3f84551..edb9567 100644 --- a/lib/includes/PidLock.php +++ b/lib/includes/PidLock.php @@ -57,7 +57,7 @@ } if ( preg_match( '/\d+/', $process, $matches ) - && intval( $pid ) === intval( $matches[0] ) + && (int)$pid === (int)$matches[0] ) { return true; } diff --git a/lib/includes/store/ChunkCache.php b/lib/includes/store/ChunkCache.php index 3a379d0..9965db6 100644 --- a/lib/includes/store/ChunkCache.php +++ b/lib/includes/store/ChunkCache.php @@ -115,7 +115,7 @@ assert( '$high >= 0' ); assert( '$low >= 0' ); - $mid = intval( floor( ( $low + $high ) / 2 ) ); + $mid = (int)( ( $low + $high ) / 2 ); $entry = $this->entries[$mid]; diff --git a/lib/includes/store/sql/SiteLinkTable.php b/lib/includes/store/sql/SiteLinkTable.php index f2bcde9..797e2ea 100644 --- a/lib/includes/store/sql/SiteLinkTable.php +++ b/lib/includes/store/sql/SiteLinkTable.php @@ -318,7 +318,7 @@ 'ips_site_page', 'ips_item_id', ), - "($anyOfTheLinks) AND ips_item_id != " . intval( $item->getId()->getNumericId() ), + "($anyOfTheLinks) AND ips_item_id != " . (int)$item->getId()->getNumericId(), __METHOD__ ); diff --git a/lib/includes/store/sql/TermSqlIndex.php b/lib/includes/store/sql/TermSqlIndex.php index 0d54f05..38fa5d2 100644 --- a/lib/includes/store/sql/TermSqlIndex.php +++ b/lib/includes/store/sql/TermSqlIndex.php @@ -529,7 +529,7 @@ $queryOptions = array(); if ( isset( $options['LIMIT'] ) && $options['LIMIT'] > 0 ) { - $queryOptions['LIMIT'] = intval( $options['LIMIT'] ); + $queryOptions['LIMIT'] = (int)$options['LIMIT']; } $obtainedTerms = $dbr->select( @@ -586,7 +586,7 @@ 'LIMIT' => $internalLimit, ); - $requestedLimit = isset( $options['LIMIT'] ) ? max( intval( $options['LIMIT'] ), 0 ) : 0; + $requestedLimit = isset( $options['LIMIT'] ) ? max( (int)$options['LIMIT'], 0 ) : 0; // if we take the weight into account, we need to grab basically all hits in order // to allow for the post-search sorting below. if ( !$hasWeight && $requestedLimit > 0 && $requestedLimit < $queryOptions['LIMIT'] ) { diff --git a/lib/tests/phpunit/store/MockChunkAccess.php b/lib/tests/phpunit/store/MockChunkAccess.php index 1e85734..7c07c8c 100644 --- a/lib/tests/phpunit/store/MockChunkAccess.php +++ b/lib/tests/phpunit/store/MockChunkAccess.php @@ -75,6 +75,7 @@ * @return int */ public function getRecordId( $rec ) { - return intval( $rec ); + return (int)$rec; } -} \ No newline at end of file + +} diff --git a/repo/includes/ChangeDispatcher.php b/repo/includes/ChangeDispatcher.php index 3b82c44..5a94659 100644 --- a/repo/includes/ChangeDispatcher.php +++ b/repo/includes/ChangeDispatcher.php @@ -212,7 +212,7 @@ */ public function dispatchTo( $wikiState ) { $siteID = $wikiState['chd_site']; - $after = intval( $wikiState['chd_seen'] ); + $after = (int)$wikiState['chd_seen']; // get relevant changes $this->trace( "Finding pending changes for $siteID" ); diff --git a/repo/includes/EditEntity.php b/repo/includes/EditEntity.php index 7b1fcf2..74a57a2 100644 --- a/repo/includes/EditEntity.php +++ b/repo/includes/EditEntity.php @@ -187,7 +187,7 @@ $this->newEntity = $newEntity; if ( is_string( $baseRevId ) ) { - $baseRevId = intval( $baseRevId ); + $baseRevId = (int)$baseRevId; } if ( $baseRevId === 0 ) { diff --git a/repo/includes/api/ApiWikibase.php b/repo/includes/api/ApiWikibase.php index 1a25d0d..e44ef29 100644 --- a/repo/includes/api/ApiWikibase.php +++ b/repo/includes/api/ApiWikibase.php @@ -413,7 +413,7 @@ $flags |= EDIT_FORCE_BOT; } - $baseRevisionId = isset( $params['baserevid'] ) ? intval( $params['baserevid'] ) : null; + $baseRevisionId = isset( $params['baserevid'] ) ? (int)$params['baserevid'] : null; $editEntity = new EditEntity( $this->titleLookup, diff --git a/repo/includes/api/CreateClaim.php b/repo/includes/api/CreateClaim.php index 8422bfd..5ecaec4 100644 --- a/repo/includes/api/CreateClaim.php +++ b/repo/includes/api/CreateClaim.php @@ -49,7 +49,7 @@ $this->validateParameters( $params ); $entityId = $this->claimModificationHelper->getEntityIdFromString( $params['entity'] ); - $baseRevisionId = isset( $params['baserevid'] ) ? intval( $params['baserevid'] ) : null; + $baseRevisionId = isset( $params['baserevid'] ) ? (int)$params['baserevid'] : null; $entityRevision = $this->loadEntityRevision( $entityId, $baseRevisionId ); $entity = $entityRevision->getEntity(); diff --git a/repo/includes/api/MergeItems.php b/repo/includes/api/MergeItems.php index c2dd0b8..d237786 100644 --- a/repo/includes/api/MergeItems.php +++ b/repo/includes/api/MergeItems.php @@ -173,7 +173,7 @@ $this->resultBuilder->setValue( $name, 'lastrevid', - intval( $revisionId ) + (int)$revisionId ); } diff --git a/repo/includes/api/ModifyEntity.php b/repo/includes/api/ModifyEntity.php index 4d5495d..147a102 100644 --- a/repo/includes/api/ModifyEntity.php +++ b/repo/includes/api/ModifyEntity.php @@ -112,7 +112,7 @@ // Things that use this method assume null means we want a new entity if ( $entityId !== null ) { - $baseRevisionId = isset( $params['baserevid'] ) ? intval( $params['baserevid'] ) : 0; + $baseRevisionId = isset( $params['baserevid'] ) ? (int)$params['baserevid'] : 0; if ( $baseRevisionId === 0 ) { $baseRevisionId = EntityRevisionLookup::LATEST_FROM_MASTER; diff --git a/repo/includes/api/RemoveClaims.php b/repo/includes/api/RemoveClaims.php index 9f99724..33e5263 100644 --- a/repo/includes/api/RemoveClaims.php +++ b/repo/includes/api/RemoveClaims.php @@ -49,7 +49,7 @@ public function execute() { $params = $this->extractRequestParams(); $entityId = $this->getEntityId( $params ); - $baseRevisionId = isset( $params['baserevid'] ) ? intval( $params['baserevid'] ) : null; + $baseRevisionId = isset( $params['baserevid'] ) ? (int)$params['baserevid'] : null; $entityRevision = $this->loadEntityRevision( $entityId, $baseRevisionId ); $entity = $entityRevision->getEntity(); diff --git a/repo/includes/api/RemoveQualifiers.php b/repo/includes/api/RemoveQualifiers.php index 00bd5f4..982792c 100644 --- a/repo/includes/api/RemoveQualifiers.php +++ b/repo/includes/api/RemoveQualifiers.php @@ -50,7 +50,7 @@ $claimGuid = $params['claim']; $entityId = $this->claimGuidParser->parse( $claimGuid )->getEntityId(); - $baseRevisionId = isset( $params['baserevid'] ) ? intval( $params['baserevid'] ) : null; + $baseRevisionId = isset( $params['baserevid'] ) ? (int)$params['baserevid'] : null; $entityRevision = $this->loadEntityRevision( $entityId, $baseRevisionId ); $entity = $entityRevision->getEntity(); $summary = $this->claimModificationHelper->createSummary( $params, $this ); diff --git a/repo/includes/api/RemoveReferences.php b/repo/includes/api/RemoveReferences.php index e580cdc..c0a1a45 100644 --- a/repo/includes/api/RemoveReferences.php +++ b/repo/includes/api/RemoveReferences.php @@ -50,7 +50,7 @@ $claimGuid = $params['statement']; $entityId = $this->claimGuidParser->parse( $claimGuid )->getEntityId(); - $baseRevisionId = isset( $params['baserevid'] ) ? intval( $params['baserevid'] ) : null; + $baseRevisionId = isset( $params['baserevid'] ) ? (int)$params['baserevid'] : null; $entityRevision = $this->loadEntityRevision( $entityId, $baseRevisionId ); $entity = $entityRevision->getEntity(); $summary = $this->claimModificationHelper->createSummary( $params, $this ); diff --git a/repo/includes/api/ResultBuilder.php b/repo/includes/api/ResultBuilder.php index c36f1fe..64947b1 100644 --- a/repo/includes/api/ResultBuilder.php +++ b/repo/includes/api/ResultBuilder.php @@ -98,12 +98,14 @@ * @throws InvalidArgumentException */ public function markSuccess( $success = true ) { - $value = intval( $success ); - if( $value !== 1 && $value !== 0 ){ + $value = (int)$success; + + if ( $value !== 1 && $value !== 0 ) { throw new InvalidArgumentException( - '$wasSuccess must evaluate to either 1 or 0 when using intval()' + '$success must evaluate to either 1 or 0 when casted to integer' ); } + $this->result->addValue( null, 'success', $value ); } diff --git a/repo/includes/api/SetClaim.php b/repo/includes/api/SetClaim.php index 312fbd3..a04b397 100644 --- a/repo/includes/api/SetClaim.php +++ b/repo/includes/api/SetClaim.php @@ -72,7 +72,7 @@ } $entityId = $claimGuid->getEntityId(); - $baseRevisionId = isset( $params['baserevid'] ) ? intval( $params['baserevid'] ) : null; + $baseRevisionId = isset( $params['baserevid'] ) ? (int)$params['baserevid'] : null; $entityRevision = $this->loadEntityRevision( $entityId, $baseRevisionId ); $entity = $entityRevision->getEntity(); diff --git a/repo/includes/api/SetClaimValue.php b/repo/includes/api/SetClaimValue.php index 8c53a4c..84e5b20 100644 --- a/repo/includes/api/SetClaimValue.php +++ b/repo/includes/api/SetClaimValue.php @@ -46,7 +46,7 @@ $claimGuid = $params['claim']; $entityId = $this->claimGuidParser->parse( $claimGuid )->getEntityId(); - $baseRevisionId = isset( $params['baserevid'] ) ? intval( $params['baserevid'] ) : null; + $baseRevisionId = isset( $params['baserevid'] ) ? (int)$params['baserevid'] : null; $entityRevision = $this->loadEntityRevision( $entityId, $baseRevisionId ); $entity = $entityRevision->getEntity(); diff --git a/repo/includes/api/SetQualifier.php b/repo/includes/api/SetQualifier.php index 3746c18..ce8bb8c 100644 --- a/repo/includes/api/SetQualifier.php +++ b/repo/includes/api/SetQualifier.php @@ -49,7 +49,7 @@ $this->validateParameters( $params ); $entityId = $this->claimGuidParser->parse( $params['claim'] )->getEntityId(); - $baseRevisionId = isset( $params['baserevid'] ) ? intval( $params['baserevid'] ) : null; + $baseRevisionId = isset( $params['baserevid'] ) ? (int)$params['baserevid'] : null; $entityRevision = $this->loadEntityRevision( $entityId, $baseRevisionId ); $entity = $entityRevision->getEntity(); diff --git a/repo/includes/api/SetReference.php b/repo/includes/api/SetReference.php index 0c3b922..c4141e3 100644 --- a/repo/includes/api/SetReference.php +++ b/repo/includes/api/SetReference.php @@ -53,7 +53,7 @@ $this->validateParameters( $params ); $entityId = $this->claimGuidParser->parse( $params['statement'] )->getEntityId(); - $baseRevisionId = isset( $params['baserevid'] ) ? intval( $params['baserevid'] ) : null; + $baseRevisionId = isset( $params['baserevid'] ) ? (int)$params['baserevid'] : null; $entityRevision = $this->loadEntityRevision( $entityId, $baseRevisionId ); $entity = $entityRevision->getEntity(); diff --git a/repo/includes/content/EntityContentFactory.php b/repo/includes/content/EntityContentFactory.php index d7b5490..6b675d5 100644 --- a/repo/includes/content/EntityContentFactory.php +++ b/repo/includes/content/EntityContentFactory.php @@ -203,7 +203,7 @@ * @return EntityContent|null */ public function getFromRevision( $revisionId ) { - $revision = Revision::newFromId( intval( $revisionId ) ); + $revision = Revision::newFromId( (int)$revisionId ); if ( $revision === null ) { return null; diff --git a/repo/includes/store/sql/DispatchStats.php b/repo/includes/store/sql/DispatchStats.php index b3db135..b0f58d5 100644 --- a/repo/includes/store/sql/DispatchStats.php +++ b/repo/includes/store/sql/DispatchStats.php @@ -147,10 +147,11 @@ $n = count( $this->clientStates ); if ( $n > 0 ) { - $this->average->chd_untouched = intval( $this->average->chd_untouched / $n ); - $this->average->chd_pending = intval( $this->average->chd_pending / $n ); + $this->average->chd_untouched = (int)( $this->average->chd_untouched / $n ); + $this->average->chd_pending = (int)( $this->average->chd_pending / $n ); $this->average->chd_lag = $this->average->chd_lag === null - ? null : intval( $this->average->chd_lag / $n ); + ? null + : (int)( $this->average->chd_lag / $n ); } return $n; @@ -277,7 +278,7 @@ * @return int */ public function getMaxChangeId() { - return intval( $this->changeStats->max_id ); + return (int)$this->changeStats->max_id; } /** @@ -286,7 +287,7 @@ * @return int */ public function getMinChangeId() { - return intval( $this->changeStats->min_id ); + return (int)$this->changeStats->min_id; } /** diff --git a/repo/includes/store/sql/EntityPerPageTable.php b/repo/includes/store/sql/EntityPerPageTable.php index 5b89628..2e59686 100644 --- a/repo/includes/store/sql/EntityPerPageTable.php +++ b/repo/includes/store/sql/EntityPerPageTable.php @@ -426,7 +426,7 @@ return false; } - return intval( $row->epp_page_id ); + return (int)$row->epp_page_id; } /** diff --git a/repo/includes/store/sql/WikiPageEntityStore.php b/repo/includes/store/sql/WikiPageEntityStore.php index 11c0553..35cb94a 100644 --- a/repo/includes/store/sql/WikiPageEntityStore.php +++ b/repo/includes/store/sql/WikiPageEntityStore.php @@ -298,7 +298,7 @@ 'rev_page' => $pageId, 'rev_id > ' . intval( $lastRevId ) . ' OR rev_timestamp > ' . $dbw->addQuotes( $revision->getTimestamp() ), - 'rev_user != ' . intval( $user->getId() ) + 'rev_user != ' . (int)$user->getId() . ' OR rev_user_text != ' . $dbw->addQuotes( $user->getName() ), ), __METHOD__, diff --git a/repo/maintenance/dispatchChanges.php b/repo/maintenance/dispatchChanges.php index 514a8c3..884a71e 100644 --- a/repo/maintenance/dispatchChanges.php +++ b/repo/maintenance/dispatchChanges.php @@ -77,10 +77,10 @@ $batchCacheFactor = $settings->getSetting( 'dispatchBatchCacheFactor' ); $subscriptionLookupMode = $settings->getSetting( 'subscriptionLookupMode' ); - $batchSize = intval( $this->getOption( 'batch-size', 1000 ) ); - $dispatchInterval = intval( $this->getOption( 'dispatch-interval', 60 ) ); - $lockGraceInterval = intval( $this->getOption( 'lock-grace-interval', 60 ) ); - $randomness = intval( $this->getOption( 'randomness', 10 ) ); + $batchSize = (int)$this->getOption( 'batch-size', 1000 ); + $dispatchInterval = (int)$this->getOption( 'dispatch-interval', 60 ); + $lockGraceInterval = (int)$this->getOption( 'lock-grace-interval', 60 ); + $randomness = (int)$this->getOption( 'randomness', 10 ); $this->verbose = $this->getOption( 'verbose', false ); @@ -149,9 +149,9 @@ throw new MWException( "WikibaseLib has not been loaded." ); } - $maxTime = intval( $this->getOption( 'max-time', PHP_INT_MAX ) ); - $maxPasses = intval( $this->getOption( 'max-passes', $maxTime < PHP_INT_MAX ? PHP_INT_MAX : 1 ) ); - $delay = intval( $this->getOption( 'idle-delay', 10 ) ); + $maxTime = (int)$this->getOption( 'max-time', PHP_INT_MAX ); + $maxPasses = (int)$this->getOption( 'max-passes', $maxTime < PHP_INT_MAX ? PHP_INT_MAX : 1 ); + $delay = (int)$this->getOption( 'idle-delay', 10 ); $settings = WikibaseRepo::getDefaultInstance()->getSettings(); $dispatcher = $this->newChangeDispatcher( $settings ); diff --git a/repo/maintenance/pruneChanges.php b/repo/maintenance/pruneChanges.php index c5f97a0..ee300c8 100644 --- a/repo/maintenance/pruneChanges.php +++ b/repo/maintenance/pruneChanges.php @@ -64,10 +64,10 @@ private function getKeepSeconds() { $keepSeconds = 0; - $keepSeconds += intval( $this->getOption( 'number-of-days', 0 ) ) * 24 * 60 * 60; - $keepSeconds += intval( $this->getOption( 'keep-days', 0 ) ) * 24 * 60 * 60; - $keepSeconds += intval( $this->getOption( 'keep-hours', 0 ) ) * 60 * 60; - $keepSeconds += intval( $this->getOption( 'keep-minutes', 0 ) ) * 60; + $keepSeconds += (int)$this->getOption( 'number-of-days', 0 ) * 24 * 60 * 60; + $keepSeconds += (int)$this->getOption( 'keep-days', 0 ) * 24 * 60 * 60; + $keepSeconds += (int)$this->getOption( 'keep-hours', 0 ) * 60 * 60; + $keepSeconds += (int)$this->getOption( 'keep-minutes', 0 ) * 60; if ( $keepSeconds === 0 ) { // one day @@ -79,7 +79,7 @@ private function getGraceSeconds() { $graceSeconds = 0; - $graceSeconds += intval( $this->getOption( 'grace-minutes', 0 ) ) * 60; + $graceSeconds += (int)$this->getOption( 'grace-minutes', 0 ) * 60; if ( $graceSeconds === 0 ) { // one hour diff --git a/repo/maintenance/rebuildEntityPerPage.php b/repo/maintenance/rebuildEntityPerPage.php index 7e65cd5..8838301 100644 --- a/repo/maintenance/rebuildEntityPerPage.php +++ b/repo/maintenance/rebuildEntityPerPage.php @@ -42,7 +42,7 @@ exit; } - $batchSize = intval( $this->getOption( 'batch-size', 100 ) ); + $batchSize = (int)$this->getOption( 'batch-size', 100 ); $rebuildAll = $this->getOption( 'rebuild-all', false ); $reporter = new ObservableMessageReporter(); diff --git a/repo/maintenance/rebuildItemsPerSite.php b/repo/maintenance/rebuildItemsPerSite.php index c26f8b9..c7c6f81 100644 --- a/repo/maintenance/rebuildItemsPerSite.php +++ b/repo/maintenance/rebuildItemsPerSite.php @@ -40,7 +40,7 @@ exit; } - $batchSize = intval( $this->getOption( 'batch-size', 100 ) ); + $batchSize = (int)$this->getOption( 'batch-size', 100 ); $reporter = new ObservableMessageReporter(); $reporter->registerReporterCallback( diff --git a/repo/maintenance/rebuildPropertyInfo.php b/repo/maintenance/rebuildPropertyInfo.php index eb8f718..59c550c 100644 --- a/repo/maintenance/rebuildPropertyInfo.php +++ b/repo/maintenance/rebuildPropertyInfo.php @@ -53,9 +53,9 @@ $builder = new PropertyInfoTableBuilder( $table, $entityLookup, $useRedirectTargetColumn ); $builder->setReporter( $reporter ); - $builder->setBatchSize( intval( $this->getOption( 'batch-size', 100 ) ) ); + $builder->setBatchSize( (int)$this->getOption( 'batch-size', 100 ) ); $builder->setRebuildAll( $this->getOption( 'rebuild-all', false ) ); - $builder->setFromId( intval( $this->getOption( 'start-row', 1 ) ) ); + $builder->setFromId( (int)$this->getOption( 'start-row', 1 ) ); $n = $builder->rebuildPropertyInfo(); diff --git a/repo/maintenance/rebuildTermsSearchKey.php b/repo/maintenance/rebuildTermsSearchKey.php index 1eb1fec..1c67e79 100644 --- a/repo/maintenance/rebuildTermsSearchKey.php +++ b/repo/maintenance/rebuildTermsSearchKey.php @@ -50,9 +50,9 @@ $builder = new TermSearchKeyBuilder( $table ); $builder->setReporter( $reporter ); - $builder->setBatchSize( intval( $this->getOption( 'batch-size', 100 ) ) ); + $builder->setBatchSize( (int)$this->getOption( 'batch-size', 100 ) ); $builder->setRebuildAll( !$this->getOption( 'only-missing', false ) ); - $builder->setFromId( intval( $this->getOption( 'start-row', 1 ) ) ); + $builder->setFromId( (int)$this->getOption( 'start-row', 1 ) ); $n = $builder->rebuildSearchKey(); diff --git a/view/src/EntityViewPlaceholderExpander.php b/view/src/EntityViewPlaceholderExpander.php index 00f2e2d..75044e2 100644 --- a/view/src/EntityViewPlaceholderExpander.php +++ b/view/src/EntityViewPlaceholderExpander.php @@ -203,13 +203,12 @@ * @return string */ protected function expandPlaceholder( $name, array $args ) { - switch ( $name ) { case 'termbox': $entityId = $this->getEntityIdFromString( $args[0] ); return $this->renderTermBox( $entityId, - isset( $args[1] ) ? intval( $args[1] ) : 0 + isset( $args[1] ) ? (int)$args[1] : 0 ); case 'entityViewPlaceholder-entitytermsview-entitytermsforlanguagelistview-class': return -- To view, visit https://gerrit.wikimedia.org/r/207425 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2089e5d0ff43281d1de564d66f6cab8eb45708f3 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de> Gerrit-Reviewer: Addshore <addshorew...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits