jenkins-bot has submitted this change and it was merged.

Change subject: Move Repo Hooks classes to Hooks folder/namespace
......................................................................


Move Repo Hooks classes to Hooks folder/namespace

The folder in Wikibase Client was called "hooks" (lowercase plural),
the folder in Wikibase Repo was called "Hook" (uppercase singular).
The two patches If466217 and If9295f0 make these two equal.

A lot more folders/namespaces need to be cleaned up the same way
but I want to do this in patches that are as small as possible.

Change-Id: If9295f0996ac2aa791de4169b97d76e2d5e0923a
---
M repo/Wikibase.hooks.php
M repo/Wikibase.php
R repo/includes/Hooks/LabelPrefetchHookHandlers.php
R repo/includes/Hooks/LinkBeginHookHandler.php
R repo/includes/Hooks/OutputPageJsConfigHookHandler.php
R repo/tests/phpunit/includes/Hooks/LabelPrefetchHookHandlersTest.php
R repo/tests/phpunit/includes/Hooks/LinkBeginHookHandlerTest.php
R repo/tests/phpunit/includes/Hooks/OutputPageJsConfigHookHandlerTest.php
8 files changed, 33 insertions(+), 22 deletions(-)

Approvals:
  JanZerebecki: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/repo/Wikibase.hooks.php b/repo/Wikibase.hooks.php
index 3c3bb5c..440427e 100644
--- a/repo/Wikibase.hooks.php
+++ b/repo/Wikibase.hooks.php
@@ -28,8 +28,8 @@
 use User;
 use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\DataModel\Entity\EntityIdParsingException;
-use Wikibase\Hook\OutputPageJsConfigHookHandler;
 use Wikibase\Repo\Content\EntityHandler;
+use Wikibase\Repo\Hooks\OutputPageJsConfigHookHandler;
 use Wikibase\Repo\View\EntityViewPlaceholderExpander;
 use Wikibase\Repo\View\TextInjector;
 use Wikibase\Repo\WikibaseRepo;
diff --git a/repo/Wikibase.php b/repo/Wikibase.php
index f9c7cbe..ba61cd9 100644
--- a/repo/Wikibase.php
+++ b/repo/Wikibase.php
@@ -176,8 +176,8 @@
        $wgHooks['ArticleDeleteComplete'][]                             = 
'Wikibase\RepoHooks::onArticleDeleteComplete';
        $wgHooks['ArticleUndelete'][]                                           
= 'Wikibase\RepoHooks::onArticleUndelete';
        $wgHooks['GetPreferences'][]                                            
= 'Wikibase\RepoHooks::onGetPreferences';
-       $wgHooks['LinkBegin'][]                                                 
        = 'Wikibase\Repo\Hook\LinkBeginHookHandler::onLinkBegin';
-       $wgHooks['ChangesListInitRows'][]                                       
= 'Wikibase\Repo\Hook\LabelPrefetchHookHandlers::onChangesListInitRows';
+       $wgHooks['LinkBegin'][]                                                 
        = 'Wikibase\Repo\Hooks\LinkBeginHookHandler::onLinkBegin';
+       $wgHooks['ChangesListInitRows'][]                                       
= 'Wikibase\Repo\Hooks\LabelPrefetchHookHandlers::onChangesListInitRows';
        $wgHooks['OutputPageBodyAttributes'][]                          = 
'Wikibase\RepoHooks::onOutputPageBodyAttributes';
        //FIXME: handle other types of entities with autocomments too!
        $wgHooks['FormatAutocomments'][]                                        
= array( 'Wikibase\RepoHooks::onFormat', array( CONTENT_MODEL_WIKIBASE_ITEM, 
"wikibase-item" ) );
diff --git a/repo/includes/Hook/LabelPrefetchHookHandlers.php 
b/repo/includes/Hooks/LabelPrefetchHookHandlers.php
similarity index 93%
rename from repo/includes/Hook/LabelPrefetchHookHandlers.php
rename to repo/includes/Hooks/LabelPrefetchHookHandlers.php
index d43e4fd..154d255 100644
--- a/repo/includes/Hook/LabelPrefetchHookHandlers.php
+++ b/repo/includes/Hooks/LabelPrefetchHookHandlers.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Wikibase\Repo\Hook;
+namespace Wikibase\Repo\Hooks;
 
 use ChangesList;
 use RequestContext;
