Merge "Make TemplateDataBlob::normaliseInterfaceText() private"

This commit is contained in:
jenkins-bot 2020-09-08 22:45:15 +00:00 committed by Gerrit Code Review
commit 6dd0b66fea

View file

@ -165,7 +165,7 @@ class TemplateDataBlob {
if ( !is_object( $data->description ) && !is_string( $data->description ) ) { if ( !is_object( $data->description ) && !is_string( $data->description ) ) {
return Status::newFatal( 'templatedata-invalid-type', 'description', 'string|object' ); return Status::newFatal( 'templatedata-invalid-type', 'description', 'string|object' );
} }
$data->description = self::normaliseInterfaceText( $data->description ); $data->description = $this->normaliseInterfaceText( $data->description );
} else { } else {
$data->description = null; $data->description = null;
} }
@ -230,7 +230,7 @@ class TemplateDataBlob {
'string|object' 'string|object'
); );
} }
$paramObj->label = self::normaliseInterfaceText( $paramObj->label ); $paramObj->label = $this->normaliseInterfaceText( $paramObj->label );
} else { } else {
$paramObj->label = null; $paramObj->label = null;
} }
@ -271,7 +271,7 @@ class TemplateDataBlob {
'string|object' 'string|object'
); );
} }
$paramObj->description = self::normaliseInterfaceText( $paramObj->description ); $paramObj->description = $this->normaliseInterfaceText( $paramObj->description );
} else { } else {
$paramObj->description = null; $paramObj->description = null;
} }
@ -286,7 +286,7 @@ class TemplateDataBlob {
'string|object' 'string|object'
); );
} }
$paramObj->example = self::normaliseInterfaceText( $paramObj->example ); $paramObj->example = $this->normaliseInterfaceText( $paramObj->example );
} else { } else {
$paramObj->example = null; $paramObj->example = null;
} }
@ -342,7 +342,7 @@ class TemplateDataBlob {
'string|object' 'string|object'
); );
} }
$paramObj->default = self::normaliseInterfaceText( $paramObj->default ); $paramObj->default = $this->normaliseInterfaceText( $paramObj->default );
} else { } else {
$paramObj->default = null; $paramObj->default = null;
} }
@ -461,7 +461,7 @@ class TemplateDataBlob {
); );
} }
$setObj->label = self::normaliseInterfaceText( $setObj->label ); $setObj->label = $this->normaliseInterfaceText( $setObj->label );
if ( !isset( $setObj->params ) ) { if ( !isset( $setObj->params ) ) {
return Status::newFatal( 'templatedata-invalid-missing', "sets.{$setNr}.params", 'array' ); return Status::newFatal( 'templatedata-invalid-missing', "sets.{$setNr}.params", 'array' );
@ -558,9 +558,9 @@ class TemplateDataBlob {
/** /**
* Normalise a InterfaceText field in the TemplateData blob. * Normalise a InterfaceText field in the TemplateData blob.
* @param stdClass|string $text * @param stdClass|string $text
* @return stdClass|string * @return stdClass
*/ */
protected static function normaliseInterfaceText( $text ) { private function normaliseInterfaceText( $text ) {
if ( is_string( $text ) ) { if ( is_string( $text ) ) {
$contLang = MediaWikiServices::getInstance()->getContentLanguage(); $contLang = MediaWikiServices::getInstance()->getContentLanguage();
return (object)[ $contLang->getCode() => $text ]; return (object)[ $contLang->getCode() => $text ];