Kleine Code-Verbesserungen.

This commit is contained in:
2021-04-06 21:33:33 +02:00
parent 520db45d6d
commit a6675605e4
2 changed files with 10 additions and 3 deletions
@@ -1,4 +1,4 @@
<?php <?php /** @noinspection PhpMissingFieldTypeInspection */
namespace TorstenHettstedt\TimekeepingApi\Controller; namespace TorstenHettstedt\TimekeepingApi\Controller;
+9 -2
View File
@@ -1,9 +1,10 @@
<?php <?php /** @noinspection PhpUndefinedClassInspection */
namespace TorstenHettstedt\TimekeepingApi\Middleware; namespace TorstenHettstedt\TimekeepingApi\Middleware;
use JetBrains\PhpStorm\ArrayShape;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
@@ -30,7 +31,13 @@ class ErrorHandler
* *
* @return mixed[] * @return mixed[]
*/ */
protected function buildJsonArray(Throwable $exception): array #[ArrayShape([
'timestamp' => "false|string",
'status' => "int",
"error" => "string",
'message' => "string",
'path' => "string"
])] protected function buildJsonArray(Throwable $exception): array
{ {
$payload = [ $payload = [
'timestamp' => date('Y-m-d\TH:m:sP'), 'timestamp' => date('Y-m-d\TH:m:sP'),