jenkins-bot has submitted this change and it was merged.
Change subject: Test for MutableContext in EditFilterHookRunner constructor
......................................................................
Test for MutableContext in EditFilterHookRunner constructor
This is a direct follow-up to the comments in I3e82e8f.
The only difference this patch makes is the stack trace. Instead of
triggering the warning on runtime (and possibly multiple times) it is
now triggered on object creation.
Change-Id: I566cf24cb1ed7fe721a744acc0d2121d39d82a1e
---
M repo/includes/Hooks/EditFilterHookRunner.php
1 file changed, 7 insertions(+), 7 deletions(-)
Approvals:
Hoo man: Looks good to me, approved
jenkins-bot: Verified
diff --git a/repo/includes/Hooks/EditFilterHookRunner.php
b/repo/includes/Hooks/EditFilterHookRunner.php
index 1de1a6d..8e199e5 100644
--- a/repo/includes/Hooks/EditFilterHookRunner.php
+++ b/repo/includes/Hooks/EditFilterHookRunner.php
@@ -38,7 +38,7 @@
private $entityContentFactory;
/**
- * @var IContextSource
+ * @var MutableContext
*/
private $context;
@@ -52,6 +52,12 @@
EntityContentFactory $entityContentFactory,
IContextSource $context
) {
+ if ( !( $context instanceof MutableContext ) ) {
+ wfLogWarning( '$context is not an instanceof
MutableContext.' );
+
+ $context = new DerivativeContext( $context );
+ }
+
$this->titleLookup = $titleLookup;
$this->entityContentFactory = $entityContentFactory;
$this->context = $context;
@@ -131,12 +137,6 @@
// namespace IDs for Property entities.
$namespace = $this->titleLookup->getNamespaceForType(
$entityType );
$title = Title::makeTitle( $namespace, 'New' . ucfirst(
$entityType ) );
- }
-
- if ( !( $context instanceof MutableContext ) ) {
- wfLogWarning( '$context is not an instanceof
MutableContext.' );
-
- $context = new DerivativeContext( $context );
}
$context->setTitle( $title );
--
To view, visit https://gerrit.wikimedia.org/r/263823
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I566cf24cb1ed7fe721a744acc0d2121d39d82a1e
Gerrit-PatchSet: 3
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: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits