Skip to content

Commit

Permalink
docs: iterator type for Crawler (#620)
Browse files Browse the repository at this point in the history
* Document iterator type for Crawler

* Add updated PHPDoc to changelog
  • Loading branch information
PrinsFrank authored Feb 28, 2024
1 parent 732d630 commit 0856551
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

2.1.2
-----

* Updated PHPDoc: getIterator method on Crawler returns an ArrayIterator of WebDriverElements

2.1.1
-----

Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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<int, Facebook\\WebDriver\\WebDriverElement>\) of method Symfony\\Component\\Panther\\DomCrawler\\Crawler::getIterator\(\) should be compatible with return type \(ArrayIterator<int, DOMNode>\) of method Symfony\\Component\\DomCrawler\\Crawler::getIterator\(\)#'
3 changes: 3 additions & 0 deletions src/DomCrawler/Crawler.php
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,9 @@ public function count(): int
return \count($this->elements);
}

/**
* @return \ArrayIterator<int, WebDriverElement>
*/
public function getIterator(): \ArrayIterator
{
return new \ArrayIterator($this->elements);
Expand Down

0 comments on commit 0856551

Please sign in to comment.