From 0856551da5ce25dc729f543a432096e6786e186d Mon Sep 17 00:00:00 2001 From: PrinsFrank <25006490+PrinsFrank@users.noreply.github.com> Date: Wed, 28 Feb 2024 14:48:18 +0100 Subject: [PATCH] docs: iterator type for Crawler (#620) * Document iterator type for Crawler * Add updated PHPDoc to changelog --- CHANGELOG.md | 5 +++++ phpstan.neon | 1 + src/DomCrawler/Crawler.php | 3 +++ 3 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3392f68..4dde7475 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +2.1.2 +----- + +* Updated PHPDoc: getIterator method on Crawler returns an ArrayIterator of WebDriverElements + 2.1.1 ----- diff --git a/phpstan.neon b/phpstan.neon index e21e2053..b18acb86 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -18,3 +18,4 @@ parameters: # Require a redesign of the underlying Symfony components - '#Call to an undefined method DOMNode::getTagName\(\)\.#' - '#Return type \(void\) of method Symfony\\Component\\Panther\\DomCrawler\\Crawler::clear\(\) should be compatible with return type \(Facebook\\WebDriver\\WebDriverElement\) of method Facebook\\WebDriver\\WebDriverElement::clear\(\)#' + - '#Return type \(ArrayIterator\) of method Symfony\\Component\\Panther\\DomCrawler\\Crawler::getIterator\(\) should be compatible with return type \(ArrayIterator\) of method Symfony\\Component\\DomCrawler\\Crawler::getIterator\(\)#' diff --git a/src/DomCrawler/Crawler.php b/src/DomCrawler/Crawler.php index a78ddd7e..18762bd0 100644 --- a/src/DomCrawler/Crawler.php +++ b/src/DomCrawler/Crawler.php @@ -365,6 +365,9 @@ public function count(): int return \count($this->elements); } + /** + * @return \ArrayIterator + */ public function getIterator(): \ArrayIterator { return new \ArrayIterator($this->elements);