Skip to content

Commit 6cb8862

Browse files
removed symfony/serializer
1 parent b0fd052 commit 6cb8862

File tree

5 files changed

+11
-128
lines changed

5 files changed

+11
-128
lines changed

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"symfony/messenger": "6.0.*",
2020
"symfony/proxy-manager-bridge": "6.0.*",
2121
"symfony/runtime": "6.0.*",
22-
"symfony/serializer": "6.0.*",
2322
"symfony/uid": "6.0.*",
2423
"symfony/yaml": "6.0.*"
2524
},

composer.lock

Lines changed: 1 addition & 102 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Core/EventListener/BuiltInEventsSubscriber.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function onKernelException(ExceptionEvent $event)
1414
{
1515
}
1616

17-
public static function getSubscribedEvents()
17+
public static function getSubscribedEvents(): array
1818
{
1919
return [
2020
KernelEvents::EXCEPTION => 'onKernelException',

src/Core/EventListener/ExceptionListener.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
use Symfony\Component\HttpFoundation\Response;
99
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
1010
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
11-
use Symfony\Component\Serializer\Encoder\JsonEncoder;
12-
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
13-
use Symfony\Component\Serializer\Serializer;
1411

1512
class ExceptionListener
1613
{
@@ -40,11 +37,14 @@ public function onKernelException(ExceptionEvent $event): void
4037

4138
public function exceptionToJson(\Throwable $exception): string
4239
{
43-
// Испольузем Serializer для преобразования объекта в JSON
44-
$encoders = [new JsonEncoder()];
45-
$normalizers = [new ObjectNormalizer()];
46-
$serializer = new Serializer($normalizers, $encoders);
47-
48-
return $serializer->serialize($exception, 'json');
40+
return json_encode(
41+
[
42+
'message' => $exception->getMessage(),
43+
'code' => $exception->getCode(),
44+
'file' => $exception->getFile(),
45+
'line' => $exception->getLine(),
46+
'trace' => $exception->getTraceAsString(),
47+
]
48+
);
4949
}
5050
}

symfony.lock

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,6 @@
173173
"php-cs-fixer/diff": {
174174
"version": "v2.0.2"
175175
},
176-
"phpdocumentor/reflection-common": {
177-
"version": "2.2.0"
178-
},
179-
"phpdocumentor/reflection-docblock": {
180-
"version": "5.3.0"
181-
},
182-
"phpdocumentor/type-resolver": {
183-
"version": "1.6.0"
184-
},
185176
"phpspec/prophecy": {
186177
"version": "v1.15.0"
187178
},
@@ -480,9 +471,6 @@
480471
"symfony/security-http": {
481472
"version": "v6.0.5"
482473
},
483-
"symfony/serializer": {
484-
"version": "v6.0.12"
485-
},
486474
"symfony/service-contracts": {
487475
"version": "v3.0.0"
488476
},
@@ -506,8 +494,5 @@
506494
},
507495
"theseer/tokenizer": {
508496
"version": "1.2.1"
509-
},
510-
"webmozart/assert": {
511-
"version": "1.10.0"
512497
}
513498
}

0 commit comments

Comments
 (0)