Merge "Fix/narrow visibility of several methods"

This commit is contained in:
jenkins-bot 2022-02-08 15:54:22 +00:00 committed by Gerrit Code Review
commit a64ed0a376
2 changed files with 15 additions and 11 deletions

View file

@ -109,7 +109,7 @@ class TemplateDataBlob {
* @return null|string Text value from the InterfaceText object or null if no suitable
* match was found
*/
protected static function getInterfaceTextInLanguage( stdClass $text, string $langCode ): ?string {
private function getInterfaceTextInLanguage( stdClass $text, string $langCode ): ?string {
if ( isset( $text->$langCode ) ) {
return $text->$langCode;
}
@ -163,33 +163,33 @@ class TemplateDataBlob {
// Root.description
if ( $data->description !== null ) {
$data->description = self::getInterfaceTextInLanguage( $data->description, $langCode );
$data->description = $this->getInterfaceTextInLanguage( $data->description, $langCode );
}
foreach ( $data->params as $param ) {
// Param.label
if ( $param->label !== null ) {
$param->label = self::getInterfaceTextInLanguage( $param->label, $langCode );
$param->label = $this->getInterfaceTextInLanguage( $param->label, $langCode );
}
// Param.description
if ( $param->description !== null ) {
$param->description = self::getInterfaceTextInLanguage( $param->description, $langCode );
$param->description = $this->getInterfaceTextInLanguage( $param->description, $langCode );
}
// Param.default
if ( $param->default !== null ) {
$param->default = self::getInterfaceTextInLanguage( $param->default, $langCode );
$param->default = $this->getInterfaceTextInLanguage( $param->default, $langCode );
}
// Param.example
if ( $param->example !== null ) {
$param->example = self::getInterfaceTextInLanguage( $param->example, $langCode );
$param->example = $this->getInterfaceTextInLanguage( $param->example, $langCode );
}
}
foreach ( $data->sets as $setObj ) {
$label = self::getInterfaceTextInLanguage( $setObj->label, $langCode );
$label = $this->getInterfaceTextInLanguage( $setObj->label, $langCode );
if ( $label === null ) {
// Contrary to other InterfaceTexts, set label is not optional. If we're here it
// means the template data from the wiki doesn't contain either the user language,
@ -209,7 +209,7 @@ class TemplateDataBlob {
/**
* @return string JSON
*/
public function getJSON(): string {
protected function getJSON(): string {
if ( $this->json === null ) {
// Cache for repeat calls
$this->json = json_encode( $this->data );

View file

@ -685,7 +685,7 @@ class TemplateDataBlobTest extends MediaWikiIntegrationTestCase {
return $calls;
}
protected function getStatusText( Status $status ): string {
private function getStatusText( Status $status ): string {
$str = Parser::stripOuterParagraph( $status->getHtml() );
// Unescape char references for things like "[, "]" and "|" for
// cleaner test assertions and output
@ -715,7 +715,7 @@ class TemplateDataBlobTest extends MediaWikiIntegrationTestCase {
* @param mixed $actual
* @param string|null $message
*/
protected function assertStrictJsonEquals( $expected, $actual, $message = null ) {
private function assertStrictJsonEquals( $expected, $actual, $message = null ) {
// Lazy recursive strict comparison: Serialise to JSON and compare that
// Sort first to ensure key-order
$expected = json_decode( $expected, /* assoc = */ true );
@ -730,7 +730,7 @@ class TemplateDataBlobTest extends MediaWikiIntegrationTestCase {
);
}
protected function assertTemplateData( array $case ) {
private function assertTemplateData( array $case ) {
// Expand defaults
if ( !isset( $case['status'] ) ) {
$case['status'] = true;
@ -740,6 +740,8 @@ class TemplateDataBlobTest extends MediaWikiIntegrationTestCase {
}
$t = TemplateDataBlob::newFromJSON( $this->db, $case['input'] );
/** @var TemplateDataBlob $t */
$t = TestingAccessWrapper::newFromObject( $t );
$actual = $t->getJSON();
$status = $t->getStatus();
@ -759,6 +761,8 @@ class TemplateDataBlobTest extends MediaWikiIntegrationTestCase {
// Assert this case roundtrips properly by running through the output as input.
$t = TemplateDataBlob::newFromJSON( $this->db, $case['output'] );
/** @var TemplateDataBlob $t */
$t = TestingAccessWrapper::newFromObject( $t );
$status = $t->getStatus();
if ( !$status->isGood() ) {