oxidmod/typed-collections

View on GitHub
src/SimpleCollection/ObjectCollection.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

declare(strict_types=1);

namespace Oxidmod\TypedCollections\SimpleCollection;

use Oxidmod\TypedCollections\TypeCheckerFactory;

/**
 * @method offsetSet($offset, object $value) : void
 */
class ObjectCollection extends AbstractCollection
{
    public function __construct(array $items = [])
    {
        parent::__construct(TypeCheckerFactory::objectChecker(), $items);
    }

    public function offsetGet($offset): ?object
    {
        return $this->items[$offset] ?? null;
    }
}