Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document iterator type for Crawler #620

Merged
merged 2 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading