Skip to content

Commit

Permalink
fix IteratorAggregate usage
Browse files Browse the repository at this point in the history
  • Loading branch information
asccc committed Jul 16, 2020
1 parent 40c2803 commit 8fadf3d
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions app/Parser/NodeList.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace DevCommunityDE\CodeFormatter\Parser;

use IteratorAggregate;
use Traversable;

final class NodeList implements IteratorAggregate
{
Expand Down Expand Up @@ -50,16 +51,12 @@ public function toArray(): array
}

/**
* returns the node-list as iterable list.
* returns the node-list as traversable.
*
* (phan has issues with returning an array as iterable)
*
* @phan-suppress PhanParamSignatureMismatchInternal
*
* @return Node[]
* @return Traversable<Node>
*/
public function getIterator(): iterable
public function getIterator(): Traversable
{
return $this->nodes;
yield from $this->nodes;
}
}

0 comments on commit 8fadf3d

Please sign in to comment.