mediawiki-extensions-AbuseF.../includes/Parser/UserVisibleWarning.php
Daimona Eaytoy 7c1d1c6d7d Return warnings from the parser, add warning for catch-all regexps
This commit introduces some boilerplate for emitting warnings from the
AbuseFilter parser, and also code for showing these warnings in the ace
editor. Adding new warnings should be as simple as appending to
AbuseFilterParser::warnings (and adding the relevant i18n).

Bug: T264768
Bug: T269770
Change-Id: Ic11021b379f997a89f59c8c0572338d957e089a6
2020-12-18 18:22:41 +01:00

23 lines
467 B
PHP

<?php
namespace MediaWiki\Extension\AbuseFilter\Parser;
use Message;
/**
* A variant of user-visible exception that is not fatal.
*/
class UserVisibleWarning extends AFPUserVisibleException {
/**
* @return Message
*/
public function getMessageObj() {
// Give grep a chance to find the usages:
// abusefilter-warning-match-empty-regex
return wfMessage(
'abusefilter-warning-' . $this->mExceptionID,
$this->mPosition, ...$this->mParams
);
}
}