public static function castCollection(Collection $c, array $a, Stub $stub, bool $isNested) : array { $a[Caster::PREFIX_VIRTUAL . 'count'] = $c->count(); $a[Caster::PREFIX_VIRTUAL . 'capacity'] = $c->capacity(); if (!$c instanceof Map) { $a += $c->toArray(); } return $a; }