framework/web/Session.php
public function regenerateID($deleteOldSession = false)
    {
        if ($this->getIsActive()) {
            // add @ to inhibit possible warning due to race condition
            // https://github.com/yiisoft/yii2/pull/1812
            if (YII_DEBUG && !headers_sent()) {
                session_regenerate_id($deleteOldSession);
            } else {
                @session_regenerate_id($deleteOldSession);
            }
        }
    }
public function regenerateID($deleteOldSession = false)
    {
        if ($this->getIsActive()) {
            // add @ to inhibit possible warning due to race condition
            // https://github.com/yiisoft/yii2/pull/1812
            if (YII_DEBUG && !headers_sent()) {
                session_regenerate_id($deleteOldSession);
            } else {
                @session_regenerate_id($deleteOldSession);
            }
        }
    }
Updates the current session ID with a newly generated one.

Please refer to <https://secure.php.net/session_regenerate_id> for more details.

This method has no effect when session is not [[getIsActive()|active]].
Make sure to call [[open()]] before calling it.

@param bool $deleteOldSession Whether to delete the old associated session file or not.
@see open()
@see isActive