@@ -101,6 +101,13 @@
                return $handler->doChangesListInitRows( $list, $rows );
        }
 
+       /**
+        * @param TermBuffer $buffer
+        * @param EntityIdLookup $idLookup
+        * @param TitleFactory $titleFactory
+        * @param string[] $termTypes
+        * @param string[] $languageCodes
+        */
        public function __construct(
                TermBuffer $buffer,
                EntityIdLookup $idLookup,
@@ -108,7 +115,6 @@
                array $termTypes,
                array $languageCodes
        ) {
-
                $this->buffer = $buffer;
                $this->idLookup = $idLookup;
                $this->titleFactory = $titleFactory;
@@ -148,4 +154,5 @@
 
                return $titles;
        }
+
 }
diff --git a/repo/includes/Hook/LinkBeginHookHandler.php 
b/repo/includes/Hooks/LinkBeginHookHandler.php
similarity index 99%
rename from repo/includes/Hook/LinkBeginHookHandler.php
rename to repo/includes/Hooks/LinkBeginHookHandler.php
index 92eaa02..532602c 100644
--- a/repo/includes/Hook/LinkBeginHookHandler.php
+++ b/repo/includes/Hooks/LinkBeginHookHandler.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Wikibase\Repo\Hook;
+namespace Wikibase\Repo\Hooks;
 
 use DummyLinker;
 use Language;
diff --git a/repo/includes/Hook/OutputPageJsConfigHookHandler.php 
b/repo/includes/Hooks/OutputPageJsConfigHookHandler.php
similarity index 97%
rename from repo/includes/Hook/OutputPageJsConfigHookHandler.php
rename to repo/includes/Hooks/OutputPageJsConfigHookHandler.php
index e242766..34a8f7b 100644
--- a/repo/includes/Hook/OutputPageJsConfigHookHandler.php
+++ b/repo/includes/Hooks/OutputPageJsConfigHookHandler.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Wikibase\Hook;
+namespace Wikibase\Repo\Hooks;
 
 use OutputPage;
 use Wikibase\OutputPageJsConfigBuilder;
diff --git a/repo/tests/phpunit/includes/Hook/LabelPrefetchHookHandlersTest.php 
b/repo/tests/phpunit/includes/Hooks/LabelPrefetchHookHandlersTest.php
similarity index 86%
rename from repo/tests/phpunit/includes/Hook/LabelPrefetchHookHandlersTest.php
rename to repo/tests/phpunit/includes/Hooks/LabelPrefetchHookHandlersTest.php
index e5d6782..51b3baa 100644
--- a/repo/tests/phpunit/includes/Hook/LabelPrefetchHookHandlersTest.php
+++ b/repo/tests/phpunit/includes/Hooks/LabelPrefetchHookHandlersTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Repo\Tests\Hooks;
 
 use ChangesList;
 use FauxRequest;
@@ -13,10 +13,10 @@
 use Wikibase\DataModel\Entity\EntityIdParsingException;
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\DataModel\Entity\PropertyId;
-use Wikibase\Repo\Hook\LabelPrefetchHookHandlers;
+use Wikibase\Repo\Hooks\LabelPrefetchHookHandlers;
 
 /**
- * @covers Wikibase\Repo\Hook\LabelPrefetchHookHandlers
+ * @covers Wikibase\Repo\Hooks\LabelPrefetchHookHandlers
  *
  * @since 0.5
  *
@@ -57,11 +57,12 @@
 
        /**
         * @param callback $prefetchTerms
+        * @param string[] $termTypes
+        * @param string[] $languageCodes
         *
         * @return LabelPrefetchHookHandlers
         */
