public static function checkSymlink($symlinkTarget, $symlinkName, $forceSymlink = false)
    {
        if ($forceSymlink && file_exists($symlinkName) && !is_link($symlinkName)) {
            if ('link' !== filetype($symlinkName)) {
                throw new \UnexpectedValueException("{$symlinkName} exists and is not a link");
            }
        } elseif (is_link($symlinkName)) {
            $linkTarget = readlink($symlinkName);
            if ($linkTarget !== $symlinkTarget) {
                if (!$forceSymlink) {
                    throw new \UnexpectedValueException(
                        "Symlink '{$symlinkName}' points to '{$linkTarget}' instead of '{$symlinkTarget}'"
                    );
                }
                unlink($symlinkName);

                return false;
            }

            return true;
        }

        return false;
    }