diff --git a/src/controllers/RedirectsController.php b/src/controllers/RedirectsController.php index 84e80d9b..4e6b2fef 100644 --- a/src/controllers/RedirectsController.php +++ b/src/controllers/RedirectsController.php @@ -23,6 +23,7 @@ use nystudio107\retour\helpers\Permission as PermissionHelper; use nystudio107\retour\models\StaticRedirects as StaticRedirectsModel; use nystudio107\retour\Retour; +use Throwable; use yii\base\Exception; use yii\base\InvalidConfigException; use yii\web\BadRequestHttpException; @@ -122,7 +123,8 @@ public function actionEditRedirect( string $defaultUrl = '', int $siteId = 0, StaticRedirectsModel $redirect = null, - ): Response { + ): Response + { $variables = []; PermissionHelper::controllerPermissionCheck('retour:redirects'); @@ -270,12 +272,11 @@ public function actionSaveRedirect(): ?Response if (!$redirect->validate()) { Craft::$app->getSession()->setError(Craft::t('app', "Couldn't save redirect settings.")); // Send the redirect back to the template + /** @var UrlManager $urlManager */ $urlManager = Craft::$app->getUrlManager(); - if ($urlManager instanceof UrlManager) { - $urlManager->setRouteParams([ - 'redirect' => $redirect, - ]); - } + $urlManager->setRouteParams([ + 'redirect' => $redirect, + ]); return null; } @@ -290,12 +291,11 @@ public function actionSaveRedirect(): ?Response if ($testRedirectConfig === null) { Craft::$app->getSession()->setError(Craft::t('app', "Couldn't save redirect settings because it'd create a redirect loop.")); // Send the redirect back to the template + /** @var UrlManager $urlManager */ $urlManager = Craft::$app->getUrlManager(); - if ($urlManager instanceof UrlManager) { - $urlManager->setRouteParams([ - 'redirect' => $redirect, - ]); - } + $urlManager->setRouteParams([ + 'redirect' => $redirect, + ]); return null; } @@ -312,8 +312,8 @@ public function actionSaveRedirect(): ?Response * @param string|null $siteHandle * * @return Response - * @throws \yii\web\ForbiddenHttpException - * @throws \yii\web\NotFoundHttpException + * @throws ForbiddenHttpException + * @throws NotFoundHttpException */ public function actionShortlinks(string $siteHandle = null): Response { @@ -366,7 +366,7 @@ public function actionShortlinks(string $siteHandle = null): Response * @throws BadRequestHttpException * @throws ForbiddenHttpException * @throws MissingComponentException - * @throws \Throwable + * @throws Throwable * @throws ElementNotFoundException * @throws Exception */ diff --git a/src/controllers/SettingsController.php b/src/controllers/SettingsController.php index c1367d43..943c0415 100644 --- a/src/controllers/SettingsController.php +++ b/src/controllers/SettingsController.php @@ -129,12 +129,11 @@ public function actionSavePluginSettings(): ?Response Craft::$app->getSession()->setError(Craft::t('app', "Couldn't save plugin settings.")); // Send the plugin back to the template + /** @var UrlManager $urlManager */ $urlManager = Craft::$app->getUrlManager(); - if ($urlManager instanceof UrlManager) { - $urlManager->setRouteParams([ - 'plugin' => $plugin, - ]); - } + $urlManager->setRouteParams([ + 'plugin' => $plugin, + ]); return null; }