diff --git a/src/Whoops/Exception/Frame.php b/src/Whoops/Exception/Frame.php index a97268e..d9af4d1 100644 --- a/src/Whoops/Exception/Frame.php +++ b/src/Whoops/Exception/Frame.php @@ -159,6 +159,7 @@ class Frame implements Serializable * Get one line for this file, starting at line 10 (zero-indexed, remember!) * $frame->getFileLines(9, 1); // array( 10 => '...', 11 => '...') * + * @throws InvalidArgumentException if $length is less than or equal to 0 * @param int $start * @param int $length * @return string[]|null diff --git a/src/Whoops/Handler/CallbackHandler.php b/src/Whoops/Handler/CallbackHandler.php index 9350d29..b039be8 100644 --- a/src/Whoops/Handler/CallbackHandler.php +++ b/src/Whoops/Handler/CallbackHandler.php @@ -21,6 +21,7 @@ class CallbackHandler extends Handler protected $callable; /** + * @throws InvalidArgumentException If argument is not callable * @param callable $callable */ public function __construct($callable) diff --git a/src/Whoops/Handler/Handler.php b/src/Whoops/Handler/Handler.php index be2e2c7..b8c968d 100644 --- a/src/Whoops/Handler/Handler.php +++ b/src/Whoops/Handler/Handler.php @@ -25,12 +25,12 @@ abstract class Handler implements HandlerInterface const QUIT = 0x30; /** - * @var Whoops\Run + * @var Run */ private $run; /** - * @var Whoops\Exception\Inspector $inspector + * @var Inspector $inspector */ private $inspector; @@ -40,7 +40,7 @@ abstract class Handler implements HandlerInterface private $exception; /** - * @param Whoops\Run $run + * @param Run $run */ public function setRun(Run $run) { @@ -48,7 +48,7 @@ abstract class Handler implements HandlerInterface } /** - * @return Whoops\Run + * @return Run */ protected function getRun() { @@ -56,7 +56,7 @@ abstract class Handler implements HandlerInterface } /** - * @param Whoops\Exception\Inspector $inspector + * @param Inspector $inspector */ public function setInspector(Inspector $inspector) { @@ -64,7 +64,7 @@ abstract class Handler implements HandlerInterface } /** - * @return Whoops\Run + * @return Run */ protected function getInspector() { diff --git a/src/Whoops/Handler/HandlerInterface.php b/src/Whoops/Handler/HandlerInterface.php index 80169f3..abb4078 100644 --- a/src/Whoops/Handler/HandlerInterface.php +++ b/src/Whoops/Handler/HandlerInterface.php @@ -17,7 +17,7 @@ interface HandlerInterface public function handle(); /** - * @param Whoops\Run $run + * @param Run $run */ public function setRun(Run $run); @@ -27,7 +27,7 @@ interface HandlerInterface public function setException(Exception $exception); /** - * @param Whoops\Exception\Inspector $run + * @param Inspector $inspector */ public function setInspector(Inspector $inspector); } diff --git a/src/Whoops/Handler/JsonResponseHandler.php b/src/Whoops/Handler/JsonResponseHandler.php index f34ea6b..80952d2 100644 --- a/src/Whoops/Handler/JsonResponseHandler.php +++ b/src/Whoops/Handler/JsonResponseHandler.php @@ -52,7 +52,8 @@ class JsonResponseHandler extends Handler /** * Check, if possible, that this execution was triggered by an AJAX request. - * @param bool + * + * @return bool */ private function isAjaxRequest() { diff --git a/src/Whoops/Handler/PrettyPageHandler.php b/src/Whoops/Handler/PrettyPageHandler.php index 77dc587..489dcbd 100644 --- a/src/Whoops/Handler/PrettyPageHandler.php +++ b/src/Whoops/Handler/PrettyPageHandler.php @@ -164,6 +164,8 @@ class PrettyPageHandler extends Handler * The supplied callback argument will be called when the error is rendered, * it should produce a simple associative array. Any nested arrays will * be flattened with print_r. + * + * @throws InvalidArgumentException If $callback is not callable * @param string $label * @param callable $callback Callable returning an associative array */ @@ -235,6 +237,7 @@ class PrettyPageHandler extends Handler * @example * $run->setEditor('sublime'); * + * @throws InvalidArgumentException If invalid argument identifier provided * @param string|callable $editor */ public function setEditor($editor) @@ -255,9 +258,10 @@ class PrettyPageHandler extends Handler * a string that may be used as the href property for that * file reference. * + * @throws InvalidArgumentException If editor resolver does not return a string * @param string $filePath * @param int $line - * @return string|false + * @return string|bool */ public function getEditorHref($filePath, $line) { @@ -313,6 +317,7 @@ class PrettyPageHandler extends Handler } /** + * @throws InvalidArgumentException If argument is not a valid directory * @param string $resourcesPath */ public function setResourcesPath($resourcesPath) diff --git a/src/Whoops/Provider/Phalcon/WhoopsServiceProvider.php b/src/Whoops/Provider/Phalcon/WhoopsServiceProvider.php index 40b9360..deae9cf 100644 --- a/src/Whoops/Provider/Phalcon/WhoopsServiceProvider.php +++ b/src/Whoops/Provider/Phalcon/WhoopsServiceProvider.php @@ -14,7 +14,7 @@ use Phalcon\DI\Exception; class WhoopsServiceProvider { /** - * @param Phalcon\DI $di + * @param DI $di */ public function __construct(DI $di = null) { diff --git a/src/Whoops/Provider/Silex/WhoopsServiceProvider.php b/src/Whoops/Provider/Silex/WhoopsServiceProvider.php index 238ab82..8ce04b7 100644 --- a/src/Whoops/Provider/Silex/WhoopsServiceProvider.php +++ b/src/Whoops/Provider/Silex/WhoopsServiceProvider.php @@ -14,8 +14,7 @@ use RuntimeException; class WhoopsServiceProvider implements ServiceProviderInterface { /** - * @see Silex\ServiceProviderInterface::register - * @param Silex\Application $app + * @param Application $app */ public function register(Application $app) { diff --git a/src/Whoops/Resources/pretty-template.php b/src/Whoops/Resources/pretty-template.php index 75feb18..8d16a01 100644 --- a/src/Whoops/Resources/pretty-template.php +++ b/src/Whoops/Resources/pretty-template.php @@ -3,7 +3,9 @@ * Template file for Whoops's pretty error output. * Check the $v global variable (stdClass) for what's available * to work with. -* @var $v +* @var stdClass $v +* @var callable $e +* @var callable $slug */ ?> @@ -97,7 +99,14 @@ ?>
$comment): ?> - +
diff --git a/src/Whoops/Run.php b/src/Whoops/Run.php index 412be30..888bb85 100644 --- a/src/Whoops/Run.php +++ b/src/Whoops/Run.php @@ -24,16 +24,18 @@ class Run protected $sendOutput = true; /** - * @var Whoops\Handler\HandlerInterface[] + * @var HandlerInterface[] */ protected $handlerStack = array(); protected $silencedPatterns = array(); /** - * Pushes a handler to the end of the stack. - * @param Whoops\HandlerInterface $handler - * @return Whoops\Run + * Pushes a handler to the end of the stack + * + * @throws InvalidArgumentException If argument is not callable or instance of HandlerInterface + * @param HandlerInterface $handler + * @return Run */ public function pushHandler($handler) { @@ -55,7 +57,7 @@ class Run /** * Removes the last handler in the stack and returns it. * Returns null if there's nothing else to pop. - * @return null|Whoops\Handler\HandlerInterface + * @return null|HandlerInterface */ public function popHandler() { @@ -75,7 +77,7 @@ class Run /** * Clears all handlers in the handlerStack, including * the default PrettyPage handler. - * @return Whoops\Run + * @return Run */ public function clearHandlers() { @@ -85,7 +87,7 @@ class Run /** * @param Exception $exception - * @return Whoops\Exception\Inspector + * @return Inspector */ protected function getInspector(Exception $exception) { @@ -94,7 +96,7 @@ class Run /** * Registers this instance as an error handler. - * @return Whoops\Run + * @return Run */ public function register() { @@ -111,7 +113,7 @@ class Run /** * Unregisters all handlers registered by this Whoops\Run instance - * @return Whoops\Run + * @return Run */ public function unregister() { @@ -165,7 +167,7 @@ class Run /** * Should Whoops push output directly to the client? * If this is false, output will be returned by handleException - * @param bool|num $send + * @param bool|int $send * @return bool */ public function writeToOutput($send = null) @@ -195,6 +197,9 @@ class Run // or return it silently. ob_start(); + // Just in case there are no handlers: + $handlerResponse = null; + for($i = count($this->handlerStack) - 1; $i >= 0; $i--) { $handler = $this->handlerStack[$i]; @@ -249,6 +254,8 @@ class Run * @param string $message * @param string $file * @param int $line + * + * @return bool */ public function handleError($level, $message, $file = null, $line = null) {