I have a Collection class that holds data as an array internally.
class Collection implements \IteratorAggregate, \Countable, \ArrayAccess
{
...
}
At some point in the code, following is happening
$list = new Collection([]);
array_map(function(Object $v){ return $v->getKey(); }, $list);
I thought implementing ArrayAccess should be enough to make an object behave like an array. IN thins case I have other implemented aS well, but clearly php uses some other mechanism to detect if the argument passed is an array as I am getting the
array_map(): Argument #2 should be an array