File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
src/TypeSystem/Type/UnionType
test/Unit/TypeSystem/Type/UnionType Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -106,10 +106,16 @@ public function is(TypeInterface $other): bool
106106 }
107107 }
108108
109- /** @return \ArrayIterator <int, TypeInterface> */
110- public function getIterator (): \ArrayIterator
109+ /** @return \Iterator <int, TypeInterface> */
110+ public function getIterator (): \Iterator
111111 {
112- return new \ArrayIterator ($ this ->members );
112+ yield from $ this ->members ;
113+ }
114+
115+ /** @return array<int, TypeInterface> */
116+ public function toArray (): array
117+ {
118+ return $ this ->members ;
113119 }
114120
115121 public function count (): int
Original file line number Diff line number Diff line change @@ -114,8 +114,8 @@ public function unionOnlyHoldsDeduplicatedMembers(): void
114114 $ this ->assertCount (count ($ unionType ), $ otherUnionType );
115115
116116 $ this ->assertEqualsCanonicalizing (
117- $ unionType ->getIterator ()-> getArrayCopy (),
118- $ otherUnionType ->getIterator ()-> getArrayCopy ()
117+ $ unionType ->toArray (),
118+ $ otherUnionType ->toArray ()
119119 );
120120 }
121121
You can’t perform that action at this time.
0 commit comments