Search for all calls to PHP functions who modify the pointer (example: AbstractCollection::replace() whol call reset())
<?php
class Collection extends ObjectCollection
{
public function getPointer(): CollectionPointer;
public function getFirstValue(): Foo
{
return $this->values[array_key_first()];
}
}
class CollectionPointer
{
public function __construct(private readonly Collection $collection)
{
}
public function reset(): static;
public function getNextValue(): Foo;
public function getFirstValue(): Foo
{
$this->reset();
return current($this->collection->value);
}
public function getCurrentValue(): Foo;
}
$foo = new Collection();
$foo->getPointer()->getFirstValue();
$foo->getPointer()->getNextValue();
Search for all calls to PHP functions who modify the pointer (example:
AbstractCollection::replace()whol callreset())