<?php
class Result implements IteratorAggregate {
public function getIterator() {
return new ArrayIterator($this);
}
}
/** @var Result<int> */
$a = new Result();
foreach ($a as $item) {
\PHPStan\dumpType($item);
}
phpstan understands $item as int, but LSP return Tvalue.