Browse Source

Update signatures.

mscherer 3 years ago
parent
commit
6ba6c97176

+ 5 - 3
src/Error/ErrorHandlerTrait.php

@@ -22,6 +22,8 @@ use Cake\Routing\Exception\MissingRouteException;
 use Cake\View\Exception\MissingTemplateException;
 use Cake\View\Exception\MissingViewException;
 use InvalidArgumentException;
+use Psr\Http\Message\ServerRequestInterface;
+use Throwable;
 
 /**
  * @property array $_options
@@ -34,7 +36,7 @@ trait ErrorHandlerTrait {
 	 *
 	 * @var array<string>
 	 */
-	protected static $blacklist = [
+	protected static array $blacklist = [
 		InvalidPrimaryKeyException::class,
 		InvalidArgumentException::class,
 		NotFoundException::class,
@@ -61,7 +63,7 @@ trait ErrorHandlerTrait {
 	 *
 	 * @var array<string>
 	 */
-	protected static $evenWithReferer = [
+	protected static array $evenWithReferer = [
 		AuthSecurityException::class,
 	];
 
@@ -70,7 +72,7 @@ trait ErrorHandlerTrait {
 	 * @param \Psr\Http\Message\ServerRequestInterface|null $request
 	 * @return bool
 	 */
-	protected function is404($exception, $request = null): bool {
+	protected function is404(Throwable $exception, ?ServerRequestInterface $request = null): bool {
 		$blacklist = static::$blacklist;
 		if (isset($this->_options['log404'])) {
 			$blacklist = (array)$this->_options['log404'];

+ 2 - 1
src/Error/Middleware/ErrorHandlerMiddleware.php

@@ -3,6 +3,7 @@
 namespace Tools\Error\Middleware;
 
 use Cake\Core\Configure;
+use Cake\Error\ExceptionTrap as ErrorExceptionTrap;
 use Cake\Error\Middleware\ErrorHandlerMiddleware as CoreErrorHandlerMiddleware;
 use Tools\Error\ExceptionTrap;
 
@@ -15,7 +16,7 @@ class ErrorHandlerMiddleware extends CoreErrorHandlerMiddleware {
 	 * @param \Cake\Error\ExceptionTrap|array $exceptionTrap The error handler instance
 	 *  or config array.
 	 */
-	public function __construct($exceptionTrap = []) {
+	public function __construct(ErrorExceptionTrap|array $exceptionTrap = []) {
 		if (is_array($exceptionTrap)) {
 			$exceptionTrap += (array)Configure::read('Error');
 		}