Incorrect type on DataCollection iterator #202
-
Hi! Thanks for v2! I'm loving the upgrades. However, I'm running into the following phpstan error: "Cannot call method validate() on array." in the following snippet: /** @var DataCollection<int,Data> */
$collection = Data::collection();
foreach($collection as $item) {
$item->validate();
} I think this is because the type of BaseDataCollectable -> getIterator is incorrect: /** @return \ArrayIterator<TKey, array> */
public function getIterator(): ArrayIterator But should be: /** @return \ArrayIterator<TKey, TValue> */
public function getIterator(): ArrayIterator You can see the difference it makes with with the phpstan playground:
Please correct me if I'm using something wrong! |
Beta Was this translation helpful? Give feedback.
Answered by
rubenvanassche
Sep 7, 2022
Replies: 1 comment
-
Looks like you're correct! It will be fixed in the next version! |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
iamrgroot
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks like you're correct! It will be fixed in the next version!