src/CannotAlterCollection.php
public static function byResizingTo(Collection $collection, int $size): NotAllowed
    {
        return new static(sprintf(
            'Cannot directly resize the immutable collection `%s`. ' .
            '(Tried to resize from %d to %d).',
            get_class($collection),
            count($collection),
            $size
        ));
    }
public static function byResizingTo(Collection $collection, int $size): NotAllowed
    {
        return new static(sprintf(
            'Cannot directly resize the immutable collection `%s`. ' .
            '(Tried to resize from %d to %d).',
            get_class($collection),
            count($collection),
            $size
        ));
    }
public static function byResizingTo ( Collection $ collection , int $ size ) : NotAllowed { return new static ( sprintf ( 'Cannot directly resize the immutable collection `%s`. ' . '(Tried to resize from %d to %d).' , get_class ( $ collection ) , count ( $ collection ) , $ size ) ) ; }
Indicates that this resize operation is not allowed.

@param Collection $collection The collection that may not be mutated.
@param int        $size       The size that will not be assigned.
@return NotAllowed            The exception object.
Indicates that this resize operation is not allowed .