Prefer "=== null" for consistency and readability

Change-Id: I59a7d072ec859f59ff6692d7fa79708ec184322e
This commit is contained in:
Thiemo Kreuz (WMDE) 2018-11-19 16:33:41 +01:00
parent 7ecdec713d
commit 30c6323e82

View file

@ -653,7 +653,7 @@ class Cite {
*/ */
public function references( $str, array $argv, Parser $parser, PPFrame $frame ) { public function references( $str, array $argv, Parser $parser, PPFrame $frame ) {
if ( $this->mInCite || $this->mInReferences ) { if ( $this->mInCite || $this->mInReferences ) {
if ( is_null( $str ) ) { if ( $str === null ) {
return htmlspecialchars( "<references/>" ); return htmlspecialchars( "<references/>" );
} }
return htmlspecialchars( "<references>$str</references>" ); return htmlspecialchars( "<references>$str</references>" );
@ -918,7 +918,7 @@ class Cite {
* @return String * @return String
*/ */
private function referenceText( $key, $text ) { private function referenceText( $key, $text ) {
if ( !isset( $text ) || $text === '' ) { if ( $text === null || $text === '' ) {
if ( $this->mParser->getOptions()->getIsSectionPreview() ) { if ( $this->mParser->getOptions()->getIsSectionPreview() ) {
return $this->warning( 'cite_warning_sectionpreview_no_text', $key, 'noparse' ); return $this->warning( 'cite_warning_sectionpreview_no_text', $key, 'noparse' );
} }
@ -1010,7 +1010,7 @@ class Cite {
private function refKey( $key, $num = null ) { private function refKey( $key, $num = null ) {
$prefix = wfMessage( 'cite_reference_link_prefix' )->inContentLanguage()->text(); $prefix = wfMessage( 'cite_reference_link_prefix' )->inContentLanguage()->text();
$suffix = wfMessage( 'cite_reference_link_suffix' )->inContentLanguage()->text(); $suffix = wfMessage( 'cite_reference_link_suffix' )->inContentLanguage()->text();
if ( isset( $num ) ) { if ( $num !== null ) {
$key = wfMessage( 'cite_reference_link_key_with_num', $key, $num ) $key = wfMessage( 'cite_reference_link_key_with_num', $key, $num )
->inContentLanguage()->plain(); ->inContentLanguage()->plain();
} }
@ -1051,7 +1051,10 @@ class Cite {
*/ */
private function linkRef( $group, $key, $count = null, $label = null, $subkey = '' ) { private function linkRef( $group, $key, $count = null, $label = null, $subkey = '' ) {
global $wgContLang; global $wgContLang;
$label = is_null( $label ) ? ++$this->mGroupCnt[$group] : $label;
if ( $label === null ) {
$label = ++$this->mGroupCnt[$group];
}
return $this->mParser->recursiveTagParse( return $this->mParser->recursiveTagParse(
wfMessage( wfMessage(
@ -1197,7 +1200,7 @@ class Cite {
*/ */
public function checkRefsNoReferences( $afterParse, $parser, &$text ) { public function checkRefsNoReferences( $afterParse, $parser, &$text ) {
global $wgCiteResponsiveReferences; global $wgCiteResponsiveReferences;
if ( is_null( $parser->extCite ) ) { if ( $parser->extCite === null ) {
return; return;
} }
if ( $parser->extCite !== $this ) { if ( $parser->extCite !== $this ) {