Skip to content

Commit

Permalink
Fix CS.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Jan 3, 2021
1 parent cfedbd9 commit e302b0f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Error/Middleware/WhoopsHandlerMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace CakephpWhoops\Error\Middleware;

use CakephpWhoops\Error\WhoopsTrait;
use Cake\Core\Configure;
use Cake\Error\Middleware\ErrorHandlerMiddleware;
use CakephpWhoops\Error\WhoopsTrait;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Throwable;
Expand All @@ -20,7 +20,7 @@ class WhoopsHandlerMiddleware extends ErrorHandlerMiddleware {

use WhoopsTrait;

const PHP_SAPI_CLI = 'cli';
public const PHP_SAPI_CLI = 'cli';

/**
* @param \Throwable $exception The exception to handle.
Expand Down
4 changes: 3 additions & 1 deletion src/Error/WhoopsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class WhoopsHandler extends ErrorHandler {
protected function _displayError(array $error, bool $debug): void {
if (!$debug) {
parent::_displayError($error, $debug);

return;
}

Expand All @@ -31,12 +32,13 @@ protected function _displayError(array $error, bool $debug): void {

/**
* @param \Throwable $exception The exception to display.
* @return void
* @throws \Exception When the chosen exception renderer is invalid.
* @return void
*/
protected function _displayException(Throwable $exception): void {
if (!Configure::read('debug')) {
parent::_displayException($exception);

return;
}

Expand Down
4 changes: 3 additions & 1 deletion src/Error/WhoopsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ protected function getWhoopsInstance(): Run {
if (empty($this->_whoops)) {
$this->_whoops = new Run();
}

return $this->_whoops;
}

/**
* @return \Whoops\Handler\PrettyPageHandler
*/
protected function getHandler(): HandlerInterface {
protected function getHandler(): HandlerInterface {
$handler = new PrettyPageHandler();
if (!Configure::read('Whoops.editor')) {
return $handler;
Expand All @@ -44,6 +45,7 @@ protected function getHandler(): HandlerInterface {
if (!Configure::read('Whoops.asAjax', false)) {
return $url;
}

return [
'url' => $url,
'ajax' => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace CakephpWhoops\Test\TestCase\Error\Middleware;

use CakephpWhoops\Error\Middleware\WhoopsHandlerMiddleware;
use Cake\TestSuite\TestCase;
use CakephpWhoops\Error\Middleware\WhoopsHandlerMiddleware;

/**
* Error handling middleware.
Expand Down

0 comments on commit e302b0f

Please sign in to comment.