-       private function getLabelPrefetchHookHandlers( $prefetchTerms, 
$termTypes, $languageCodes ) {
-
+       private function getLabelPrefetchHookHandlers( $prefetchTerms, array 
$termTypes, array $languageCodes ) {
                $termBuffer = $this->getMock( 'Wikibase\Store\TermBuffer' );
                $termBuffer->expects( $this->atLeastOnce() )
                        ->method( 'prefetchTerms' )
@@ -81,11 +82,9 @@
                        $termTypes,
                        $languageCodes
                );
-
        }
 
        public function testDoChangesListInitRows() {
-
                $rows = array(
                        (object)array( 'rc_namespace' => NS_MAIN, 'rc_title' => 
'XYZ' ),
                        (object)array( 'rc_namespace' => NS_MAIN, 'rc_title' => 
'Q23' ),
@@ -109,8 +108,12 @@
                        $expectedTermTypes,
                        $expectedLanguageCodes
                ) {
-                       $expectedIdStrings = array_map( function ( $id ) { 
return $id->getSerialization(); }, $expectedIds );
-                       $entityIdStrings = array_map( function ( $id ) { return 
$id->getSerialization(); }, $entityIds );
+                       $expectedIdStrings = array_map( function( EntityId $id 
) {
+                               return $id->getSerialization();
+                       }, $expectedIds );
+                       $entityIdStrings = array_map( function( EntityId $id ) {
+                               return $id->getSerialization();
+                       }, $entityIds );
 
                        sort( $expectedIdStrings );
                        sort( $entityIdStrings );
diff --git a/repo/tests/phpunit/includes/Hook/LinkBeginHookHandlerTest.php 
b/repo/tests/phpunit/includes/Hooks/LinkBeginHookHandlerTest.php
similarity index 98%
rename from repo/tests/phpunit/includes/Hook/LinkBeginHookHandlerTest.php
rename to repo/tests/phpunit/includes/Hooks/LinkBeginHookHandlerTest.php
index d01117c..8a567d0 100644
--- a/repo/tests/phpunit/includes/Hook/LinkBeginHookHandlerTest.php
+++ b/repo/tests/phpunit/includes/Hooks/LinkBeginHookHandlerTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Repo\Tests\Hooks;
 
 use Language;
 use RequestContext;
@@ -15,11 +15,11 @@
 use Wikibase\Lib\Store\StorageException;
 use Wikibase\Lib\Store\TermLookup;
 use Wikibase\Repo\EntityNamespaceLookup;
-use Wikibase\Repo\Hook\LinkBeginHookHandler;
+use Wikibase\Repo\Hooks\LinkBeginHookHandler;
 use Wikibase\Store\EntityIdLookup;
 
 /**
- * @covers Wikibase\Repo\Hook\LinkBeginHookHandler
+ * @covers Wikibase\Repo\Hooks\LinkBeginHookHandler
  *
  * @since 0.5
  *
@@ -262,4 +262,5 @@
                );
 
        }
+
 }
diff --git 
a/repo/tests/phpunit/includes/Hook/OutputPageJsConfigHookHandlerTest.php 
b/repo/tests/phpunit/includes/Hooks/OutputPageJsConfigHookHandlerTest.php
similarity index 92%
rename from 
repo/tests/phpunit/includes/Hook/OutputPageJsConfigHookHandlerTest.php
rename to 
repo/tests/phpunit/includes/Hooks/OutputPageJsConfigHookHandlerTest.php
index dbec07c..4c15a0e 100644
--- a/repo/tests/phpunit/includes/Hook/OutputPageJsConfigHookHandlerTest.php
+++ b/repo/tests/phpunit/includes/Hooks/OutputPageJsConfigHookHandlerTest.php
@@ -1,16 +1,16 @@
 <?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Repo\Tests\Hooks;
 
 use RequestContext;
 use Title;
 use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\DataModel\Entity\ItemId;
-use Wikibase\Hook\OutputPageJsConfigHookHandler;
+use Wikibase\Repo\Hooks\OutputPageJsConfigHookHandler;
 use Wikibase\Settings;
 
 /**
- * @covers Wikibase\Hook\OutputPageJsConfigHookHandler
+ * @covers Wikibase\Repo\Hooks\OutputPageJsConfigHookHandler
  *
  * @since 0.5
  *

-- 
To view, visit https://gerrit.wikimedia.org/r/176661
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If9295f0996ac2aa791de4169b97d76e2d5e0923a
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: JanZerebecki <[email protected]>
Gerrit-Reviewer: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to