Skip to content

Commit 3de9bfe

Browse files
addshorethiemowmde
authored andcommitted
phpdoc: TermList::getIterator can return an Iterator (#774)
* phpdoc: TermList::getIterator can return an Iterator Without this type hint we get an IDE error (and probably further static analysis errors) as SpecialNewLexeme::createSummary calls getIterator and calls current() on the result which doesn't exist in the current typehint. This is a 2 part fix, getIterator should document that it can return an Iterator, and also the createSummary method should probably check that it actually has a Iterator instead of a just a Traversable. * Remove Traversable from getIterator phpdoc
1 parent 946cc77 commit 3de9bfe

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Term/TermList.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
use Comparable;
77
use Countable;
88
use InvalidArgumentException;
9+
use Iterator;
910
use IteratorAggregate;
1011
use OutOfBoundsException;
11-
use Traversable;
1212

1313
/**
1414
* Unordered list of Term objects.
@@ -66,7 +66,7 @@ public function toTextArray() {
6666

6767
/**
6868
* @see IteratorAggregate::getIterator
69-
* @return Traversable|Term[]
69+
* @return Iterator|Term[]
7070
*/
7171
public function getIterator() {
7272
return new ArrayIterator( $this->terms );

0 commit comments

Comments
 (0)