code: protected function regenerateCsrfToken()
      {
          $request = Yii::$app->getRequest();
          if ($request->enableCsrfCookie || $this->enableSession) {
              $request->getCsrfToken(true);
          }
      }
docs: Regenerates CSRF token
  
  @since 2.0.14.2