<?php
class Foo implements Iterator {
protected $count = 500;
public function next() {
$this->count--;
}
public function valid() {
return $this->count > 0;
}
public function rewind() {
$this->count = 500;
}
public function key() {
return null;
}
public function current() {
return $this->count;
}
}
// This one
$f = new Foo;
foreach($f as $val) {
}
var_dump($f);
Deprecated: Return type of Foo::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/fm5Io on line 21
Deprecated: Return type of Foo::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/fm5Io on line 5
Deprecated: Return type of Foo::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/fm5Io on line 17
Deprecated: Return type of Foo::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/fm5Io on line 9
Deprecated: Return type of Foo::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/fm5Io on line 13
object(Foo)#1 (1) {
["count":protected]=>
int(0)
}