Passed
Pull Request — master (#1031)
by Maxim
23:38
created
src/Serializer/src/Bootloader/SerializerBootloader.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,8 @@
 block discarded – undo
58 58
             'json' => new JsonSerializer(),
59 59
             'serializer' => new PhpSerializer(),
60 60
         ];
61
-        if (\class_exists(Message::class)) {
61
+        if (\class_exists(Message::class))
62
+        {
62 63
             $serializers['proto'] = new ProtoSerializer();
63 64
         }
64 65
 
Please login to merge, or discard this patch.
src/Serializer/tests/Fixture/PingRequest.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,8 @@
 block discarded – undo
27 27
      *     @type string $url
28 28
      * }
29 29
      */
30
-    public function __construct($data = NULL) {
30
+    public function __construct($data = NULL)
31
+    {
31 32
         \Spiral\Tests\Serializer\Fixture\GPBMetadata\Service::initOnce();
32 33
         parent::__construct($data);
33 34
     }
Please login to merge, or discard this patch.
src/Serializer/src/Serializer/ProtoSerializer.php 1 patch
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,8 @@  discard block
 block discarded – undo
14 14
 {
15 15
     public function __construct()
16 16
     {
17
-        if (!\class_exists(Message::class)) {
17
+        if (!\class_exists(Message::class))
18
+        {
18 19
             throw new SerializerException('Package `google/protobuf` is not installed.');
19 20
         }
20 21
     }
@@ -24,7 +25,8 @@  discard block
 block discarded – undo
24 25
      */
25 26
     public function serialize(mixed $payload): string|\Stringable
26 27
     {
27
-        if (!$payload instanceof Message) {
28
+        if (!$payload instanceof Message)
29
+        {
28 30
             throw new InvalidArgumentException(\sprintf(
29 31
                 'Payload must be of type `%s`, received `%s`.',
30 32
                 Message::class,
@@ -41,11 +43,13 @@  discard block
 block discarded – undo
41 43
      */
42 44
     public function unserialize(\Stringable|string $payload, object|string|null $type = null): mixed
43 45
     {
44
-        if (\is_object($type)) {
46
+        if (\is_object($type))
47
+        {
45 48
             $type = $type::class;
46 49
         }
47 50
 
48
-        if ($type === null || !\class_exists($type) || !\is_a($type, Message::class, true)) {
51
+        if ($type === null || !\class_exists($type) || !\is_a($type, Message::class, true))
52
+        {
49 53
             throw new InvalidArgumentException(\sprintf(
50 54
                 'Parameter `$type` must be of type: `%s`, received `%s`.',
51 55
                 Message::class,
@@ -55,9 +59,12 @@  discard block
 block discarded – undo
55 59
 
56 60
         $object = new $type();
57 61
 
58
-        try {
62
+        try
63
+        {
59 64
             $object->mergeFromString((string) $payload);
60
-        } catch (\Throwable $e) {
65
+        }
66
+        catch (\Throwable $e)
67
+        {
61 68
             throw new UnserializeException(
62 69
                 \sprintf('Failed to unserialize data: %s', $e->getMessage()),
63 70
                 $e->getCode(),
Please login to merge, or discard this patch.