BaseCollection
has been removed. ExtendAbstractCollectionDecorator
if you need to add new functionality to collections.TypedCollection
now final. UseTypedCollection
inside yourAbstractCollectionDecorator
if you need to add new functionality to collections. For example:
use spaceonfire\Collection\AbstractCollectionDecorator;
use spaceonfire\Collection\TypedCollection;
final class MyIntegerCollection extends AbstractCollectionDecorator
{
public function __construct($items) {
parent::__construct(new TypedCollection($items, 'integer'));
}
// New functionality
public function multiplyByThree(): self
{
return $this->map(static function ($i) {
return $i * 3;
});
}
}