jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/400580 )
Change subject: Cleanup and unify class level PHPDoc blocks ...................................................................... Cleanup and unify class level PHPDoc blocks This unifies certain minor details of the coding style across this code base. This patch is pretty much exclusively about comments and should not have any effect on production. Change-Id: Ic96e60b85503a808f9c55a1efc663c95d413b1fc --- M NewsletterHooks.php M includes/Echo/BaseNewsletterPresentationModel.php M includes/Echo/EchoNewsletterPresentationModel.php M includes/Echo/EchoNewsletterPublisherAddedPresentationModel.php M includes/Echo/EchoNewsletterSubscribedPresentationModel.php M includes/Echo/EchoNewsletterUnsubscribedPresentationModel.php M includes/Echo/EchoNewsletterUserLocator.php M includes/Newsletter.php M includes/NewsletterValidator.php M includes/api/ApiNewsletterSubscribe.php M includes/content/NewsletterContent.php M includes/content/NewsletterContentHandler.php M includes/content/NewsletterDataUpdate.php M includes/content/NewsletterDiffEngine.php M includes/logging/NewsletterLogFormatter.php M includes/specials/SpecialNewsletter.php M includes/specials/SpecialNewsletterCreate.php M includes/specials/SpecialNewsletters.php M includes/specials/pagers/NewsletterTablePager.php M maintenance/deleteInactiveNewsletters.php M maintenance/updateSubscribersCount.php R tests/api/ApiNewsletterSubscribeTest.php M tests/specials/SpecialNewsletterCreateTest.php M tests/specials/SpecialNewslettersTest.php 24 files changed, 50 insertions(+), 20 deletions(-) Approvals: 01tonythomas: Looks good to me, approved jenkins-bot: Verified diff --git a/NewsletterHooks.php b/NewsletterHooks.php index de9205c..2e1112d 100644 --- a/NewsletterHooks.php +++ b/NewsletterHooks.php @@ -8,8 +8,8 @@ /** * Function to be called before EchoEvent * - * @param array &$notifications Echo notifications - * @param array &$notificationCategories Echo notification categories + * @param array[] &$notifications Echo notifications + * @param array[] &$notificationCategories Echo notification categories * @return bool */ public static function onBeforeCreateEchoEvent( &$notifications, &$notificationCategories ) { @@ -394,4 +394,5 @@ return true; } + } diff --git a/includes/Echo/BaseNewsletterPresentationModel.php b/includes/Echo/BaseNewsletterPresentationModel.php index 40f8da9..50f7ddd 100644 --- a/includes/Echo/BaseNewsletterPresentationModel.php +++ b/includes/Echo/BaseNewsletterPresentationModel.php @@ -1,6 +1,7 @@ <?php abstract class BaseNewsletterPresentationModel extends EchoEventPresentationModel { + public function canRender() { $nl = Newsletter::newFromID( $this->getNewsletterId() ); return (bool)$nl; @@ -27,4 +28,5 @@ } return $result; } + } diff --git a/includes/Echo/EchoNewsletterPresentationModel.php b/includes/Echo/EchoNewsletterPresentationModel.php index b7ed667..425f933 100644 --- a/includes/Echo/EchoNewsletterPresentationModel.php +++ b/includes/Echo/EchoNewsletterPresentationModel.php @@ -42,4 +42,5 @@ return $this->msg( 'notification-body-newsletter-announce' ) ->params( $this->event->getExtraParam( 'section-text' ) ); } + } diff --git a/includes/Echo/EchoNewsletterPublisherAddedPresentationModel.php b/includes/Echo/EchoNewsletterPublisherAddedPresentationModel.php index f20d5e5..1c83b5b 100644 --- a/includes/Echo/EchoNewsletterPublisherAddedPresentationModel.php +++ b/includes/Echo/EchoNewsletterPublisherAddedPresentationModel.php @@ -21,4 +21,5 @@ $msg->params( $agentGenderName ); return $msg; } + } diff --git a/includes/Echo/EchoNewsletterSubscribedPresentationModel.php b/includes/Echo/EchoNewsletterSubscribedPresentationModel.php index 3a9ff32..9a2cf7d 100644 --- a/includes/Echo/EchoNewsletterSubscribedPresentationModel.php +++ b/includes/Echo/EchoNewsletterSubscribedPresentationModel.php @@ -20,4 +20,5 @@ $msg->params( $this->getNewsletterName() ); return $msg; } + } diff --git a/includes/Echo/EchoNewsletterUnsubscribedPresentationModel.php b/includes/Echo/EchoNewsletterUnsubscribedPresentationModel.php index b050aa5..c50c880 100644 --- a/includes/Echo/EchoNewsletterUnsubscribedPresentationModel.php +++ b/includes/Echo/EchoNewsletterUnsubscribedPresentationModel.php @@ -20,4 +20,5 @@ $msg->params( $this->getNewsletterName() ); return $msg; } + } diff --git a/includes/Echo/EchoNewsletterUserLocator.php b/includes/Echo/EchoNewsletterUserLocator.php index f674bc7..023ca47 100644 --- a/includes/Echo/EchoNewsletterUserLocator.php +++ b/includes/Echo/EchoNewsletterUserLocator.php @@ -1,6 +1,7 @@ <?php class EchoNewsletterUserLocator { + /** * Locate all users subscribed to a newsletter. * @@ -16,4 +17,5 @@ return UserArray::newFromIDs( $newsletter->getSubscribers() ); } + } diff --git a/includes/Newsletter.php b/includes/Newsletter.php index 46a5753..5fbf290 100644 --- a/includes/Newsletter.php +++ b/includes/Newsletter.php @@ -8,6 +8,7 @@ * @author Glaisher */ class Newsletter { + const NEWSLETTER_PUBLISHERS_ADDED = 'added'; const NEWSLETTER_PUBLISHERS_REMOVED = 'removed'; @@ -277,4 +278,5 @@ } EchoEvent::create( $notification ); } + } diff --git a/includes/NewsletterValidator.php b/includes/NewsletterValidator.php index 5ff5f51..96c238c 100644 --- a/includes/NewsletterValidator.php +++ b/includes/NewsletterValidator.php @@ -1,8 +1,8 @@ <?php + /** * Handles validation for newsletters */ - class NewsletterValidator { private static $requiredDataOnCreate = [ @@ -17,8 +17,6 @@ ]; /** - * Constructor. - * * @param array $fields */ public function __construct( array $fields ) { @@ -69,4 +67,5 @@ return Status::newGood(); } + } diff --git a/includes/api/ApiNewsletterSubscribe.php b/includes/api/ApiNewsletterSubscribe.php index 0545165..b361e7e 100644 --- a/includes/api/ApiNewsletterSubscribe.php +++ b/includes/api/ApiNewsletterSubscribe.php @@ -1,4 +1,5 @@ <?php + /** * @license GNU GPL v2+ * @author Glaisher @@ -77,4 +78,5 @@ public function mustBePosted() { return true; } + } diff --git a/includes/content/NewsletterContent.php b/includes/content/NewsletterContent.php index 831b337..a3920af 100644 --- a/includes/content/NewsletterContent.php +++ b/includes/content/NewsletterContent.php @@ -1,12 +1,13 @@ <?php + +use MediaWiki\MediaWikiServices; + /** * @license GNU GPL v2+ * @author tonythomas */ - -use MediaWiki\MediaWikiServices; - class NewsletterContent extends JsonContent { + /** Subpage actions */ const NEWSLETTER_ANNOUNCE = 'announce'; const NEWSLETTER_MANAGE = 'manage'; @@ -497,4 +498,5 @@ [ $mwUpdate ] ); } + } diff --git a/includes/content/NewsletterContentHandler.php b/includes/content/NewsletterContentHandler.php index bc12b2f..ee08be3 100644 --- a/includes/content/NewsletterContentHandler.php +++ b/includes/content/NewsletterContentHandler.php @@ -1,10 +1,11 @@ <?php + /** * @license GNU GPL v2+ * @author tonythomas */ - class NewsletterContentHandler extends JsonContentHandler { + /** * @param string $modelId */ @@ -96,4 +97,5 @@ protected function getDiffEngineClass() { return 'NewsletterDiffEngine'; } + } diff --git a/includes/content/NewsletterDataUpdate.php b/includes/content/NewsletterDataUpdate.php index 76a61ee..e916cd9 100644 --- a/includes/content/NewsletterDataUpdate.php +++ b/includes/content/NewsletterDataUpdate.php @@ -1,10 +1,11 @@ <?php + +use MediaWiki\Logger\LoggerFactory; + /** * @license GNU GPL v2+ * @author tonythomas */ -use \MediaWiki\Logger\LoggerFactory; - class NewsletterDataUpdate extends DataUpdate { private $content; /** NewsletterContent */ @@ -145,4 +146,5 @@ ); } } + } diff --git a/includes/content/NewsletterDiffEngine.php b/includes/content/NewsletterDiffEngine.php index c3f54bc..e5bf468 100644 --- a/includes/content/NewsletterDiffEngine.php +++ b/includes/content/NewsletterDiffEngine.php @@ -1,6 +1,7 @@ <?php class NewsletterDiffEngine extends DifferenceEngine { + public function generateContentDiffBody( Content $old, Content $new ) { if ( !( $old instanceof NewsletterContent ) || !( $new instanceof NewsletterContent ) ) { @@ -61,4 +62,5 @@ return $output; } + } diff --git a/includes/logging/NewsletterLogFormatter.php b/includes/logging/NewsletterLogFormatter.php index 4025f07..46b2cc8 100644 --- a/includes/logging/NewsletterLogFormatter.php +++ b/includes/logging/NewsletterLogFormatter.php @@ -6,8 +6,8 @@ * @license GNU GPL v2+ * @author Tyler Romeo */ - class NewsletterLogFormatter extends LogFormatter { + /** * Reformat the target as a user link if the target was a user * @return array @@ -59,4 +59,5 @@ return "[[{$title->getPrefixedText()}|$name]]"; } } + } diff --git a/includes/specials/SpecialNewsletter.php b/includes/specials/SpecialNewsletter.php index 23d1795..5ebeace 100644 --- a/includes/specials/SpecialNewsletter.php +++ b/includes/specials/SpecialNewsletter.php @@ -1,4 +1,5 @@ <?php + /** * Special page to handle actions related to specific newsletters * diff --git a/includes/specials/SpecialNewsletterCreate.php b/includes/specials/SpecialNewsletterCreate.php index e025cff..ae718a6 100644 --- a/includes/specials/SpecialNewsletterCreate.php +++ b/includes/specials/SpecialNewsletterCreate.php @@ -171,4 +171,5 @@ protected function getDisplayFormat() { return 'ooui'; } + } diff --git a/includes/specials/SpecialNewsletters.php b/includes/specials/SpecialNewsletters.php index 07bbe96..524cd13 100644 --- a/includes/specials/SpecialNewsletters.php +++ b/includes/specials/SpecialNewsletters.php @@ -1,4 +1,5 @@ <?php + /** * Implements Special:Newsletter which lists all the newsletters on the wiki. * Logged-in users can also filter by subscribed/unsubscribed newsletters and @@ -8,6 +9,7 @@ * @author Tina Johnson */ class SpecialNewsletters extends SpecialPage { + /** * @var string $option Filter option for the table - doesn't affect anons */ @@ -98,4 +100,5 @@ ], ]; } + } diff --git a/includes/specials/pagers/NewsletterTablePager.php b/includes/specials/pagers/NewsletterTablePager.php index d623a6e..b1ba525 100644 --- a/includes/specials/pagers/NewsletterTablePager.php +++ b/includes/specials/pagers/NewsletterTablePager.php @@ -1,14 +1,13 @@ <?php +use MediaWiki\MediaWikiServices; + /** * @license GNU GPL v2+ * @author Tina Johnson * @author Brian Wolff <bawolff...@gmail.com> * @author Tony Thomas <01tonytho...@gmail.com> */ - -use MediaWiki\MediaWikiServices; - class NewsletterTablePager extends TablePager { /** Added to offset for sorting reasons */ @@ -62,7 +61,7 @@ * done as part of a union to avoid expensive filesort. * * @param string $offset The indexpager offset (Number of subscribers) - * @param int $limit The limit + * @param int $limit * @param bool $descending Ascending or descending? * @param string $secondaryOffset For tiebreaking the order (nl_name) */ @@ -115,7 +114,7 @@ * done as part of a union to avoid expensive filesort. * * @param string $offset The indexpager offset (Number of subscribers) - * @param int $limit The limit + * @param int $limit * @param bool $descending Ascending or descending? * @param string $secondaryOffset For tiebreaking the order (nl_name) */ diff --git a/maintenance/deleteInactiveNewsletters.php b/maintenance/deleteInactiveNewsletters.php index 0902ae7..e013093 100644 --- a/maintenance/deleteInactiveNewsletters.php +++ b/maintenance/deleteInactiveNewsletters.php @@ -81,6 +81,7 @@ $this->output( "Done!\n" ); } + } $maintClass = "DeleteInactiveNewsletters"; diff --git a/maintenance/updateSubscribersCount.php b/maintenance/updateSubscribersCount.php index d1ede7d..679a4be 100644 --- a/maintenance/updateSubscribersCount.php +++ b/maintenance/updateSubscribersCount.php @@ -1,4 +1,5 @@ <?php + $basePath = getenv( 'MW_INSTALL_PATH' ) !== false ? getenv( 'MW_INSTALL_PATH' ) : __DIR__ . '/../../..'; @@ -8,6 +9,7 @@ public function __construct() { parent::__construct(); + $this->addDescription( "Regenerate nl_subscribers_count in nl_newsletters from nl_subscriptions table" ); $this->requireExtension( 'Newsletter' ); @@ -49,6 +51,7 @@ $this->output( "Done!\n" ); } + } $maintClass = "updateSubscribersCount"; diff --git a/tests/api/ApiNewsletterTest.php b/tests/api/ApiNewsletterSubscribeTest.php similarity index 95% rename from tests/api/ApiNewsletterTest.php rename to tests/api/ApiNewsletterSubscribeTest.php index 3c58c91..053c6a4 100644 --- a/tests/api/ApiNewsletterTest.php +++ b/tests/api/ApiNewsletterSubscribeTest.php @@ -1,8 +1,6 @@ <?php /** - * Unit test to test Api module - ApiNewsletter - * * @group API * @group medium * @group Database @@ -11,7 +9,7 @@ * * @author Tina Johnson */ -class ApiNewsletterTest extends ApiTestCase { +class ApiNewsletterSubscribeTest extends ApiTestCase { public function __construct( $name = null, array $data = [], $dataName = '' ) { parent::__construct( $name, $data, $dataName ); diff --git a/tests/specials/SpecialNewsletterCreateTest.php b/tests/specials/SpecialNewsletterCreateTest.php index ee8bb40..26da147 100644 --- a/tests/specials/SpecialNewsletterCreateTest.php +++ b/tests/specials/SpecialNewsletterCreateTest.php @@ -46,6 +46,7 @@ $store->getNewsletterFromName( 'Test Newsletter' ) ); } + public function testCreateNewsletterMainPageAlreadyUsed() { // Create 1st newsletter with conflicting main page $mainpage = Title::newFromText( 'UTPage' ); @@ -104,4 +105,5 @@ $store->getNewsletter( $firstNewsletter->getID() + 1 ) ); } + } diff --git a/tests/specials/SpecialNewslettersTest.php b/tests/specials/SpecialNewslettersTest.php index 3f6353b..bc6162f 100644 --- a/tests/specials/SpecialNewslettersTest.php +++ b/tests/specials/SpecialNewslettersTest.php @@ -20,4 +20,5 @@ $this->executeSpecialPage( '', $req, null, $user->getUser() ); $this->assertTrue( true ); } + } -- To view, visit https://gerrit.wikimedia.org/r/400580 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic96e60b85503a808f9c55a1efc663c95d413b1fc Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Newsletter Gerrit-Branch: master Gerrit-Owner: Thiemo Kreuz (WMDE) <thiemo.kr...@wikimedia.de> Gerrit-Reviewer: 01tonythomas <01tonytho...@gmail.com> Gerrit-Reviewer: Addshore <addshorew...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits