Thiemo Mättig (WMDE) has uploaded a new change for review. https://gerrit.wikimedia.org/r/174848
Change subject: Small clean ups in Changes related code ...................................................................... Small clean ups in Changes related code This are some small bits split from If6c96e0. I still don't know what causes the error there. Change-Id: Ic4950314d320105e36abc2eb7678f01451288ba7 --- M client/includes/Changes/ChangeHandler.php M client/includes/Changes/ChangeListTransformer.php M client/includes/Changes/ChangeRunCoalescer.php M client/includes/Changes/PageUpdater.php M client/includes/Changes/WikiPageUpdater.php M client/tests/phpunit/includes/Changes/AffectedPagesFinderTest.php M client/tests/phpunit/includes/Changes/MockPageUpdater.php 7 files changed, 25 insertions(+), 22 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/48/174848/1 diff --git a/client/includes/Changes/ChangeHandler.php b/client/includes/Changes/ChangeHandler.php index 0d6ddbd..037dfcd 100644 --- a/client/includes/Changes/ChangeHandler.php +++ b/client/includes/Changes/ChangeHandler.php @@ -137,7 +137,6 @@ * @param Change $change * * @throws MWException - * * @return bool */ public function handleChange( Change $change ) { @@ -262,7 +261,7 @@ * * @since 0.4 * - * @param \Wikibase\EntityChange $change The Change that caused the update + * @param EntityChange $change The Change that caused the update * * @return array|boolean an array of RC attributes, * or false if the change does not provide edit meta data @@ -354,7 +353,7 @@ * * @param EntityChange $change the change to get a comment for * - * @throws \MWException + * @throws MWException * @return array */ public function getEditComment( EntityChange $change ) { @@ -369,7 +368,7 @@ $editComment = $commentCreator->getEditComment( $siteLinkDiff, $action, $comment ); if( is_array( $editComment ) && !isset( $editComment['message'] ) ) { - throw new \MWException( 'getEditComment returned an empty comment' ); + throw new MWException( 'getEditComment returned an empty comment' ); } return $editComment; diff --git a/client/includes/Changes/ChangeListTransformer.php b/client/includes/Changes/ChangeListTransformer.php index 1552a74..65d8a0a 100644 --- a/client/includes/Changes/ChangeListTransformer.php +++ b/client/includes/Changes/ChangeListTransformer.php @@ -11,7 +11,6 @@ * * @licence GNU GPL v2+ * @author Daniel Kinzler - * */ interface ChangeListTransformer { diff --git a/client/includes/Changes/ChangeRunCoalescer.php b/client/includes/Changes/ChangeRunCoalescer.php index d81c56a..76974e3 100644 --- a/client/includes/Changes/ChangeRunCoalescer.php +++ b/client/includes/Changes/ChangeRunCoalescer.php @@ -2,6 +2,7 @@ namespace Wikibase\Client\Changes; +use Exception; use MWException; use Wikibase\Change; use Wikibase\EntityChange; @@ -19,7 +20,6 @@ * * @licence GNU GPL v2+ * @author Daniel Kinzler - * */ class ChangeRunCoalescer implements ChangeListTransformer { @@ -71,20 +71,20 @@ $coalesced = array_merge( $coalesced, $entityChanges ); } - usort( $coalesced, 'Wikibase\Client\Changes\ChangeRunCoalescer::compareChangesByTimestamp' ); + usort( $coalesced, array( $this, 'compareChangesByTimestamp' ) ); - wfDebugLog( __CLASS__, __METHOD__ . ": coalesced " - . count( $changes ) . " into " . count( $coalesced ) . " changes" ); + wfDebugLog( __CLASS__, __METHOD__ . ': coalesced ' + . count( $changes ) . ' into ' . count( $coalesced ) . ' changes' ); wfProfileOut( __METHOD__ ); return $coalesced; } - /** * Group changes by the entity they were applied to. * * @param EntityChange[] $changes + * * @return EntityChange[][] an associative array using entity IDs for keys. Associated with each * entity ID is the list of changes performed on that entity. */ @@ -211,6 +211,7 @@ * Interleaved changes to different items will break runs. * * @param EntityChange[] $changes + * * @return EntityChange[] grouped changes */ private function coalesceRuns( array $changes ) { @@ -270,8 +271,8 @@ $currentRun[] = $change; // skip any change that failed to process in some way (bug 49417) - } catch ( \Exception $e ) { - wfLogWarning( __METHOD__ . ':' . $e->getMessage() ); + } catch ( Exception $ex ) { + wfLogWarning( __METHOD__ . ':' . $ex->getMessage() ); } } @@ -298,7 +299,7 @@ * * @return int */ - public static function compareChangesByTimestamp( Change $a, Change $b ) { + public function compareChangesByTimestamp( Change $a, Change $b ) { //NOTE: beware https://bugs.php.net/bug.php?id=50688 ! if ( $a->getTime() > $b->getTime() ) { @@ -316,4 +317,4 @@ return 0; } -} \ No newline at end of file +} diff --git a/client/includes/Changes/PageUpdater.php b/client/includes/Changes/PageUpdater.php index 5246cce..d7cf15f 100644 --- a/client/includes/Changes/PageUpdater.php +++ b/client/includes/Changes/PageUpdater.php @@ -2,6 +2,8 @@ namespace Wikibase\Client\Changes; +use Title; + /** * Service interface for triggering different kinds of page updates * and generally notifying the local wiki of external changes. @@ -21,7 +23,7 @@ * * @since 0.4 * - * @param \Title[] $titles The Titles of the pages to update + * @param Title[] $titles The Titles of the pages to update */ public function purgeParserCache( array $titles ); @@ -30,7 +32,7 @@ * * @since 0.4 * - * @param \Title[] $titles The Titles of the pages to update + * @param Title[] $titles The Titles of the pages to update */ public function purgeWebCache( array $titles ); @@ -39,17 +41,18 @@ * * @since 0.4 * - * @param \Title[] $titles The Titles of the pages to update + * @param Title[] $titles The Titles of the pages to update */ public function scheduleRefreshLinks( array $titles ); /** * Injects an RC entry into the recentchanges, using the the given title and attribs * - * @param \Title $title + * @param Title $title * @param array $attribs * * @return bool */ - public function injectRCRecord( \Title $title, array $attribs ); -} \ No newline at end of file + public function injectRCRecord( Title $title, array $attribs ); + +} diff --git a/client/includes/Changes/WikiPageUpdater.php b/client/includes/Changes/WikiPageUpdater.php index 17efb69..8653894 100644 --- a/client/includes/Changes/WikiPageUpdater.php +++ b/client/includes/Changes/WikiPageUpdater.php @@ -107,4 +107,5 @@ wfProfileOut( __METHOD__ ); return true; } + } diff --git a/client/tests/phpunit/includes/Changes/AffectedPagesFinderTest.php b/client/tests/phpunit/includes/Changes/AffectedPagesFinderTest.php index b07bc39..20b829c 100644 --- a/client/tests/phpunit/includes/Changes/AffectedPagesFinderTest.php +++ b/client/tests/phpunit/includes/Changes/AffectedPagesFinderTest.php @@ -70,7 +70,7 @@ ->method( 'getPagesUsing' ) ->will( $this->returnValue( new ArrayIterator( $usage ) ) ); - $namespaceChecker = $this->getMockBuilder( '\Wikibase\NamespaceChecker' ) + $namespaceChecker = $this->getMockBuilder( 'Wikibase\NamespaceChecker' ) ->disableOriginalConstructor()->getMock(); $namespaceChecker->expects( $this->any() ) diff --git a/client/tests/phpunit/includes/Changes/MockPageUpdater.php b/client/tests/phpunit/includes/Changes/MockPageUpdater.php index 5cc70d7..eca6826 100644 --- a/client/tests/phpunit/includes/Changes/MockPageUpdater.php +++ b/client/tests/phpunit/includes/Changes/MockPageUpdater.php @@ -18,7 +18,7 @@ */ class MockPageUpdater implements PageUpdater { - protected $updates = array( + private $updates = array( 'purgeParserCache' => array(), 'purgeWebCache' => array(), 'scheduleRefreshLinks' => array(), -- To view, visit https://gerrit.wikimedia.org/r/174848 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic4950314d320105e36abc2eb7678f01451288ba7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits