Implement ObjectCountElementsInterface::__count() returning the row count so count($matrix) works natively.
Per the z-engine dev-master contract, the class must also implement \Countable — z-engine's debug builds verify the count() arginfo — so both should be added together; the engine-level handler still wins at dispatch time.
Follow-up idea once this lands: a dedicated size(): array{int, int} helper for [rows, columns].
Implement
ObjectCountElementsInterface::__count()returning the row count socount($matrix)works natively.Per the z-engine dev-master contract, the class must also implement
\Countable— z-engine's debug builds verify thecount()arginfo — so both should be added together; the engine-level handler still wins at dispatch time.Follow-up idea once this lands: a dedicated
size(): array{int, int}helper for[rows, columns].