Add missing documentation to class properties

Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation and to remove the exclusion of the
sniff.
The activated sniff avoids that new code is missing doc-typehints or
real-typehints.

Adding a @var type to RSSData->items triggers a SecurityCheck-XSS issue by phan, but all is dealing with wikitext when building the items, so that looks like a false positive

Change-Id: I4f1d17372d62f02fe7447f5bf5e75b9471d7a338
This commit is contained in:
Umherirrender 2024-08-20 22:15:24 +02:00
parent 32b1a25768
commit 2cc29f25a0
4 changed files with 18 additions and 2 deletions

View file

@ -2,8 +2,6 @@
<ruleset>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPrivate" />
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationProtected" />
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPublic" />
</rule>
<file>.</file>
<arg name="extensions" value="php" />

View file

@ -98,6 +98,7 @@ class Hooks implements ParserFirstCallInitHook {
return Utils::getErrorHtml( 'rss-empty', htmlspecialchars( $input ) );
}
// @phan-suppress-next-line SecurityCheck-XSS
return $rss->renderFeed( $parser, $frame );
}

View file

@ -6,7 +6,9 @@ use DOMDocument;
use DOMXPath;
class RSSData {
/** @var string */
public $error;
/** @var string[][] */
public $items;
/**

View file

@ -16,20 +16,35 @@ use WANObjectCache;
use Wikimedia\AtEase\AtEase;
class RSSParser {
/** @var int */
protected $maxheads = 32;
/** @var string */
protected $date = "Y-m-d H:i:s";
/** @var int */
protected $ItemMaxLength = 200;
/** @var bool */
protected $reversed = false;
/** @var string[] */
protected $highlight = [];
/** @var string[] */
protected $filter = [];
/** @var string[] */
protected $filterOut = [];
/** @var string */
protected $itemTemplate;
/** @var string */
protected $url;
/** @var string */
protected $etag;
/** @var int */
protected $lastModified;
/** @var DOMDocument */
protected $xml;
/** @var string[] */
protected $displayFields = [ 'author', 'title', 'encodedContent', 'description' ];
/** @var string[] */
protected $stripItems;
/** @var string */
protected $markerString;
/**