From 2d880e6c7dbdcabe87e9fbfc98835cc3b53eadd9 Mon Sep 17 00:00:00 2001 From: supahgreg Date: Sat, 11 Oct 2025 01:41:56 +0000 Subject: [PATCH] Add some DOMElement hints to help PHPStan. --- classes/FeedParser.php | 3 +++ classes/OPML.php | 2 ++ plugins/no_iframes/init.php | 1 + 3 files changed, 6 insertions(+) diff --git a/classes/FeedParser.php b/classes/FeedParser.php index e0b16010c..886598d48 100644 --- a/classes/FeedParser.php +++ b/classes/FeedParser.php @@ -100,6 +100,7 @@ class FeedParser { if (empty($articles) || $articles->length == 0) $articles = $xpath->query("//atom03:entry"); + /** @var DOMElement $article */ foreach ($articles as $article) { array_push($this->items, new FeedItem_Atom($article, $this->doc, $this->xpath)); } @@ -124,6 +125,7 @@ class FeedParser { $articles = $xpath->query("//channel/item"); + /** @var DOMElement $article */ foreach ($articles as $article) { array_push($this->items, new FeedItem_RSS($article, $this->doc, $this->xpath)); } @@ -146,6 +148,7 @@ class FeedParser { $articles = $xpath->query("//rssfake:item"); + /** @var DOMElement $article */ foreach ($articles as $article) { array_push($this->items, new FeedItem_RSS($article, $this->doc, $this->xpath)); } diff --git a/classes/OPML.php b/classes/OPML.php index 15fd8865f..9165f5fb6 100644 --- a/classes/OPML.php +++ b/classes/OPML.php @@ -252,6 +252,7 @@ class OPML extends Handler_Protected { $outlines = $xpath->query("//outline[@title]"); // cleanup empty categories + /** @var DOMElement $node */ foreach ($outlines as $node) { if ($node->getElementsByTagName('outline')->length == 0) $node->parentNode->removeChild($node); @@ -540,6 +541,7 @@ class OPML extends Handler_Protected { //$this->opml_notice("[CAT] $cat_title id: $cat_id P_id: $parent_id"); $this->opml_notice(T_sprintf("Processing category: %s", $cat_title ? $cat_title : __("Uncategorized")), $nest); + /** @var DOMElement $node */ foreach ($outlines as $node) { if ($node->hasAttributes() && strtolower($node->tagName) == "outline") { $attrs = $node->attributes; diff --git a/plugins/no_iframes/init.php b/plugins/no_iframes/init.php index dc297b60e..4f455d865 100644 --- a/plugins/no_iframes/init.php +++ b/plugins/no_iframes/init.php @@ -16,6 +16,7 @@ class No_Iframes extends Plugin { $xpath = new DOMXpath($doc); $entries = $xpath->query('//iframe'); + /** @var DOMElement $entry */ foreach ($entries as $entry) { if (!Sanitizer::iframe_whitelisted($entry)) $entry->parentNode->removeChild($entry);