more type hints

This commit is contained in:
Andrew Dolgov
2025-04-14 15:31:06 +03:00
parent 945690fffc
commit 8cf3059951
3 changed files with 5 additions and 0 deletions

View File

@@ -80,6 +80,7 @@ class FeedItem_Atom extends FeedItem_Common {
$elems = $tmpxpath->query("(//*[@href]|//*[@src])");
/** @var DOMElement $elem */
foreach ($elems as $elem) {
if ($elem->hasAttribute("href")) {
$elem->setAttribute("href",
@@ -210,6 +211,7 @@ class FeedItem_Atom extends FeedItem_Common {
return clean($lang);
} else {
// Fall back to the language declared on the feed, if any.
/** @var DOMElement|DOMNode $child */
foreach ($this->doc->childNodes as $child) {
if (method_exists($child, "getAttributeNS")) {
return clean($child->getAttributeNS(self::NS_XML, "lang"));

View File

@@ -33,6 +33,7 @@ class FeedItem_RSS extends FeedItem_Common {
function get_link(): string {
$links = $this->xpath->query("atom:link", $this->elem);
/** @var DOMElement $link */
foreach ($links as $link) {
if ($link->hasAttribute("href") &&
(!$link->hasAttribute("rel")

View File

@@ -213,6 +213,7 @@ class FeedParser {
case $this::FEED_ATOM:
$links = $this->xpath->query("//atom:feed/atom:link");
/** @var DOMElement $link */
foreach ($links as $link) {
if (!$rel || $link->hasAttribute('rel') && $link->getAttribute('rel') == $rel) {
array_push($rv, clean(trim($link->getAttribute('href'))));
@@ -222,6 +223,7 @@ class FeedParser {
case $this::FEED_RSS:
$links = $this->xpath->query("//atom:link");
/** @var DOMElement $link */
foreach ($links as $link) {
if (!$rel || $link->hasAttribute('rel') && $link->getAttribute('rel') == $rel) {
array_push($rv, clean(trim($link->getAttribute('href'))));