jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/391225 )

Change subject: Fix minor type violation in LexemeHandler "history" action 
override
......................................................................


Fix minor type violation in LexemeHandler "history" action override

We know this does not make a difference because there are only two
classes implementing the Page interface. But the code does not know.
I get a warning that Article::newFromWikiPage can only be called with
a WikiPage, which is true and what the if() above should check for.

See I55edb34 as well as Icf6055f for reference.

Change-Id: I888e24b91c50d7f926090b7839fae39af6e5caad
---
M src/Content/LexemeHandler.php
1 file changed, 5 insertions(+), 4 deletions(-)

Approvals:
  Daniel Kinzler: Looks good to me, approved
  WMDE-leszek: Looks good to me, but someone else must approve
  jenkins-bot: Verified
  Thiemo Mättig (WMDE): Looks good to me, approved



diff --git a/src/Content/LexemeHandler.php b/src/Content/LexemeHandler.php
index 164f290..e4133b2 100644
--- a/src/Content/LexemeHandler.php
+++ b/src/Content/LexemeHandler.php
@@ -21,6 +21,7 @@
 use Wikibase\Store\EntityIdLookup;
 use Wikibase\SubmitEntityAction;
 use Wikibase\TermIndex;
+use WikiPage;
 
 /**
  * @license GPL-2.0+
@@ -80,15 +81,15 @@
         */
        public function getActionOverrides() {
                return [
-                       'history' => function( Page $page, IContextSource 
$context ) {
+                       'history' => function( Page $article, IContextSource 
$context ) {
                                // NOTE: for now, the callback must work with a 
WikiPage as well as an Article
                                // object. Once I0335100b2 is merged, this is 
no longer needed.
-                               if ( !( $page instanceof Article ) ) {
-                                       $page = Article::newFromWikiPage( 
$page, $context );
+                               if ( $article instanceof WikiPage ) {
+                                       $article = Article::newFromWikiPage( 
$article, $context );
                                }
 
                                return new HistoryEntityAction(
-                                       $page,
+                                       $article,
                                        $context,
                                        $this->entityIdLookup,
                                        
$this->labelLookupFactory->newLabelDescriptionLookup( $context->getLanguage() )

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I888e24b91c50d7f926090b7839fae39af6e5caad
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/WikibaseLexeme
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.kr...@wikimedia.de>
Gerrit-Reviewer: Daniel Kinzler <daniel.kinz...@wikimedia.de>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <thiemo.kr...@wikimedia.de>
Gerrit-Reviewer: WMDE-leszek <leszek.mani...@wikimedia.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to