src/AbstractCollection.php
final protected function setCollectionClass($class)
    {
        try {
            $this->collectionClass = new StringType($class);
        } catch (TypeValidationException $e) {
            $this->collectionClass = CollectionConstants::_UNMAPPABLE_CLASS;
        } catch (ValueOutOfBoundsException $e) {
            $this->collectionClass = CollectionConstants::_UNMAPPABLE_CLASS;
        }
    }
final protected function setCollectionClass($class)
    {
        try {
            $this->collectionClass = new StringType($class);
        } catch (TypeValidationException $e) {
            $this->collectionClass = CollectionConstants::_UNMAPPABLE_CLASS;
        } catch (ValueOutOfBoundsException $e) {
            $this->collectionClass = CollectionConstants::_UNMAPPABLE_CLASS;
        }
    }
final protected function setCollectionClass ( $ class ) { try { $ this -> collectionClass = new StringType ( $ class ) ; } catch ( TypeValidationException $ e ) { $ this -> collectionClass = CollectionConstants :: _UNMAPPABLE_CLASS ; } catch ( ValueOutOfBoundsException $ e ) { $ this -> collectionClass = CollectionConstants :: _UNMAPPABLE_CLASS ; } }
Sets the expected class for the collection's items.

This is to be used when extending this class to create a collection of a specific type.
The method should be called in the constructor before calling the parent constructor, e.g:
```
public function __construct(Array $collectionItems = [])
{
$this->setCollectionClass(MyClass::class);
parent::__construct($collectionItems);
}
```

@param $class string
@return void
Sets the expected class for the collection s items .