Add `never` return type to redirect methods

This commit is contained in:
Yonas Habteab 2023-09-07 15:16:22 +02:00 committed by Johannes Meyer
parent 36d4e6db29
commit ab96f66e72
3 changed files with 20 additions and 30 deletions

View File

@ -413,6 +413,13 @@ class ActionController extends Zend_Controller_Action
return $this->getRequest()->isXmlHttpRequest();
}
/**
* Issue a redirect that's performed with XHR by the client
*
* @param Url|string $url
*
* @return never
*/
protected function redirectXhr($url)
{
$response = $this->getResponse();
@ -428,6 +435,15 @@ class ActionController extends Zend_Controller_Action
$response->redirectAndExit($url);
}
/**
* Issue a redirect that's performed as a native HTTP request by the client
*
* This will effectively reload the window
*
* @param Url|string $url
*
* @return never
*/
protected function redirectHttp($url)
{
if ($this->isXhr()) {
@ -441,6 +457,8 @@ class ActionController extends Zend_Controller_Action
* Redirect to a specific url, updating the browsers URL field
*
* @param Url|string $url The target to redirect to
*
* @return never
**/
public function redirectNow($url)
{

View File

@ -393,6 +393,8 @@ class Response extends Zend_Controller_Response_Http
* Redirect to the given URL and exit immediately
*
* @param string|Url $url
*
* @return never
*/
public function redirectAndExit($url)
{

View File

@ -12060,36 +12060,11 @@ parameters:
count: 1
path: library/Icinga/Web/Controller/ActionController.php
-
message: "#^Method Icinga\\\\Web\\\\Controller\\\\ActionController\\:\\:redirectHttp\\(\\) has no return type specified\\.$#"
count: 1
path: library/Icinga/Web/Controller/ActionController.php
-
message: "#^Method Icinga\\\\Web\\\\Controller\\\\ActionController\\:\\:redirectHttp\\(\\) has parameter \\$url with no type specified\\.$#"
count: 1
path: library/Icinga/Web/Controller/ActionController.php
-
message: "#^Method Icinga\\\\Web\\\\Controller\\\\ActionController\\:\\:redirectNow\\(\\) has no return type specified\\.$#"
count: 1
path: library/Icinga/Web/Controller/ActionController.php
-
message: "#^Method Icinga\\\\Web\\\\Controller\\\\ActionController\\:\\:redirectToLogin\\(\\) has no return type specified\\.$#"
count: 1
path: library/Icinga/Web/Controller/ActionController.php
-
message: "#^Method Icinga\\\\Web\\\\Controller\\\\ActionController\\:\\:redirectXhr\\(\\) has no return type specified\\.$#"
count: 1
path: library/Icinga/Web/Controller/ActionController.php
-
message: "#^Method Icinga\\\\Web\\\\Controller\\\\ActionController\\:\\:redirectXhr\\(\\) has parameter \\$url with no type specified\\.$#"
count: 1
path: library/Icinga/Web/Controller/ActionController.php
-
message: "#^Method Icinga\\\\Web\\\\Controller\\\\ActionController\\:\\:reloadCss\\(\\) has no return type specified\\.$#"
count: 1
@ -13785,11 +13760,6 @@ parameters:
count: 1
path: library/Icinga/Web/Response.php
-
message: "#^Method Icinga\\\\Web\\\\Response\\:\\:redirectAndExit\\(\\) has no return type specified\\.$#"
count: 1
path: library/Icinga/Web/Response.php
-
message: "#^Method Icinga\\\\Web\\\\Response\\:\\:sendCookies\\(\\) has no return type specified\\.$#"
count: 1