Passed
Push — master ( a44753...55161e )
by Goffy
03:59
created
lib/Github/Http/Client/MockHttpClient.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
         }
42 42
 
43 43
         if (!$responseFactory instanceof \Iterator && null !== $responseFactory && !\is_callable($responseFactory)) {
44
-            $responseFactory = (static function () use ($responseFactory) {
44
+            $responseFactory = (static function() use ($responseFactory) {
45 45
                 yield from $responseFactory;
46 46
             })();
47 47
         }
Please login to merge, or discard this patch.
lib/Github/Http/Client/TraceableHttpClient.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
             $content = false;
58 58
         }
59 59
 
60
-        $options['on_progress'] = function (int $dlNow, int $dlSize, array $info) use (&$traceInfo, $onProgress) {
60
+        $options['on_progress'] = function(int $dlNow, int $dlSize, array $info) use (&$traceInfo, $onProgress) {
61 61
             $traceInfo = $info;
62 62
 
63 63
             if (null !== $onProgress) {
Please login to merge, or discard this patch.
lib/Github/Http/Client/Response/AsyncResponse.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
 
47 47
         if (null !== $onProgress = $options['on_progress'] ?? null) {
48 48
             $thisInfo = &$this->info;
49
-            $options['on_progress'] = static function (int $dlNow, int $dlSize, array $info) use (&$thisInfo, $onProgress) {
49
+            $options['on_progress'] = static function(int $dlNow, int $dlSize, array $info) use (&$thisInfo, $onProgress) {
50 50
                 $onProgress($dlNow, $dlSize, $thisInfo + $info);
51 51
             };
52 52
         }
53 53
         $this->response = $client->request($method, $url, ['buffer' => false] + $options);
54 54
         $this->passthru = $passthru;
55
-        $this->initializer = static function (self $response) {
55
+        $this->initializer = static function(self $response) {
56 56
             if (null === $response->shouldBuffer) {
57 57
                 return false;
58 58
             }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
             $this->getHeaders(true);
126 126
         }
127 127
 
128
-        $handle = function () {
128
+        $handle = function() {
129 129
             $stream = $this->response instanceof StreamableInterface ? $this->response->toStream(false) : StreamWrapper::createResource($this->response);
130 130
 
131 131
             return stream_get_meta_data($stream)['wrapper_data']->stream_cast(\STREAM_CAST_FOR_SELECT);
Please login to merge, or discard this patch.
lib/Github/Http/Client/Response/NativeResponse.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -63,16 +63,16 @@  discard block
 block discarded – undo
63 63
         $info['user_data'] = $options['user_data'];
64 64
         ++$multi->responseCount;
65 65
 
66
-        $this->initializer = static function (self $response) {
66
+        $this->initializer = static function(self $response) {
67 67
             return null === $response->remaining;
68 68
         };
69 69
 
70 70
         $pauseExpiry = &$this->pauseExpiry;
71
-        $info['pause_handler'] = static function (float $duration) use (&$pauseExpiry) {
71
+        $info['pause_handler'] = static function(float $duration) use (&$pauseExpiry) {
72 72
             $pauseExpiry = 0 < $duration ? micro\time(true) + $duration : 0;
73 73
         };
74 74
 
75
-        $this->canary = new Canary(static function () use ($multi, $id) {
75
+        $this->canary = new Canary(static function() use ($multi, $id) {
76 76
             if (null !== ($host = $multi->openHandles[$id][6] ?? null) && 0 >= --$multi->hosts[$host]) {
77 77
                 unset($multi->hosts[$host]);
78 78
             }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     {
116 116
         $url = $this->url;
117 117
 
118
-        set_error_handler(function ($type, $msg) use (&$url) {
118
+        set_error_handler(function($type, $msg) use (&$url) {
119 119
             if (\E_NOTICE !== $type || 'fopen(): Content-type not specified assuming application/x-www-form-urlencoded' !== $msg) {
120 120
                 throw new TransportException($msg);
121 121
             }
Please login to merge, or discard this patch.
lib/Github/Http/Client/Response/CurlResponse.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
             \curl_setopt($ch, \CURLOPT_PRIVATE, \in_array($method, ['GET', 'HEAD', 'OPTIONS', 'TRACE'], true) && 1.0 < (float) ($options['http_version'] ?? 1.1) ? 'H2' : 'H0'); // H = headers + retry counter
76 76
         }
77 77
 
78
-        \curl_setopt($ch, \CURLOPT_HEADERFUNCTION, static function ($ch, string $data) use (&$info, &$headers, $options, $multi, $id, &$location, $resolveRedirect, $logger): int {
78
+        \curl_setopt($ch, \CURLOPT_HEADERFUNCTION, static function($ch, string $data) use (&$info, &$headers, $options, $multi, $id, &$location, $resolveRedirect, $logger): int {
79 79
             if (0 !== substr_compare($data, "\r\n", -2)) {
80 80
                 return 0;
81 81
             }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
         if (null === $options) {
93 93
             // Pushed response: buffer until requested
94
-            \curl_setopt($ch, \CURLOPT_WRITEFUNCTION, static function ($ch, string $data) use ($multi, $id): int {
94
+            \curl_setopt($ch, \CURLOPT_WRITEFUNCTION, static function($ch, string $data) use ($multi, $id): int {
95 95
                 $multi->handlesActivity[$id][] = $data;
96 96
                 curl_pause($ch, \CURLPAUSE_RECV);
97 97
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         }
103 103
 
104 104
         $execCounter = $multi->execCounter;
105
-        $this->info['pause_handler'] = static function (float $duration) use ($ch, $multi, $execCounter) {
105
+        $this->info['pause_handler'] = static function(float $duration) use ($ch, $multi, $execCounter) {
106 106
             if (0 < $duration) {
107 107
                 if ($execCounter === $multi->execCounter) {
108 108
                     $multi->execCounter = !\is_float($execCounter) ? 1 + $execCounter : \PHP_INT_MIN;
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         if ($onProgress = $options['on_progress']) {
129 129
             $url = isset($info['url']) ? ['url' => $info['url']] : [];
130 130
             \curl_setopt($ch, \CURLOPT_NOPROGRESS, false);
131
-            \curl_setopt($ch, \CURLOPT_PROGRESSFUNCTION, static function ($ch, $dlSize, $dlNow) use ($onProgress, &$info, $url, $multi, $debugBuffer) {
131
+            \curl_setopt($ch, \CURLOPT_PROGRESSFUNCTION, static function($ch, $dlSize, $dlNow) use ($onProgress, &$info, $url, $multi, $debugBuffer) {
132 132
                 try {
133 133
                     rewind($debugBuffer);
134 134
                     $debug = ['debug' => stream_get_contents($debugBuffer)];
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
             });
145 145
         }
146 146
 
147
-        \curl_setopt($ch, \CURLOPT_WRITEFUNCTION, static function ($ch, string $data) use ($multi, $id): int {
147
+        \curl_setopt($ch, \CURLOPT_WRITEFUNCTION, static function($ch, string $data) use ($multi, $id): int {
148 148
             if ('H' === (\curl_getinfo($ch, \CURLINFO_PRIVATE)[0] ?? null)) {
149 149
                 $multi->handlesActivity[$id][] = null;
150 150
                 $multi->handlesActivity[$id][] = new TransportException(\sprintf('Unsupported protocol for "%s"', \curl_getinfo($ch, \CURLINFO_EFFECTIVE_URL)));
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
                 return 0;
153 153
             }
154 154
 
155
-            \curl_setopt($ch, \CURLOPT_WRITEFUNCTION, static function ($ch, string $data) use ($multi, $id): int {
155
+            \curl_setopt($ch, \CURLOPT_WRITEFUNCTION, static function($ch, string $data) use ($multi, $id): int {
156 156
                 $multi->handlesActivity[$id][] = $data;
157 157
 
158 158
                 return \strlen($data);
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
             return \strlen($data);
164 164
         });
165 165
 
166
-        $this->initializer = static function (self $response) {
166
+        $this->initializer = static function(self $response) {
167 167
             $waitFor = \curl_getinfo($ch = $response->handle, \CURLINFO_PRIVATE);
168 168
 
169 169
             return 'H' === $waitFor[0];
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
         $multi->openHandles[$id] = [$ch, $options];
174 174
         curl_multi_add_handle($multi->handle, $ch);
175 175
 
176
-        $this->canary = new Canary(static function () use ($ch, $multi, $id) {
176
+        $this->canary = new Canary(static function() use ($ch, $multi, $id) {
177 177
             unset($multi->pauseExpiries[$id], $multi->openHandles[$id], $multi->handlesActivity[$id]);
178 178
             \curl_setopt($ch, \CURLOPT_PRIVATE, '_0');
179 179
 
Please login to merge, or discard this patch.
lib/Github/Http/Client/Response/MockResponse.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         $response->requestOptions = $options;
127 127
         $response->id = ++self::$idSequence;
128 128
         $response->shouldBuffer = $options['buffer'] ?? true;
129
-        $response->initializer = static function (self $response) {
129
+        $response->initializer = static function(self $response) {
130 130
             return \is_array($response->body[0] ?? null);
131 131
         };
132 132
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
      */
225 225
     private static function writeRequest(self $response, array $options, ResponseInterface $mock)
226 226
     {
227
-        $onProgress = $options['on_progress'] ?? static function () {};
227
+        $onProgress = $options['on_progress'] ?? static function() {};
228 228
         $response->info += $mock->getInfo() ?: [];
229 229
 
230 230
         // simulate "size_upload" if it is set
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
      */
268 268
     private static function readResponse(self $response, array $options, ResponseInterface $mock, int &$offset)
269 269
     {
270
-        $onProgress = $options['on_progress'] ?? static function () {};
270
+        $onProgress = $options['on_progress'] ?? static function() {};
271 271
 
272 272
         // populate info related to headers
273 273
         $info = $mock->getInfo() ?: [];
Please login to merge, or discard this patch.
lib/Github/Http/Client/Response/AmpResponse.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
             $request->setHeader('Accept-Encoding', 'gzip');
68 68
         }
69 69
 
70
-        $this->initializer = static function (self $response) {
70
+        $this->initializer = static function(self $response) {
71 71
             return null !== $response->options;
72 72
         };
73 73
 
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
         $info['user_data'] = $options['user_data'];
90 90
         $info['debug'] = '';
91 91
 
92
-        $onProgress = $options['on_progress'] ?? static function () {};
93
-        $onProgress = $this->onProgress = static function () use (&$info, $onProgress) {
92
+        $onProgress = $options['on_progress'] ?? static function() {};
93
+        $onProgress = $this->onProgress = static function() use (&$info, $onProgress) {
94 94
             $info['total_time'] = micro\time(true) - $info['start_time'];
95 95
             $onProgress((int) $info['size_download'], ((int) (1 + $info['download_content_length']) ?: 1) - 1, (array) $info);
96 96
         };
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
         $throttleWatcher = null;
102 102
 
103 103
         $this->id = $id = self::$nextId++;
104
-        Loop::defer(static function () use ($request, $multi, &$id, &$info, &$headers, $canceller, &$options, $onProgress, &$handle, $logger, &$pause) {
104
+        Loop::defer(static function() use ($request, $multi, &$id, &$info, &$headers, $canceller, &$options, $onProgress, &$handle, $logger, &$pause) {
105 105
             return new Coroutine(self::generateResponse($request, $multi, $id, $info, $headers, $canceller, $options, $onProgress, $handle, $logger, $pause));
106 106
         });
107 107
 
108
-        $info['pause_handler'] = static function (float $duration) use (&$throttleWatcher, &$pauseDeferred, &$pause) {
108
+        $info['pause_handler'] = static function(float $duration) use (&$throttleWatcher, &$pauseDeferred, &$pause) {
109 109
             if (null !== $throttleWatcher) {
110 110
                 Loop::cancel($throttleWatcher);
111 111
             }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                 $pauseDeferred = new Deferred();
118 118
                 $deferred->resolve();
119 119
             } else {
120
-                $throttleWatcher = Loop::delay(ceil(1000 * $duration), static function () use (&$pauseDeferred) {
120
+                $throttleWatcher = Loop::delay(ceil(1000 * $duration), static function() use (&$pauseDeferred) {
121 121
                     $deferred = $pauseDeferred;
122 122
                     $pauseDeferred = new Deferred();
123 123
                     $deferred->resolve();
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         $multi->openHandles[$id] = $id;
129 129
         ++$multi->responseCount;
130 130
 
131
-        $this->canary = new Canary(static function () use ($canceller, $multi, $id) {
131
+        $this->canary = new Canary(static function() use ($canceller, $multi, $id) {
132 132
             $canceller->cancel();
133 133
             unset($multi->openHandles[$id], $multi->handlesActivity[$id]);
134 134
         });
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
     private static function select(ClientState $multi, float $timeout): int
203 203
     {
204 204
         $timeout += micro\time(true);
205
-        self::$delay = Loop::defer(static function () use ($timeout) {
205
+        self::$delay = Loop::defer(static function() use ($timeout) {
206 206
             if (0 < $timeout -= micro\time(true)) {
207 207
                 self::$delay = Loop::delay(ceil(1000 * $timeout), [Loop::class, 'stop']);
208 208
             } else {
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 
218 218
     private static function generateResponse(Request $request, AmpClientState $multi, string $id, array &$info, array &$headers, CancellationTokenSource $canceller, array &$options, \Closure $onProgress, &$handle, ?LoggerInterface $logger, Promise &$pause)
219 219
     {
220
-        $request->setInformationalResponseHandler(static function (Response $response) use ($multi, $id, &$info, &$headers) {
220
+        $request->setInformationalResponseHandler(static function(Response $response) use ($multi, $id, &$info, &$headers) {
221 221
             self::addResponseHeaders($response, $info, $headers);
222 222
             $multi->handlesActivity[$id][] = new InformationalChunk($response->getStatus(), $response->getHeaders());
223 223
             self::stopLoop();
Please login to merge, or discard this patch.
lib/Github/Http/Client/Response/HttplugPromise.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
             return null;
74 74
         }
75 75
 
76
-        return static function ($value) use ($callback) {
76
+        return static function($value) use ($callback) {
77 77
             return promise_for($callback($value));
78 78
         };
79 79
     }
Please login to merge, or discard this patch.
lib/Github/Http/Client/Response/AsyncContext.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@
 block discarded – undo
153 153
         $this->info['previous_info'][] = $this->response->getInfo();
154 154
         if (null !== $onProgress = $options['on_progress'] ?? null) {
155 155
             $thisInfo = &$this->info;
156
-            $options['on_progress'] = static function (int $dlNow, int $dlSize, array $info) use (&$thisInfo, $onProgress) {
156
+            $options['on_progress'] = static function(int $dlNow, int $dlSize, array $info) use (&$thisInfo, $onProgress) {
157 157
                 $onProgress($dlNow, $dlSize, $thisInfo + $info);
158 158
             };
159 159
         }
Please login to merge, or discard this patch.