Merge "Add and update soft PHPDoc type hints"

This commit is contained in:
jenkins-bot 2020-09-21 01:00:27 +00:00 committed by Gerrit Code Review
commit 077cb83cc9
2 changed files with 7 additions and 10 deletions

View file

@ -78,7 +78,7 @@ class TemplateDataBlob {
private $json = null; private $json = null;
/** /**
* @var Status Cache of TemplateDataBlob::parse * @var Status
*/ */
private $status; private $status;
@ -89,8 +89,7 @@ class TemplateDataBlob {
* *
* @param IDatabase $db * @param IDatabase $db
* @param string $json * @param string $json
* @return TemplateDataBlob|TemplateDataCompressedBlob * @return TemplateDataBlob
* @throws Exception
*/ */
public static function newFromJSON( IDatabase $db, string $json ) : TemplateDataBlob { public static function newFromJSON( IDatabase $db, string $json ) : TemplateDataBlob {
if ( $db->getType() === 'mysql' ) { if ( $db->getType() === 'mysql' ) {
@ -127,7 +126,7 @@ class TemplateDataBlob {
* *
* @param IDatabase $db * @param IDatabase $db
* @param string $json * @param string $json
* @return TemplateDataBlob or TemplateDataCompressedBlob * @return TemplateDataBlob
*/ */
public static function newFromDatabase( IDatabase $db, string $json ) : TemplateDataBlob { public static function newFromDatabase( IDatabase $db, string $json ) : TemplateDataBlob {
// Handle GZIP compression. \037\213 is the header for GZIP files. // Handle GZIP compression. \037\213 is the header for GZIP files.
@ -612,7 +611,7 @@ class TemplateDataBlob {
} }
/** /**
* @return object * @return stdClass
*/ */
public function getData() { public function getData() {
// Return deep clone so callers can't modify data. Needed for getDataInLanguage(). // Return deep clone so callers can't modify data. Needed for getDataInLanguage().
@ -625,7 +624,7 @@ class TemplateDataBlob {
* appropriate language. * appropriate language.
* *
* @param string $langCode Preferred language * @param string $langCode Preferred language
* @return object * @return stdClass
*/ */
public function getDataInLanguage( string $langCode ) { public function getDataInLanguage( string $langCode ) {
$data = $this->getData(); $data = $this->getData();
@ -705,6 +704,7 @@ class TemplateDataBlob {
$formatMsg = null; $formatMsg = null;
} elseif ( isset( self::FORMATS[$data->format] ) ) { } elseif ( isset( self::FORMATS[$data->format] ) ) {
$formatMsg = $data->format; $formatMsg = $data->format;
'@phan-var string $formatMsg';
$icon = 'template-format-' . $formatMsg; $icon = 'template-format-' . $formatMsg;
} else { } else {
$formatMsg = 'custom'; $formatMsg = 'custom';

View file

@ -23,10 +23,7 @@ class TemplateDataCompressedBlob extends TemplateDataBlob {
protected $jsonDB = null; protected $jsonDB = null;
/** /**
* Parse the data, normalise it and validate it. * @inheritDoc
*
* See Specification.md for the expected format of the JSON object.
* @return Status
*/ */
protected function parse() : Status { protected function parse() : Status {
$status = parent::parse(); $status = parent::parse();