Skip to content

Commit 6c14863

Browse files
Silvan-WMDEaddshore
authored andcommitted
Change getIterator() type hints to Iterator
This change of type hints from Traversable to Iterator avoids static analysis errors by phan. As described in https://github.com/phan/phan/blob/master/NEWS.md#11-feb-2018-phan-0112 phan's type system still does not support inferring key types for Iterable or Traversable.
1 parent 01fc4c6 commit 6c14863

6 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/Entity/ItemIdSet.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function count() {
5252
/**
5353
* @see IteratorAggregate::getIterator
5454
*
55-
* @return Traversable|ItemId[]
55+
* @return Iterator|ItemId[]
5656
*/
5757
public function getIterator() {
5858
return new ArrayIterator( $this->ids );

src/ReferenceList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ public function count() {
298298
*
299299
* @since 5.0
300300
*
301-
* @return Traversable
301+
* @return Iterator|Reference[]
302302
*/
303303
public function getIterator() {
304304
return new ArrayIterator( array_values( $this->references ) );

src/SiteLinkList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function setNewSiteLink( $siteId, $pageName, $badges = null ) {
103103
*
104104
* Returns a Traversable of SiteLink in which the keys are the site ids.
105105
*
106-
* @return Traversable|SiteLink[]
106+
* @return Iterator|SiteLink[]
107107
*/
108108
public function getIterator() {
109109
return new ArrayIterator( $this->siteLinks );

src/Statement/StatementByGuidMap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function count() {
107107
* The iterator has the GUIDs of the statements as keys.
108108
*
109109
* @see IteratorAggregate::getIterator
110-
* @return Traversable|Statement[]
110+
* @return Iterator|Statement[]
111111
*/
112112
public function getIterator() {
113113
return new ArrayIterator( $this->statements );

src/Statement/StatementList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ public function getMainSnaks() {
240240
}
241241

242242
/**
243-
* @return Traversable|Statement[]
243+
* @return Iterator|Statement[]
244244
*/
245245
public function getIterator() {
246246
return new ArrayIterator( $this->statements );

src/Term/AliasGroupList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function count() {
5252

5353
/**
5454
* @see IteratorAggregate::getIterator
55-
* @return Traversable|AliasGroup[]
55+
* @return Iterator|AliasGroup[]
5656
*/
5757
public function getIterator() {
5858
return new ArrayIterator( $this->groups );

0 commit comments

Comments
 (0)