Passed
Push — master ( aa1cc2...059b9c )
by butschster
14:47 queued 03:34
created
src/Serializer/src/Bootloader/SerializerBootloader.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         private readonly ConfiguratorInterface $config,
33 33
         private readonly ContainerInterface $container,
34 34
         private readonly FactoryInterface $factory
35
-    ) {
35
+    ){
36 36
     }
37 37
 
38 38
     public function init(EnvironmentInterface $env): void
@@ -58,7 +58,7 @@  discard block
 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
             $serializers['proto'] = new ProtoSerializer();
63 63
         }
64 64
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      * @throws \Psr\Container\ContainerExceptionInterface
73 73
      * @throws \Psr\Container\NotFoundExceptionInterface
74 74
      */
75
-    private function wire(string|Autowire|SerializerInterface $serializer): SerializerInterface
75
+    private function wire(string | Autowire | SerializerInterface $serializer): SerializerInterface
76 76
     {
77 77
         return match (true) {
78 78
             $serializer instanceof SerializerInterface => $serializer,
Please login to merge, or discard this 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 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 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
         \Spiral\Tests\Serializer\Fixture\GPBMetadata\Service::initOnce();
32 32
         parent::__construct($data);
33 33
     }
Please login to merge, or discard this 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.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 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
         \Spiral\Tests\Serializer\Fixture\GPBMetadata\Service::initOnce();
32 32
         parent::__construct($data);
33 33
     }
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      */
49 49
     public function setUrl($var)
50 50
     {
51
-        GPBUtil::checkString($var, True);
51
+        GPBUtil::checkString($var, true);
52 52
         $this->url = $var;
53 53
 
54 54
         return $this;
Please login to merge, or discard this patch.
src/Serializer/src/Serializer/ProtoSerializer.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  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
             throw new SerializerException('Package `google/protobuf` is not installed.');
19 19
         }
20 20
     }
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
     /**
23 23
      * @throws InvalidArgumentException
24 24
      */
25
-    public function serialize(mixed $payload): string|\Stringable
25
+    public function serialize(mixed $payload): string | \Stringable
26 26
     {
27
-        if (!$payload instanceof Message) {
27
+        if (!$payload instanceof Message){
28 28
             throw new InvalidArgumentException(\sprintf(
29 29
                 'Payload must be of type `%s`, received `%s`.',
30 30
                 Message::class,
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
      * @throws UnserializeException
40 40
      * @throws InvalidArgumentException
41 41
      */
42
-    public function unserialize(\Stringable|string $payload, object|string|null $type = null): mixed
42
+    public function unserialize(\Stringable | string $payload, object | string | null $type = null): mixed
43 43
     {
44
-        if (\is_object($type)) {
44
+        if (\is_object($type)){
45 45
             $type = $type::class;
46 46
         }
47 47
 
48
-        if ($type === null || !\class_exists($type) || !\is_a($type, Message::class, true)) {
48
+        if ($type === null || !\class_exists($type) || !\is_a($type, Message::class, true)){
49 49
             throw new InvalidArgumentException(\sprintf(
50 50
                 'Parameter `$type` must be of type: `%s`, received `%s`.',
51 51
                 Message::class,
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 
56 56
         $object = new $type();
57 57
 
58
-        try {
59
-            $object->mergeFromString((string) $payload);
60
-        } catch (\Throwable $e) {
58
+        try{
59
+            $object->mergeFromString((string)$payload);
60
+        }catch (\Throwable $e){
61 61
             throw new UnserializeException(
62 62
                 \sprintf('Failed to unserialize data: %s', $e->getMessage()),
63 63
                 $e->getCode(),
Please login to merge, or discard this 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.