Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Latest commit

 

History

History
executable file
·
28 lines (23 loc) · 825 Bytes

UPGRADE.md

File metadata and controls

executable file
·
28 lines (23 loc) · 825 Bytes

Upgrading Instruction

Upgrade from 1.x to 2.0

  • BaseCollection has been removed. Extend AbstractCollectionDecorator if you need to add new functionality to collections.
  • TypedCollection now final. Use TypedCollection inside your AbstractCollectionDecorator 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;
        });
    }
}