src/CannotAlterCollection.php
public static function byOverWriting(Collection $collection, int $index): NotAllowed
    {
        return new static(sprintf(
            'Cannot write to the immutable collection `%s`. ' .
            '(Tried writing to position %d).',
            get_class($collection),
            $index
        ));
    }
public static function byOverWriting(Collection $collection, int $index): NotAllowed
    {
        return new static(sprintf(
            'Cannot write to the immutable collection `%s`. ' .
            '(Tried writing to position %d).',
            get_class($collection),
            $index
        ));
    }
public static function byOverWriting ( Collection $ collection , int $ index ) : NotAllowed { return new static ( sprintf ( 'Cannot write to the immutable collection `%s`. ' . '(Tried writing to position %d).' , get_class ( $ collection ) , $ index ) ) ; }
Indicates that this write operation is not allowed.

@param Collection $collection The collection that may not be mutated.
@param int        $index      The index that will not be overwritten.
@return NotAllowed            The exception object.
Indicates that this write operation is not allowed .