Passed
Push — master ( f0b67b...ec9c11 )
by y
01:29
created
src/Reactor.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,8 +93,7 @@
 block discarded – undo
93 93
             foreach ($rwe[0] as $id => $socket) {
94 94
                 $socket->onReadable();
95 95
             }
96
-        }
97
-        finally {
96
+        } finally {
98 97
             array_walk_recursive($rwe, function(ReactiveInterface $each) {
99 98
                 if (!$each->isOpen()) {
100 99
                     $this->remove($each);
Please login to merge, or discard this patch.
src/WebSocket/HandShake.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -91,8 +91,7 @@  discard block
 block discarded – undo
91 91
                 $value = trim($value);
92 92
                 if (isset($this->headers[$key])) {
93 93
                     $this->headers[$key] .= ', ' . $value;
94
-                }
95
-                else {
94
+                } else {
96 95
                     $this->headers[$key] = $value;
97 96
                 }
98 97
             }
@@ -101,8 +100,7 @@  discard block
 block discarded – undo
101 100
             $this->upgrade();
102 101
             $this->client->write("\r\n\r\n");
103 102
             return true;
104
-        }
105
-        catch (WebSocketError $e) {
103
+        } catch (WebSocketError $e) {
106 104
             $this->client->write("HTTP/1.1 {$e->getCode()}\r\n\r\n");
107 105
             throw $e;
108 106
         }
Please login to merge, or discard this patch.
src/WebSocket/WebSocketServer.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,8 +94,7 @@
 block discarded – undo
94 94
         foreach ($this->clients as $client) {
95 95
             try {
96 96
                 $client->close($code, $reason);
97
-            }
98
-            catch (Exception $e) {
97
+            } catch (Exception $e) {
99 98
                 continue;
100 99
             }
101 100
         }
Please login to merge, or discard this patch.
src/AbstractClient.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,8 +21,7 @@  discard block
 block discarded – undo
21 21
     public function __toString () {
22 22
         try {
23 23
             return implode(':', $this->getPeerName());
24
-        }
25
-        catch (Throwable $e) {
24
+        } catch (Throwable $e) {
26 25
             return "?{$this->resource}";
27 26
         }
28 27
     }
@@ -102,8 +101,7 @@  discard block
 block discarded – undo
102 101
         while ($total < $length) {
103 102
             try {
104 103
                 $total += $this->awaitWritable()->send(substr($data, $total));
105
-            }
106
-            catch (SocketError $e) {
104
+            } catch (SocketError $e) {
107 105
                 $e->setExtra($total);
108 106
                 throw $e;
109 107
             }
Please login to merge, or discard this patch.
src/SocketError.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,8 +65,7 @@
 block discarded – undo
65 65
     public function __construct ($subject = null, $fallback = 0, SocketError $previous = null) {
66 66
         if ($errno = is_int($subject) ? $subject : static::getLast($subject)) {
67 67
             $message = socket_strerror($errno);
68
-        }
69
-        else {
68
+        } else {
70 69
             $errno = $fallback;
71 70
             $last = error_get_last();
72 71
             $message = "{$last['message']} in {$last['file']}:{$last['line']}";
Please login to merge, or discard this patch.
src/StreamClient.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,8 +53,7 @@  discard block
 block discarded – undo
53 53
                 $length -= $chunkSize = strlen($chunk);
54 54
             } while ($chunkSize and $length);
55 55
             return $data;
56
-        }
57
-        catch (SocketError $e) {
56
+        } catch (SocketError $e) {
58 57
             $e->setExtra($data);
59 58
             throw $e;
60 59
         }
@@ -91,8 +90,7 @@  discard block
 block discarded – undo
91 90
         $length = $this->getOption(SO_RCVBUF);
92 91
         try {
93 92
             return $this->recv($length, $msgFlags);
94
-        }
95
-        catch (SocketError $e) {
93
+        } catch (SocketError $e) {
96 94
             if ($e->getCode() === SOCKET_EAGAIN) { // would block
97 95
                 return '';
98 96
             }
Please login to merge, or discard this patch.
src/AbstractSocket.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,11 +52,9 @@
 block discarded – undo
52 52
     public function __construct ($resource) {
53 53
         if (!is_resource($resource) or get_resource_type($resource) !== 'Socket') {
54 54
             throw new InvalidArgumentException('Expected an open socket resource.', SOCKET_EBADF);
55
-        }
56
-        elseif (socket_get_option($resource, SOL_SOCKET, SO_TYPE) !== static::getType()) {
55
+        } elseif (socket_get_option($resource, SOL_SOCKET, SO_TYPE) !== static::getType()) {
57 56
             throw new InvalidArgumentException('Invalid socket type for ' . static::class, SOCKET_ESOCKTNOSUPPORT);
58
-        }
59
-        elseif ($errno = SocketError::getLast($resource)) {
57
+        } elseif ($errno = SocketError::getLast($resource)) {
60 58
             // "File descriptor in bad state"
61 59
             throw new SocketError(SOCKET_EBADFD, 0, new SocketError($errno));
62 60
         }
Please login to merge, or discard this patch.
src/WebSocket/FrameHandler.php 1 patch
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -138,11 +138,9 @@  discard block
 block discarded – undo
138 138
     protected function onControl (Frame $control): void {
139 139
         if ($control->isClose()) {
140 140
             $this->onClose($control);
141
-        }
142
-        elseif ($control->isPing()) {
141
+        } elseif ($control->isPing()) {
143 142
             $this->onPing($control);
144
-        }
145
-        elseif ($control->isPong()) {
143
+        } elseif ($control->isPong()) {
146 144
             $this->onPong($control);
147 145
         }
148 146
     }
@@ -158,8 +156,7 @@  discard block
 block discarded – undo
158 156
         }
159 157
         if ($data->isText()) {
160 158
             $this->onText($data);
161
-        }
162
-        elseif ($data->isBinary()) {
159
+        } elseif ($data->isBinary()) {
163 160
             $this->onBinary($data);
164 161
         }
165 162
     }
@@ -188,11 +185,9 @@  discard block
 block discarded – undo
188 185
         $this->onFrame_CheckLength($frame);
189 186
         if ($frame->isControl()) {
190 187
             $this->onControl($frame);
191
-        }
192
-        elseif ($frame->isContinue()) {
188
+        } elseif ($frame->isContinue()) {
193 189
             $this->onContinue($frame);
194
-        }
195
-        else {
190
+        } else {
196 191
             $this->onData($frame);
197 192
         }
198 193
     }
@@ -204,8 +199,7 @@  discard block
 block discarded – undo
204 199
         if ($frame->isData()) {
205 200
             if ($frame->isBinary()) {
206 201
                 $length = strlen($this->binary);
207
-            }
208
-            else {
202
+            } else {
209 203
                 $length = strlen($this->text);
210 204
             }
211 205
             if ($length + $frame->getLength() > $this->maxLength) {
@@ -341,12 +335,10 @@  discard block
 block discarded – undo
341 335
         if ($length > 65535) {
342 336
             $head .= chr(127);
343 337
             $head .= pack('J', $length);
344
-        }
345
-        elseif ($length >= 126) {
338
+        } elseif ($length >= 126) {
346 339
             $head .= chr(126);
347 340
             $head .= pack('n', $length);
348
-        }
349
-        else {
341
+        } else {
350 342
             $head .= chr($length);
351 343
         }
352 344
         $this->client->write($head . $payload);
Please login to merge, or discard this patch.
src/WebSocket/WebSocketClient.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -80,8 +80,7 @@  discard block
 block discarded – undo
80 80
                 $this->getFrameHandler()->writeClose($code, $reason);
81 81
                 $this->shutdown(self::CH_WRITE);
82 82
             }
83
-        }
84
-        finally {
83
+        } finally {
85 84
             $this->state = self::STATE_CLOSE;
86 85
             $this->server->remove($this);
87 86
             parent::close();
@@ -173,12 +172,10 @@  discard block
 block discarded – undo
173 172
                 case self::STATE_CLOSE:
174 173
                     return;
175 174
             }
176
-        }
177
-        catch (WebSocketError $e) {
175
+        } catch (WebSocketError $e) {
178 176
             $this->close($e->getCode(), $e->getMessage());
179 177
             throw $e;
180
-        }
181
-        catch (Exception $e) {
178
+        } catch (Exception $e) {
182 179
             $this->close(Frame::CLOSE_INTERNAL_ERROR);
183 180
             throw $e;
184 181
         }
Please login to merge, or discard this patch.