private function changeValueInYaml($value)
    {
        $originalVal = $this->getCurrentData();

        $endValuePosition = $this->findEndPositionOfValue($originalVal);

        $newYamlValue = $this->convertToYaml($value);
        if (!\is_array($originalVal) && \is_array($value)) {
            // we're converting from a scalar to a (multiline) array
            // this means we need to break onto the next line

            // increase the indentation
            $this->manuallyIncrementIndentation();
            $newYamlValue = "\n".$this->indentMultilineYamlArray($newYamlValue);
        } else {
            // empty space between key & value
            $newYamlValue = ' '.$newYamlValue;
        }
        $newContents = substr($this->contents, 0, $this->currentPosition)
            .$newYamlValue
            .substr($this->contents, $endValuePosition);

        $newPosition = $this->currentPosition + \strlen($newYamlValue);

        $newData = $this->currentData;
        $newData = $this->setValueAtCurrentPath($value, $newData);

        $this->updateContents(
            $newContents,
            $newData,
            $newPosition
        );
    }