diff --git a/includes/AFComputedVariable.php b/includes/AFComputedVariable.php index 1faead11b..b795d531c 100644 --- a/includes/AFComputedVariable.php +++ b/includes/AFComputedVariable.php @@ -92,7 +92,7 @@ class AFComputedVariable { /** * @param int $namespace - * @param Title $title + * @param string $title * @return Article */ public static function articleFromTitle( $namespace, $title ) { @@ -119,7 +119,7 @@ class AFComputedVariable { * @return array */ public static function getLinksFromDB( $article ) { - // Stolen from ConfirmEdit + // Stolen from ConfirmEdit, SimpleCaptcha::getLinksFromTracker $id = $article->getId(); if ( !$id ) { return []; diff --git a/includes/AbuseFilter.php b/includes/AbuseFilter.php index fcd64e7a5..96178dee0 100644 --- a/includes/AbuseFilter.php +++ b/includes/AbuseFilter.php @@ -918,7 +918,7 @@ class AbuseFilter { $global_filter = self::decodeGlobalName( $filter ) !== false; - // If the filter is throttled and throttling is available via object + // If the filter has "throttle" enabled and throttling is available via object // caching, check to see if the user has hit the throttle. if ( !empty( $actions['throttle'] ) && $wgMainCacheType !== CACHE_NONE ) { $parameters = $actions['throttle']['parameters']; @@ -2749,7 +2749,7 @@ class AbuseFilter { } /** - * @param Title $title + * @param Title|null $title * @param Page|null $page * @return AbuseFilterVariableHolder */ @@ -3004,7 +3004,7 @@ class AbuseFilter { * Note also that if the revision for any reason is not an Revision * the function returns with an empty string. * - * @param Revision $revision a valid revision + * @param Revision|null $revision a valid revision * @param int $audience one of: * Revision::FOR_PUBLIC to be displayed to all users * Revision::FOR_THIS_USER to be displayed to the given user diff --git a/includes/AbuseFilterHooks.php b/includes/AbuseFilterHooks.php index 61c8a398a..97d84dd2c 100644 --- a/includes/AbuseFilterHooks.php +++ b/includes/AbuseFilterHooks.php @@ -9,7 +9,7 @@ class AbuseFilterHooks { /** @var AbuseFilterVariableHolder|bool */ public static $successful_action_vars = false; - /** @var WikiPage|Article|bool Make sure edit filter & edit save hooks match */ + /** @var WikiPage|Article|bool|null Make sure edit filter & edit save hooks match */ public static $last_edit_page = false; // So far, all of the error message out-params for these hooks accept HTML. diff --git a/includes/Views/AbuseFilterViewEdit.php b/includes/Views/AbuseFilterViewEdit.php index 2d03530f0..6627edf11 100644 --- a/includes/Views/AbuseFilterViewEdit.php +++ b/includes/Views/AbuseFilterViewEdit.php @@ -130,7 +130,7 @@ class AbuseFilterViewEdit extends AbuseFilterView { * Builds the full form for edit filters. * Loads data either from the database or from the HTTP request. * The request takes precedence over the database - * @param string $error An error message to show above the filter box. + * @param string|null $error An error message to show above the filter box. * @param int $filter The filter ID * @param int|null $history_id The history ID of the filter, if applicable. Otherwise null * @return bool|string False if there is a failure building the editor, @@ -493,7 +493,7 @@ class AbuseFilterViewEdit extends AbuseFilterView { * @param bool $set Whether or not the action is activated * @param array $parameters Action parameters * @param stdClass $row abuse_filter row object - * @return string + * @return string|\OOUI\FieldLayout */ public function buildConsequenceSelector( $action, $set, $parameters, $row ) { $config = $this->getConfig(); @@ -893,7 +893,7 @@ class AbuseFilterViewEdit extends AbuseFilterView { /** * @param string $warnMsg * @param bool $readOnly - * @return string + * @return \OOUI\FieldLayout */ public function getExistingSelector( $warnMsg, $readOnly = false ) { $existingSelector = diff --git a/includes/Views/AbuseFilterViewTestBatch.php b/includes/Views/AbuseFilterViewTestBatch.php index ee4619096..168933ec2 100644 --- a/includes/Views/AbuseFilterViewTestBatch.php +++ b/includes/Views/AbuseFilterViewTestBatch.php @@ -121,7 +121,7 @@ class AbuseFilterViewTestBatch extends AbuseFilterView { } /** - * @fixme this is similar to AbuseFilterExaminePager::getQueryInfo + * Loads the revisions and checks the given syntax against them */ public function doTest() { // Quick syntax check. diff --git a/includes/pagers/AbuseFilterExaminePager.php b/includes/pagers/AbuseFilterExaminePager.php index cc009a64d..287578022 100644 --- a/includes/pagers/AbuseFilterExaminePager.php +++ b/includes/pagers/AbuseFilterExaminePager.php @@ -14,7 +14,6 @@ class AbuseFilterExaminePager extends ReverseChronologicalPager { } /** - * @fixme this is similar to AbuseFilterViewTestBatch::doTest * @return array */ public function getQueryInfo() { diff --git a/includes/pagers/AbuseFilterHistoryPager.php b/includes/pagers/AbuseFilterHistoryPager.php index 9d4fd30ca..265c97f1a 100644 --- a/includes/pagers/AbuseFilterHistoryPager.php +++ b/includes/pagers/AbuseFilterHistoryPager.php @@ -1,5 +1,7 @@ mFilter = $filter; diff --git a/includes/parser/AFPToken.php b/includes/parser/AFPToken.php index c6c7d72ef..897f5ded4 100644 --- a/includes/parser/AFPToken.php +++ b/includes/parser/AFPToken.php @@ -54,7 +54,7 @@ class AFPToken { /** * @param string $type - * @param AFPToken|null $value + * @param mixed|null $value * @param int $pos */ public function __construct( $type = self::TNONE, $value = null, $pos = 0 ) { diff --git a/includes/parser/AbuseFilterParser.php b/includes/parser/AbuseFilterParser.php index d08ddf8da..3edf8fa5d 100644 --- a/includes/parser/AbuseFilterParser.php +++ b/includes/parser/AbuseFilterParser.php @@ -4,7 +4,9 @@ use Wikimedia\Equivset\Equivset; use MediaWiki\Logger\LoggerFactory; class AbuseFilterParser { - public $mCode, $mTokens, $mPos, $mCur, $mShortCircuit, $mAllowShort, $mLen; + public $mCode, $mTokens, $mPos, $mShortCircuit, $mAllowShort, $mLen; + /** @var AFPToken The current token */ + public $mCur; /** * @var AbuseFilterVariableHolder @@ -428,7 +430,7 @@ class AbuseFilterParser { $this->move(); $r2 = new AFPData(); - // We can go on quickly as either one statement with | is true or on with & is false + // We can go on quickly as either one statement with | is true or one with & is false if ( ( $op == '&' && !$result->toBool() ) || ( $op == '|' && $result->toBool() ) ) { $orig = $this->mShortCircuit; $this->mShortCircuit = $this->mAllowShort; @@ -1014,7 +1016,6 @@ class AbuseFilterParser { // Suppress and restore needed per T177744 Wikimedia\suppressWarnings(); - $count = preg_match_all( $needle, $haystack ); Wikimedia\restoreWarnings(); @@ -1079,7 +1080,7 @@ class AbuseFilterParser { // Returned array has non-empty positions identical to the ones returned // by the third parameter of a standard preg_match call ($matches in this case). - // We want an union with falsy to return a fixed-dimention array. + // We want an union with falsy to return a fixed-dimension array. return AFPData::newFromPHPVar( $matches + $falsy ); } diff --git a/includes/special/SpecialAbuseLog.php b/includes/special/SpecialAbuseLog.php index 496fc69f0..259fd067e 100644 --- a/includes/special/SpecialAbuseLog.php +++ b/includes/special/SpecialAbuseLog.php @@ -614,7 +614,7 @@ class SpecialAbuseLog extends SpecialPage { /** * @param string $id - * @return null + * @return void */ public function showPrivateDetails( $id ) { $lang = $this->getLanguage(); @@ -642,7 +642,7 @@ class SpecialAbuseLog extends SpecialPage { if ( !$this->checkReason( $reason ) ) { $out->addWikiMsg( 'abusefilter-noreason' ); $this->showDetails( $id ); - return false; + return; } $row = $dbr->selectRow( @@ -857,7 +857,7 @@ class SpecialAbuseLog extends SpecialPage { /** * @param string|null $filter_id - * @param bool|null $filter_hidden + * @param bool|int|null $filter_hidden * @return bool */ public static function canSeeDetails( $filter_id = null, $filter_hidden = null ) { diff --git a/modules/ext.abuseFilter.edit.js b/modules/ext.abuseFilter.edit.js index 601803c7a..e132c7dcf 100644 --- a/modules/ext.abuseFilter.edit.js +++ b/modules/ext.abuseFilter.edit.js @@ -9,15 +9,13 @@ ( function ( mw, $, OO ) { 'use strict'; - // Filter editor for JS and jQuery handling - // @var {jQuery} + // @var {jQuery} Filter editor for JS and jQuery handling var $filterBox, // Filter editor for Ace specific functions filterEditor, - // Hidden textarea for submitting form - // @var {jQuery} + // @var {jQuery} Hidden textarea for submitting form $plainTextBox, - // Bool to determine what editor to use + // @var {boolean} To determine what editor to use useAce = false, // Infused OOUI elements togglePreviewButton, @@ -42,9 +40,9 @@ /** * Things always needed after syntax checks * - * @param {string} resultText + * @param {string} resultText The message to show, telling if the syntax is valid * @param {string} className Class to add - * @param {bool} syntaxOk Is the syntax ok? + * @param {boolean} syntaxOk Is the syntax ok? */ function processSyntaxResultAlways( resultText, className, syntaxOk ) { $.removeSpinner( 'abusefilter-syntaxcheck' ); @@ -130,7 +128,7 @@ * Sends the current filter text to be checked for syntax issues. * * @context HTMLElement - * @param {jQuery.Event} e + * @param {jQuery.Event} e The event fired when the function is called */ function doSyntaxCheck() { var filter = $plainTextBox.val(), @@ -175,7 +173,7 @@ * Fetches a filter from the API and inserts it into the filter box. * * @context HTMLElement - * @param {jQuery.Event} e + * @param {jQuery.Event} e The event fired when the function is called */ function fetchFilter() { var filterId = $.trim( $( '#mw-abusefilter-load-filter input' ).val() ), @@ -284,7 +282,7 @@ * Called if the filter group (#mw-abusefilter-edit-group-input select) is changed. * * @context HTMLELement - * @param {jQuery.Event} e + * @param {jQuery.Event} e The event fired when the function is called */ function onFilterGroupChange() { var $afWarnMessageExisting, newVal; @@ -324,7 +322,7 @@ * Called if the user presses a key in the load filter field * * @context HTMLELement - * @param {jQuery.Event} e + * @param {jQuery.Event} e The event fired when the function is called */ function onFilterKeypress( e ) { if ( e.type === 'keypress' && e.which === 13 ) { diff --git a/modules/ext.abuseFilter.examine.js b/modules/ext.abuseFilter.examine.js index 3decadbed..b8d4591a7 100644 --- a/modules/ext.abuseFilter.examine.js +++ b/modules/ext.abuseFilter.examine.js @@ -8,14 +8,13 @@ ( function ( mw, $ ) { 'use strict'; - // Syntax result div - // @type {jQuery} + // @var {jQuery} Syntax result div var $syntaxResult; /** * Processes the results of the filter test * - * @param {Object} data + * @param {Object} data The response of the API request */ function examinerTestProcess( data ) { var msg, exClass; @@ -70,7 +69,7 @@ * Tests the filter against an rc event or abuse log entry. * * @context HTMLElement - * @param {jQuery.Event} e + * @param {jQuery.Event} e The event fired when the function is called */ function examinerTestFilter() { var filter = $( '#wpTestFilter' ).val(), diff --git a/modules/ext.abuseFilter.tools.js b/modules/ext.abuseFilter.tools.js index b7443e28b..52e2712e9 100644 --- a/modules/ext.abuseFilter.tools.js +++ b/modules/ext.abuseFilter.tools.js @@ -11,7 +11,7 @@ /** * Submits the expression to be evaluated. * @context HTMLElement - * @param {jQuery.Event} e + * @param {jQuery.Event} e The event fired when the function is called */ function doExprSubmit() { var expr = $( '#wpTestExpr' ).val(), @@ -39,7 +39,7 @@ /** * Processes the result of the unblocking autopromotions for a user * - * @param {Object} data + * @param {Object} data The response of the API request */ function processReautoconfirm( data ) { mw.notify( @@ -52,8 +52,8 @@ /** * Processes the result of the unblocking autopromotions for a user in case of an error * - * @param {string} errorCode - * @param {Object} data + * @param {string} errorCode Identifier of the error + * @param {Object} data The response of the API request */ function processReautoconfirmFailure( errorCode, data ) { var msg; @@ -80,8 +80,8 @@ /** * Submits a call to reautoconfirm a user. * @context HTMLElement - * @param {jQuery.Event} e - * @return {boolean} + * @param {jQuery.Event} e The event fired when the function is called + * @return {boolean} False to prevent form submission */ function doReautoSubmit() { var nameField = OO.ui.infuse( $( '#reautoconfirm-user' ) ), diff --git a/modules/mode-abusefilter.js b/modules/mode-abusefilter.js index 0370297d5..a4d82a8f3 100644 --- a/modules/mode-abusefilter.js +++ b/modules/mode-abusefilter.js @@ -5,7 +5,6 @@ ace.define( 'ace/mode/abusefilter_highlight_rules', [ 'require', 'exports', 'mod var oop = require( 'ace/lib/oop' ), TextHighlightRules = require( './text_highlight_rules' ).TextHighlightRules, AFHighlightRules = function () { - var cfg = mw.config.get( 'aceConfig' ), constants = ( 'true|false|null' ), keywordMapper = this.createKeywordMapper( diff --git a/tests/phpunit/AbuseFilterConsequencesTest.php b/tests/phpunit/AbuseFilterConsequencesTest.php index 2c9cf79f6..4be865b53 100644 --- a/tests/phpunit/AbuseFilterConsequencesTest.php +++ b/tests/phpunit/AbuseFilterConsequencesTest.php @@ -488,7 +488,7 @@ class AbuseFilterConsequencesTest extends MediaWikiTestCase { * * @param string $testDescription A short description of the test, used for error reporting * @param int[] $createIds IDs of the filters to create - * @param array $actionParameters Details of the action we need to execute to trigger filters + * @param array $actionParams Details of the action we need to execute to trigger filters * @param array $consequences The consequences we're expecting * @param array $options Further options for the test * @covers AbuseFilter