Skip to content

Commit

Permalink
Consolidate typehint decalarations around Exception.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Scherer committed Jul 16, 2015
1 parent bb5e502 commit 51e31e8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/Console/ConsoleErrorHandler.php
Expand Up @@ -16,6 +16,7 @@

use Cake\Error\BaseErrorHandler;
use Cake\Error\FatalErrorException;
use Exception;

/**
* Error Handler for Cake console. Does simple printing of the
Expand Down Expand Up @@ -61,7 +62,7 @@ public function __construct($options = [])
* @throws \Exception When renderer class not found
* @see http://php.net/manual/en/function.set-exception-handler.php
*/
public function handleException(\Exception $exception)
public function handleException(Exception $exception)
{
$this->_displayException($exception);
$this->_logException($exception);
Expand Down
7 changes: 4 additions & 3 deletions src/Error/BaseErrorHandler.php
Expand Up @@ -18,6 +18,7 @@
use Cake\Error\Debugger;
use Cake\Log\Log;
use Cake\Routing\Router;
use Exception;

/**
* Base error handler that provides logic common to the CLI + web
Expand Down Expand Up @@ -150,7 +151,7 @@ public function handleError($code, $description, $file = null, $line = null, $co
* @throws \Exception When renderer class not found
* @see http://php.net/manual/en/function.set-exception-handler.php
*/
public function handleException(\Exception $exception)
public function handleException(Exception $exception)
{
$this->_displayException($exception);
$this->_logException($exception);
Expand Down Expand Up @@ -228,7 +229,7 @@ protected function _logError($level, $data)
* @param \Exception $exception Exception instance.
* @return bool
*/
protected function _logException(\Exception $exception)
protected function _logException(Exception $exception)
{
$config = $this->_options;
if (empty($config['log'])) {
Expand All @@ -251,7 +252,7 @@ protected function _logException(\Exception $exception)
* @param \Exception $exception Exception instance
* @return string Formatted message
*/
protected function _getMessage(\Exception $exception)
protected function _getMessage(Exception $exception)
{
$config = $this->_options;
$message = sprintf(
Expand Down
8 changes: 4 additions & 4 deletions src/Error/ExceptionRenderer.php
Expand Up @@ -195,7 +195,7 @@ protected function _customMethod($method, $exception)
* @param \Exception $exception Exception instance.
* @return string
*/
protected function _method(\Exception $exception)
protected function _method(Exception $exception)
{
list(, $baseClass) = namespaceSplit(get_class($exception));

Expand All @@ -214,7 +214,7 @@ protected function _method(\Exception $exception)
* @param int $code Error code
* @return string Error message
*/
protected function _message(\Exception $exception, $code)
protected function _message(Exception $exception, $code)
{
$message = $this->error->getMessage();

Expand All @@ -239,7 +239,7 @@ protected function _message(\Exception $exception, $code)
* @param int $code Error code
* @return string Template name
*/
protected function _template(\Exception $exception, $method, $code)
protected function _template(Exception $exception, $method, $code)
{
$isHttpException = $exception instanceof HttpException;

Expand Down Expand Up @@ -274,7 +274,7 @@ protected function _template(\Exception $exception, $method, $code)
* @param \Exception $exception Exception
* @return int Error code value within range 400 to 506
*/
protected function _code(\Exception $exception)
protected function _code(Exception $exception)
{
$code = 500;
$errorCode = $exception->getCode();
Expand Down

0 comments on commit 51e31e8

Please sign in to comment.