Passed
Pull Request — master (#391)
by Kirill
04:53
created
src/Framework/Http/RrDispatcher.php 1 patch
Braces   +17 added lines, -7 removed lines patch added patch discarded remove patch
@@ -81,14 +81,20 @@  discard block
 block discarded – undo
81 81
         /** @var Http $http */
82 82
         $http = $this->container->get(Http::class);
83 83
 
84
-        while ($request = $this->worker->waitRequest()) {
85
-            try {
84
+        while ($request = $this->worker->waitRequest())
85
+        {
86
+            try
87
+            {
86 88
                 $response = $http->handle($request);
87 89
 
88 90
                 $this->worker->respond($response);
89
-            } catch (\Throwable $e) {
91
+            }
92
+            catch (\Throwable $e)
93
+            {
90 94
                 $this->worker->respond($this->errorToResponse($e));
91
-            } finally {
95
+            }
96
+            finally
97
+            {
92 98
                 $this->finalizer->finalize(false);
93 99
             }
94 100
         }
@@ -102,7 +108,8 @@  discard block
 block discarded – undo
102 108
     {
103 109
         $handler = new HtmlHandler();
104 110
 
105
-        try {
111
+        try
112
+        {
106 113
             /** @var SnapshotInterface $snapshot */
107 114
             $snapshot = $this->container->get(SnapshotterInterface::class)->register($e);
108 115
             \file_put_contents('php://stderr', $snapshot->getMessage());
@@ -110,10 +117,13 @@  discard block
 block discarded – undo
110 117
             // on demand
111 118
             $state = $this->container->get(StateInterface::class);
112 119
 
113
-            if ($state !== null) {
120
+            if ($state !== null)
121
+            {
114 122
                 $handler = $handler->withState($state);
115 123
             }
116
-        } catch (\Throwable | ContainerExceptionInterface $se) {
124
+        }
125
+        catch (\Throwable | ContainerExceptionInterface $se)
126
+        {
117 127
             \file_put_contents('php://stderr', (string)$e);
118 128
         }
119 129
 
Please login to merge, or discard this patch.
src/Framework/Debug/StateCollector/EnvironmentCollector.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,8 +43,10 @@
 block discarded – undo
43 43
     {
44 44
         $state->setTag('php', phpversion());
45 45
 
46
-        if ($this->container->has(DispatcherInterface::class)) {
47
-            switch (get_class($this->container->get(DispatcherInterface::class))) {
46
+        if ($this->container->has(DispatcherInterface::class))
47
+        {
48
+            switch (get_class($this->container->get(DispatcherInterface::class)))
49
+            {
48 50
                 case LegacyRrDispatcher::class:
49 51
                     $state->setTag('dispatcher', 'roadrunner');
50 52
                     break;
Please login to merge, or discard this patch.
src/Framework/Bootloader/Server/LegacyRoadRunnerBootloader.php 1 patch
Braces   +26 added lines, -12 removed lines patch added patch discarded remove patch
@@ -39,15 +39,18 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function boot(Container $container)
41 41
     {
42
-        $container->bindSingleton(RPC::class, function (EnvironmentInterface $env) {
42
+        $container->bindSingleton(RPC::class, function (EnvironmentInterface $env)
43
+        {
43 44
             return $this->rpc($env);
44 45
         });
45 46
 
46
-        $container->bindSingleton(Worker::class, function (EnvironmentInterface $env) {
47
+        $container->bindSingleton(Worker::class, function (EnvironmentInterface $env)
48
+        {
47 49
             return $this->worker($env);
48 50
         });
49 51
 
50
-        $container->bindSingleton(MetricsInterface::class, function (RPC $rpc) {
52
+        $container->bindSingleton(MetricsInterface::class, function (RPC $rpc)
53
+        {
51 54
             return new Metrics($rpc);
52 55
         });
53 56
     }
@@ -60,21 +63,26 @@  discard block
 block discarded – undo
60 63
     {
61 64
         $conn = $env->get('RR_RPC', self::RPC_DEFAULT);
62 65
 
63
-        if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) {
66
+        if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts))
67
+        {
64 68
             throw new BootException(
65 69
                 "Unable to configure RPC connection, invalid DSN given `{$conn}`."
66 70
             );
67 71
         }
68 72
 
69
-        if (!in_array($parts[1], ['tcp', 'unix'])) {
73
+        if (!in_array($parts[1], ['tcp', 'unix']))
74
+        {
70 75
             throw new BootException(
71 76
                 "Unable to configure RPC connection, invalid DSN given `{$conn}`."
72 77
             );
73 78
         }
74 79
 
75
-        if ($parts[1] == 'unix') {
80
+        if ($parts[1] == 'unix')
81
+        {
76 82
             $relay = new SocketRelay($parts[2], null, SocketRelay::SOCK_UNIX);
77
-        } else {
83
+        }
84
+        else
85
+        {
78 86
             $relay = new SocketRelay($parts[2], (int)$parts[3], SocketRelay::SOCK_TCP);
79 87
         }
80 88
 
@@ -89,25 +97,31 @@  discard block
 block discarded – undo
89 97
     {
90 98
         $conn = $env->get('RR_RELAY', self::WORKER_DEFAULT);
91 99
 
92
-        if ($conn === 'pipes' || empty($conn)) {
100
+        if ($conn === 'pipes' || empty($conn))
101
+        {
93 102
             return new Worker(new StreamRelay(STDIN, STDOUT));
94 103
         }
95 104
 
96
-        if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) {
105
+        if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts))
106
+        {
97 107
             throw new BootException(
98 108
                 "Unable to configure Worker connection, invalid DSN given `{$conn}`."
99 109
             );
100 110
         }
101 111
 
102
-        if (!in_array($parts[1], ['tcp', 'unix'])) {
112
+        if (!in_array($parts[1], ['tcp', 'unix']))
113
+        {
103 114
             throw new BootException(
104 115
                 "Unable to configure Worker connection, invalid DSN given `{$conn}`."
105 116
             );
106 117
         }
107 118
 
108
-        if ($parts[1] == 'unix') {
119
+        if ($parts[1] == 'unix')
120
+        {
109 121
             $relay = new SocketRelay($parts[2], null, SocketRelay::SOCK_UNIX);
110
-        } else {
122
+        }
123
+        else
124
+        {
111 125
             $relay = new SocketRelay($parts[2], (int)$parts[3], SocketRelay::SOCK_TCP);
112 126
         }
113 127
 
Please login to merge, or discard this patch.
src/Framework/Bootloader/Http/HttpBootloader.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -76,11 +76,13 @@
 block discarded – undo
76 76
 
77 77
         $kernel->addDispatcher($factory->make(SapiDispatcher::class));
78 78
 
79
-        if (class_exists(PSR7Client::class)) {
79
+        if (class_exists(PSR7Client::class))
80
+        {
80 81
             $kernel->addDispatcher($factory->make(LegacyRrDispatcher::class));
81 82
         }
82 83
 
83
-        if (class_exists(PSR7Worker::class)) {
84
+        if (class_exists(PSR7Worker::class))
85
+        {
84 86
             $kernel->addDispatcher($factory->make(RrDispatcher::class));
85 87
         }
86 88
     }
Please login to merge, or discard this patch.
src/Framework/Bootloader/ServerBootloader.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,8 @@
 block discarded – undo
42 42
      */
43 43
     private function isLegacy(): bool
44 44
     {
45
-        if (\class_exists(InstalledVersions::class)) {
45
+        if (\class_exists(InstalledVersions::class))
46
+        {
46 47
             $version = InstalledVersions::getVersion('spiral/roadrunner');
47 48
 
48 49
             return \str_starts_with($version, '1.');
Please login to merge, or discard this patch.
src/Framework/Bootloader/Jobs/JobsBootloader.php 1 patch
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,12 +47,17 @@
 block discarded – undo
47 47
     {
48 48
         $kernel->addDispatcher($jobs);
49 49
 
50
-        if (\class_exists(LegacyRPC::class)) {
51
-            $container->bindSingleton(QueueInterface::class, function (LegacyRPC $rpc, JobRegistry $registry) {
50
+        if (\class_exists(LegacyRPC::class))
51
+        {
52
+            $container->bindSingleton(QueueInterface::class, function (LegacyRPC $rpc, JobRegistry $registry)
53
+            {
52 54
                 return new JobQueue($rpc, $registry);
53 55
             });
54
-        } else {
55
-            $container->bindSingleton(QueueInterface::class, function (RPC $rpc, JobRegistry $registry) {
56
+        }
57
+        else
58
+        {
59
+            $container->bindSingleton(QueueInterface::class, function (RPC $rpc, JobRegistry $registry)
60
+            {
56 61
                 return new JobQueue($rpc, $registry);
57 62
             });
58 63
         }
Please login to merge, or discard this patch.