lib/Persistence/Doctrine/Handler/CollectionHandler.php
private function createItemPosition(Collection $collection, ?int $newPosition): int
    {
        if (!$this->isCollectionDynamic($collection)) {
            return $this->positionHelper->createPosition(
                $this->getPositionHelperItemConditions(
                    $collection->id,
                    $collection->status
                ),
                $newPosition
            );
        }

        if ($newPosition === null) {
            throw new BadStateException('collection', 'When adding items to dynamic collections, position is mandatory.');
        }

        return $this->incrementItemPositions($collection, $newPosition);
    }
private function createItemPosition(Collection $collection, ?int $newPosition): int
    {
        if (!$this->isCollectionDynamic($collection)) {
            return $this->positionHelper->createPosition(
                $this->getPositionHelperItemConditions(
                    $collection->id,
                    $collection->status
                ),
                $newPosition
            );
        }

        if ($newPosition === null) {
            throw new BadStateException('collection', 'When adding items to dynamic collections, position is mandatory.');
        }

        return $this->incrementItemPositions($collection, $newPosition);
    }
private function createItemPosition ( Collection $ collection , ? int $ newPosition ) : int { if ( ! $ this -> isCollectionDynamic ( $ collection ) ) { return $ this -> positionHelper -> createPosition ( $ this -> getPositionHelperItemConditions ( $ collection -> id , $ collection -> status ) , $ newPosition ) ; } if ( $ newPosition === null ) { throw new BadStateException ( 'collection' , 'When adding items to dynamic collections, position is mandatory.' ) ; } return $ this -> incrementItemPositions ( $ collection , $ newPosition ) ; }
Creates space for a new manual item by shifting positions of other items
below the new position.

In case of a manual collection, the case is simple, all items below the position
are incremented.

In case of a dynamic collection, the items below are incremented, but only up
until the first break in positions.
Creates space for a new manual item by shifting positions of other items below the new position .