Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2018-07-30 08:47:27 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2018-07-30 08:47:27 +0300
commit251b3b3e58c0b636e0f5346ae6d67a8c93fc39af (patch)
treea093d21bb74e22cc283cf714703504670281944f /lib/Http/Middleware
parent1946edcc3d75db8740900e4c2de8b147e0b6b601 (diff)
Make OCA\Mail\Http strict
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/Http/Middleware')
-rw-r--r--lib/Http/Middleware/ErrorMiddleware.php16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/Http/Middleware/ErrorMiddleware.php b/lib/Http/Middleware/ErrorMiddleware.php
index d4ab17205..beffecfb5 100644
--- a/lib/Http/Middleware/ErrorMiddleware.php
+++ b/lib/Http/Middleware/ErrorMiddleware.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* @copyright 2017 Christoph Wurst <christoph@winzerhof-wurst.at>
*
@@ -32,6 +34,7 @@ use OCA\Mail\Service\Logger;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Http;
+use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Middleware;
use OCP\AppFramework\Utility\IControllerMethodReflector;
use OCP\IConfig;
@@ -53,7 +56,7 @@ class ErrorMiddleware extends Middleware {
* @param IControllerMethodReflector $reflector
*/
public function __construct(IConfig $config, Logger $logger,
- IControllerMethodReflector $reflector) {
+ IControllerMethodReflector $reflector) {
$this->config = $config;
$this->logger = $logger;
$this->reflector = $reflector;
@@ -63,7 +66,8 @@ class ErrorMiddleware extends Middleware {
* @param Controller $controller
* @param string $methodName
* @param Exception $exception
- * @return JSONResponse
+ * @return Response
+ * @throws Exception
*/
public function afterException($controller, $methodName, Exception $exception) {
if (!$this->reflector->hasAnnotation('TrapError')) {
@@ -73,7 +77,7 @@ class ErrorMiddleware extends Middleware {
if ($exception instanceof ClientException) {
return new JSONResponse([
'message' => $exception->getMessage()
- ], Http::STATUS_BAD_REQUEST);
+ ], Http::STATUS_BAD_REQUEST);
} else if ($exception instanceof DoesNotExistException) {
return new JSONResponse([], Http::STATUS_NOT_FOUND);
} else if ($exception instanceof NotImplemented) {
@@ -86,15 +90,15 @@ class ErrorMiddleware extends Middleware {
'message' => $exception->getMessage(),
'code' => $exception->getCode(),
'trace' => $this->filterTrace($exception->getTrace()),
- ], Http::STATUS_INTERNAL_SERVER_ERROR);
+ ], Http::STATUS_INTERNAL_SERVER_ERROR);
} else {
return new JSONResponse([], Http::STATUS_INTERNAL_SERVER_ERROR);
}
}
}
- private function filterTrace(array $original) {
- return array_map(function(array $row) {
+ private function filterTrace(array $original): array {
+ return array_map(function (array $row) {
return array_intersect_key($row,
array_flip(['file', 'line', 'function', 'class']));
}, $original);