mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TemplateData
synced 2024-11-27 17:20:01 +00:00
Merge "Add and update soft PHPDoc type hints"
This commit is contained in:
commit
077cb83cc9
|
@ -78,7 +78,7 @@ class TemplateDataBlob {
|
|||
private $json = null;
|
||||
|
||||
/**
|
||||
* @var Status Cache of TemplateDataBlob::parse
|
||||
* @var Status
|
||||
*/
|
||||
private $status;
|
||||
|
||||
|
@ -89,8 +89,7 @@ class TemplateDataBlob {
|
|||
*
|
||||
* @param IDatabase $db
|
||||
* @param string $json
|
||||
* @return TemplateDataBlob|TemplateDataCompressedBlob
|
||||
* @throws Exception
|
||||
* @return TemplateDataBlob
|
||||
*/
|
||||
public static function newFromJSON( IDatabase $db, string $json ) : TemplateDataBlob {
|
||||
if ( $db->getType() === 'mysql' ) {
|
||||
|
@ -127,7 +126,7 @@ class TemplateDataBlob {
|
|||
*
|
||||
* @param IDatabase $db
|
||||
* @param string $json
|
||||
* @return TemplateDataBlob or TemplateDataCompressedBlob
|
||||
* @return TemplateDataBlob
|
||||
*/
|
||||
public static function newFromDatabase( IDatabase $db, string $json ) : TemplateDataBlob {
|
||||
// Handle GZIP compression. \037\213 is the header for GZIP files.
|
||||
|
@ -612,7 +611,7 @@ class TemplateDataBlob {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return object
|
||||
* @return stdClass
|
||||
*/
|
||||
public function getData() {
|
||||
// Return deep clone so callers can't modify data. Needed for getDataInLanguage().
|
||||
|
@ -625,7 +624,7 @@ class TemplateDataBlob {
|
|||
* appropriate language.
|
||||
*
|
||||
* @param string $langCode Preferred language
|
||||
* @return object
|
||||
* @return stdClass
|
||||
*/
|
||||
public function getDataInLanguage( string $langCode ) {
|
||||
$data = $this->getData();
|
||||
|
@ -705,6 +704,7 @@ class TemplateDataBlob {
|
|||
$formatMsg = null;
|
||||
} elseif ( isset( self::FORMATS[$data->format] ) ) {
|
||||
$formatMsg = $data->format;
|
||||
'@phan-var string $formatMsg';
|
||||
$icon = 'template-format-' . $formatMsg;
|
||||
} else {
|
||||
$formatMsg = 'custom';
|
||||
|
|
|
@ -23,10 +23,7 @@ class TemplateDataCompressedBlob extends TemplateDataBlob {
|
|||
protected $jsonDB = null;
|
||||
|
||||
/**
|
||||
* Parse the data, normalise it and validate it.
|
||||
*
|
||||
* See Specification.md for the expected format of the JSON object.
|
||||
* @return Status
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function parse() : Status {
|
||||
$status = parent::parse();
|
||||
|
|
Loading…
Reference in a new issue