Replace isset() with null check in HtmlTags

Found usage of isset() on expression self::$allowedHtmlTags that appears
to be always set. isset() should only be used to suppress errors. Check
whether the expression is null instead.
See https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#isset

Change-Id: I21483aab05292cfb802ff6a5e63013ecc02f5c13
This commit is contained in:
Umherirrender 2024-04-01 13:47:54 +02:00
parent 2c9b5f0356
commit 91848725e7

View file

@ -22,16 +22,16 @@ namespace MediaWiki\Linter;
class HtmlTags {
/**
* @var array
* @var array|null
*/
private static $allowedHtmlTags;
private static $allowedHtmlTags = null;
/**
* @param SpecialLintErrors|LintErrorsPager $parent
*/
public function __construct( $parent ) {
// reuse the allowed html tags array once constructed
if ( !isset( self::$allowedHtmlTags ) ) {
if ( self::$allowedHtmlTags === null ) {
$tagOptionAll = $parent->msg( 'linter-form-tag-option-all' )->escaped();
self::$allowedHtmlTags = $this->createAllowedHTMLTags();