jenkins-bot has submitted this change and it was merged.
Change subject: Hygiene: Fix undefined fields
......................................................................
Hygiene: Fix undefined fields
... and some minor namespace/doc improvements
Change-Id: I5859a9fabf81171e0165788a626c607eab566d10
---
M Hooks.php
M includes/Formatter/RevisionFormatter.php
M includes/Formatter/TopicListQuery.php
M includes/Model/AbstractSummary.php
M includes/api/ApiFlow.php
M includes/api/ApiParsoidUtilsFlow.php
M maintenance/FlowInsertDefaultDefinitions.php
M tests/LinksTableTest.php
M tests/PostRevisionTestCase.php
9 files changed, 69 insertions(+), 12 deletions(-)
Approvals:
Jdlrobson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/Hooks.php b/Hooks.php
index 9fff17e..76a2339 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -2,6 +2,7 @@
use Flow\Container;
use Flow\Exception\FlowException;
+use Flow\Formatter\CheckUserQuery;
use Flow\Model\UUID;
use Flow\NotificationController;
use Flow\OccupationController;
@@ -229,6 +230,7 @@
$replacement = null;
try {
+ /** @var CheckUserQuery $query */
$query = Container::get( 'query.checkuser' );
// @todo: create hook to allow batch-loading this data,
instead of doing piecemeal like this
$query->loadMetadataBatch( array( $row ) );
@@ -604,7 +606,7 @@
$change = $params['flow-workflow-change'];
// don't forget to increase the version number when data format
changes
- $comment = \Flow\Formatter\CheckUserQuery::VERSION_PREFIX;
+ $comment = CheckUserQuery::VERSION_PREFIX;
$comment .= ',' . $change['action'];
$comment .= ',' . $change['workflow'];
$comment .= ',' . $change['revision'];
diff --git a/includes/Formatter/RevisionFormatter.php
b/includes/Formatter/RevisionFormatter.php
index ef9546c..6fc9469 100644
--- a/includes/Formatter/RevisionFormatter.php
+++ b/includes/Formatter/RevisionFormatter.php
@@ -52,13 +52,30 @@
*/
protected $urlGenerator;
+ /**
+ * @var bool
+ */
protected $includeProperties = false;
+ /**
+ * @var string[]
+ */
protected $allowedContentFormats = array( 'html', 'wikitext' );
+ /**
+ * @var string
+ */
protected $contentFormat = 'html';
+ /**
+ * @var int
+ */
protected $maxThreadingDepth;
+
+ /**
+ * @var Message[]
+ */
+ protected $messages = array();
/**
* @param RevisionActionPermissions $permissions
@@ -741,7 +758,7 @@
return wfMessage( $key, $params );
}
if ( !isset( $this->messages[$key] ) ) {
- $this->messages[$key] = new \Message( $key );
+ $this->messages[$key] = new Message( $key );
}
return $this->messages[$key];
}
diff --git a/includes/Formatter/TopicListQuery.php
b/includes/Formatter/TopicListQuery.php
index 1c46c4c..1a7ff6d 100644
--- a/includes/Formatter/TopicListQuery.php
+++ b/includes/Formatter/TopicListQuery.php
@@ -10,6 +10,7 @@
use Flow\Model\UUID;
use Flow\Repository\TreeRepository;
use Flow\RevisionActionPermissions;
+use User;
class TopicListQuery extends AbstractQuery {
@@ -178,7 +179,7 @@
* @param UUID[] $missing
*/
protected function createFakePosts( array $missing ) {
- $parents = $this->treeRepo->fetchParentMap( $missing );
+ $parents = $this->treeRepository->fetchParentMap( $missing );
$posts = array();
foreach ( $missing as $uuid ) {
$alpha = $uuid->getAlphadecimal();
@@ -188,7 +189,7 @@
}
$content = wfMessage( 'flow-stub-post-content'
)->text();
$username = wfMessage( 'flow-system-usertext' )->text();
- $user = \User::newFromName( $username );
+ $user = User::newFromName( $username );
// create a stub post instead of failing completely
$post = PostRevision::newFromId( $uuid, $user, $content
);
diff --git a/includes/Model/AbstractSummary.php
b/includes/Model/AbstractSummary.php
index e1d6743..ad12d64 100644
--- a/includes/Model/AbstractSummary.php
+++ b/includes/Model/AbstractSummary.php
@@ -15,6 +15,7 @@
protected $summaryTargetId;
static public function fromStorageRow( array $row, $obj = null ) {
+ /** @var $obj AbstractSummary */
$obj = parent::fromStorageRow( $row, $obj );
$obj->summaryTargetId = UUID::create( $row['rev_type_id'] );
return $obj;
diff --git a/includes/api/ApiFlow.php b/includes/api/ApiFlow.php
index d80eb6d..e573847 100644
--- a/includes/api/ApiFlow.php
+++ b/includes/api/ApiFlow.php
@@ -1,7 +1,8 @@
<?php
-use \Flow\Container;
+use Flow\Container;
use Flow\Model\UUID;
+use Flow\Templating;
class ApiFlow extends ApiBase {
@@ -116,7 +117,8 @@
* @todo figure out if this is still needed
*/
protected function doRerender( $blocks ) {
- $templating = $this->container['templating'];
+ /** @var Templating $templating */
+ $templating = Container::get( 'templating' );
$output = array();
diff --git a/includes/api/ApiParsoidUtilsFlow.php
b/includes/api/ApiParsoidUtilsFlow.php
index 364c33a..81f6f00 100644
--- a/includes/api/ApiParsoidUtilsFlow.php
+++ b/includes/api/ApiParsoidUtilsFlow.php
@@ -1,5 +1,7 @@
<?php
+use Flow\Container;
+use Flow\Parsoid\Controller;
use Flow\Parsoid\Utils;
use Flow\Exception\WikitextException;
@@ -17,7 +19,8 @@
}
if ( $params['to'] === 'html' ) {
- $contentFixer = \Flow\Container::get( 'content_fixer' );
+ /** @var Controller $contentFixer */
+ $contentFixer = Container::get( 'content_fixer' );
$content = $contentFixer->apply( $content,
$page->getTitle() );
}
diff --git a/maintenance/FlowInsertDefaultDefinitions.php
b/maintenance/FlowInsertDefaultDefinitions.php
index 06ac518..13a321f 100644
--- a/maintenance/FlowInsertDefaultDefinitions.php
+++ b/maintenance/FlowInsertDefaultDefinitions.php
@@ -16,6 +16,7 @@
protected function doDBUpdates() {
$container = Container::getContainer();
+ /** @var \DatabaseBase $dbw */
$dbw = $container['db.factory']->getDB( DB_MASTER );
$res = $dbw->select(
diff --git a/tests/LinksTableTest.php b/tests/LinksTableTest.php
index 61480c4..e0c7871 100644
--- a/tests/LinksTableTest.php
+++ b/tests/LinksTableTest.php
@@ -3,10 +3,17 @@
namespace Flow\Tests;
use Flow\Container;
+use Flow\Data\ManagerGroup;
+use Flow\Data\ReferenceRecorder;
use Flow\Exception\WikitextException;
+use Flow\LinksTableUpdater;
use Flow\Model\AbstractRevision;
use Flow\Model\UUID;
use Flow\Model\Workflow;
+use Flow\Parsoid\ReferenceExtractor;
+use Flow\Parsoid\Utils;
+use LinksUpdate;
+use ParserOutput;
use Title;
use User;
@@ -15,6 +22,25 @@
* @group Database
*/
class LinksTableTest extends PostRevisionTestCase {
+ /**
+ * @var ManagerGroup
+ */
+ protected $storage;
+
+ /**
+ * @var ReferenceExtractor
+ */
+ protected $extractor;
+
+ /**
+ * @var ReferenceRecorder
+ */
+ protected $recorder;
+
+ /**
+ * @var LinksTableUpdater
+ */
+ protected $updater;
public function setUp() {
parent::setUp();
@@ -25,7 +51,7 @@
// Check for Parsoid
try {
- \Flow\Parsoid\Utils::convert( 'html', 'wikitext',
'Foo', self::getTestTitle() );
+ Utils::convert( 'html', 'wikitext', 'Foo',
self::getTestTitle() );
} catch ( WikitextException $excep ) {
$this->markTestSkipped( 'Parsoid not enabled' );
}
@@ -141,7 +167,7 @@
* @dataProvider provideGetReferencesFromRevisionContent
*/
public function testGetReferencesFromRevisionContent( $content,
$expectedReferences ) {
- $content = \Flow\Parsoid\Utils::convert( 'wikitext', 'html',
$content, self::getTestTitle() );
+ $content = Utils::convert( 'wikitext', 'html', $content,
self::getTestTitle() );
$revision = $this->generateTopic( array( 'rev_content' =>
$content ) );
$workflow = self::getTestWorkflow( self::getTestTitle() );
@@ -321,8 +347,8 @@
public function testMutateLinksUpdate( $references, $expectedItems ) {
extract( $this->getBlandTestObjects() );
$references = $this->expandReferences( $workflow, $revision,
$references );
- $parserOutput = new \ParserOutput;
- $linksUpdate = new \LinksUpdate( self::getTestTitle(),
$parserOutput );
+ $parserOutput = new ParserOutput;
+ $linksUpdate = new LinksUpdate( self::getTestTitle(),
$parserOutput );
// Clear the LinksUpdate to allow clean testing
foreach( array_keys( $expectedItems ) as $fieldName ) {
diff --git a/tests/PostRevisionTestCase.php b/tests/PostRevisionTestCase.php
index 2247e93..97570c2 100644
--- a/tests/PostRevisionTestCase.php
+++ b/tests/PostRevisionTestCase.php
@@ -11,13 +11,17 @@
use Flow\Model\UUID;
use User;
-
/**
* @group Flow
* @group Database
*/
class PostRevisionTestCase extends FlowTestCase {
/**
+ * @var PostRevision
+ */
+ protected $revision;
+
+ /**
* @var PostRevision[]
*/
protected $revisions = array();
--
To view, visit https://gerrit.wikimedia.org/r/140967
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5859a9fabf81171e0165788a626c607eab566d10
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: frontend-rewrite
Gerrit-Owner: Matthias Mullie <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits