Replace isset() with null check in DiscussionParser

Found usage of isset() on expression self::$diffParser 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: Iaaad420ad05b8352f8a7f162c746591749c8b3e9
This commit is contained in:
Umherirrender 2024-04-01 13:37:27 +02:00
parent ced572b369
commit 297ed70cb2

View file

@ -36,7 +36,7 @@ abstract class DiscussionParser {
protected static $revisionInterpretationCache = []; protected static $revisionInterpretationCache = [];
/** @var DiffParser|null */ /** @var DiffParser|null */
protected static $diffParser; protected static $diffParser = null;
/** /**
* Given a RevisionRecord object, generates Event objects for * Given a RevisionRecord object, generates Event objects for
@ -1012,7 +1012,7 @@ abstract class DiscussionParser {
* * 'left_pos' and 'right_pos' (in lines) of the change. * * 'left_pos' and 'right_pos' (in lines) of the change.
*/ */
public static function getMachineReadableDiff( $oldText, $newText ) { public static function getMachineReadableDiff( $oldText, $newText ) {
if ( !isset( self::$diffParser ) ) { if ( self::$diffParser === null ) {
self::$diffParser = new DiffParser; self::$diffParser = new DiffParser;
} }