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

Change subject: Narrow $context interface to IContextSource in 
EditEntity(Factory)
......................................................................


Narrow $context interface to IContextSource in EditEntity(Factory)

Change-Id: Iaf2a310fad9fd52368106d31b967d657a5b8b1f5
---
M repo/includes/EditEntity.php
M repo/includes/EditEntityFactory.php
2 files changed, 8 insertions(+), 17 deletions(-)

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



diff --git a/repo/includes/EditEntity.php b/repo/includes/EditEntity.php
index a061c92..bbd8394 100644
--- a/repo/includes/EditEntity.php
+++ b/repo/includes/EditEntity.php
@@ -2,8 +2,8 @@
 
 namespace Wikibase;
 
-use DerivativeContext;
 use Html;
+use IContextSource;
 use InvalidArgumentException;
 use MWException;
 use ReadOnlyError;
@@ -93,7 +93,7 @@
        private $title = null;
 
        /**
-        * @var RequestContext|DerivativeContext
+        * @var IContextSource
         */
        private $context;
 
@@ -170,7 +170,7 @@
         *        This will detect "late" edit conflicts, i.e. someone 
squeezing in an edit
         *        just before the actual database transaction for saving beings.
         *        The empty string and 0 are both treated as `false`, disabling 
conflict checks.
-        * @param RequestContext|DerivativeContext|null $context the context to 
use while processing
+        * @param IContextSource|null $context the context to use while 
processing
         *        the edit; defaults to RequestContext::getMain().
         *
         * @throws InvalidArgumentException
@@ -184,7 +184,7 @@
                User $user,
                EditFilterHookRunner $editFilterHookRunner,
                $baseRevId = false,
-               $context = null
+               IContextSource $context = null
        ) {
                $this->newEntity = $newEntity;
 
@@ -201,14 +201,6 @@
 
                $this->errorType = 0;
                $this->status = Status::newGood();
-
-               if ( $context !== null
-                       && !( $context instanceof RequestContext )
-                       && !( $context instanceof DerivativeContext )
-               ) {
-                       throw new InvalidArgumentException( '$context must be 
an instance of RequestContext'
-                                . ' or DerivativeContext' );
-               }
 
                if ( $context === null ) {
                        $context = RequestContext::getMain();
diff --git a/repo/includes/EditEntityFactory.php 
b/repo/includes/EditEntityFactory.php
index cd58259..cc4bc59 100644
--- a/repo/includes/EditEntityFactory.php
+++ b/repo/includes/EditEntityFactory.php
@@ -2,8 +2,7 @@
 
 namespace Wikibase;
 
-use DerivativeContext;
-use RequestContext;
+use IContextSource;
 use User;
 use Wikibase\DataModel\Entity\Entity;
 use Wikibase\Lib\Store\EntityRevisionLookup;
@@ -46,7 +45,7 @@
        private $editFilterHookRunner;
 
        /**
-        * @var RequestContext|DerivativeContext|null
+        * @var IContextSource|null
         */
        private $context;
 
@@ -56,7 +55,7 @@
         * @param EntityStore $entityStore
         * @param EntityPermissionChecker $permissionChecker
         * @param EditFilterHookRunner $editFilterHookRunner
-        * @param RequestContext|DerivativeContext|null $context
+        * @param IContextSource|null $context
         */
        public function __construct(
                EntityTitleLookup $titleLookup,
@@ -64,7 +63,7 @@
                EntityStore $entityStore,
                EntityPermissionChecker $permissionChecker,
                EditFilterHookRunner $editFilterHookRunner,
-               $context = null
+               IContextSource $context = null
        ) {
                $this->titleLookup = $titleLookup;
                $this->entityRevisionLookup = $entityLookup;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iaf2a310fad9fd52368106d31b967d657a5b8b1f5
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to