mirror of
https://github.com/CachetHQ/Cachet.git
synced 2025-04-20 07:22:05 +02:00
Update exception displayers
This commit is contained in:
parent
726ded7746
commit
5f1a624cb9
@ -29,7 +29,7 @@ class JsonValidationDisplayer extends JsonDisplayer implements DisplayerInterfac
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function display(Exception $exception, $id, $code, array $headers)
|
||||
public function display(Exception $exception, string $id, int $code, array $headers)
|
||||
{
|
||||
$info = $this->info->generate($exception, $id, 400);
|
||||
|
||||
@ -47,7 +47,7 @@ class JsonValidationDisplayer extends JsonDisplayer implements DisplayerInterfac
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function canDisplay(Exception $original, Exception $transformed, $code)
|
||||
public function canDisplay(Exception $original, Exception $transformed, int $code)
|
||||
{
|
||||
return $transformed instanceof ValidationException;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ class MaintenanceDisplayer implements DisplayerInterface
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function display(Exception $exception, $id, $code, array $headers)
|
||||
public function display(Exception $exception, string $id, int $code, array $headers)
|
||||
{
|
||||
return new Response($this->render(), $code, array_merge($headers, ['Content-Type' => $this->contentType()]));
|
||||
}
|
||||
@ -87,7 +87,7 @@ class MaintenanceDisplayer implements DisplayerInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function canDisplay(Exception $original, Exception $transformed, $code)
|
||||
public function canDisplay(Exception $original, Exception $transformed, int $code)
|
||||
{
|
||||
return $transformed instanceof MaintenanceModeException;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ class RedirectDisplayer implements DisplayerInterface
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function display(Exception $exception, $id, $code, array $headers)
|
||||
public function display(Exception $exception, string $id, int $code, array $headers)
|
||||
{
|
||||
return redirect()->guest('auth/login');
|
||||
}
|
||||
@ -71,7 +71,7 @@ class RedirectDisplayer implements DisplayerInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function canDisplay(Exception $original, Exception $transformed, $code)
|
||||
public function canDisplay(Exception $original, Exception $transformed, int $code)
|
||||
{
|
||||
$redirect = $transformed instanceof HttpExceptionInterface && $transformed->getStatusCode() === 401;
|
||||
|
||||
|
@ -47,7 +47,7 @@ class ThrottleDisplayer implements DisplayerInterface
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function display(Exception $exception, $id, $code, array $headers)
|
||||
public function display(Exception $exception, string $id, int $code, array $headers)
|
||||
{
|
||||
return cachet_redirect('auth.login')->withError(trans('forms.login.rate-limit'));
|
||||
}
|
||||
@ -71,7 +71,7 @@ class ThrottleDisplayer implements DisplayerInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function canDisplay(Exception $original, Exception $transformed, $code)
|
||||
public function canDisplay(Exception $original, Exception $transformed, int $code)
|
||||
{
|
||||
return $transformed instanceof TooManyRequestsHttpException && $this->request->is('auth*');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user