Test Failed
Pull Request — master (#661)
by Maxim
24:07 queued 16:21
created
src/Http/tests/SapiEmitter/SapiEmitterTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $this->assertEquals(200, $this->getResponseCode());
67 67
         $this->assertCount(2, $this->getHeaders());
68 68
         $this->assertContains('X-Test: 1', $this->getHeaders());
69
-        $this->assertContains('Content-Length: ' . $length, $this->getHeaders());
69
+        $this->assertContains('Content-Length: '.$length, $this->getHeaders());
70 70
         $this->expectOutputString('Example body');
71 71
     }
72 72
 
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
         $this->expectException(EmitterException::class);
120 120
         $this->expectExceptionMessage('Unable to emit response, found non closed buffered output.');
121 121
 
122
-        try {
122
+        try{
123 123
             echo 'some data';
124 124
             $this->createEmitter()->emit($response);
125
-        } catch (\Throwable $e) {
125
+        }catch (\Throwable $e){
126 126
             throw $e;
127
-        } finally {
127
+        }finally{
128 128
             \ob_end_clean();
129 129
         }
130 130
     }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     private function createEmitter(?int $bufferSize = null): SapiEmitter
175 175
     {
176 176
         $emitter = new SapiEmitter(new HttpConfig(['chunkSize' => null]));
177
-        if ($bufferSize !== null) {
177
+        if ($bufferSize !== null){
178 178
             $emitter->bufferSize = $bufferSize;
179 179
         }
180 180
         return $emitter;
@@ -189,12 +189,12 @@  discard block
 block discarded – undo
189 189
         $response = (new Response())
190 190
             ->withStatus($status)
191 191
             ->withProtocolVersion($version);
192
-        foreach ($headers as $header => $value) {
192
+        foreach ($headers as $header => $value){
193 193
             $response = $response->withHeader($header, $value);
194 194
         }
195
-        if ($body instanceof StreamInterface) {
195
+        if ($body instanceof StreamInterface){
196 196
             $response = $response->withBody($body);
197
-        } elseif (is_string($body)) {
197
+        } elseif (is_string($body)){
198 198
             $response->getBody()->write($body);
199 199
         }
200 200
         return $response;
Please login to merge, or discard this patch.
src/Http/src/Config/HttpConfig.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,6 +58,6 @@
 block discarded – undo
58 58
      */
59 59
     public function getChunkSize(): ?int
60 60
     {
61
-        return !\is_null($this->config['chunkSize']) ? (int) $this->config['chunkSize'] : null;
61
+        return !\is_null($this->config['chunkSize']) ? (int)$this->config['chunkSize'] : null;
62 62
     }
63 63
 }
Please login to merge, or discard this patch.
src/Http/src/Emitter/SapiEmitter.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
     public function __construct(HttpConfig $config)
34 34
     {
35
-        if (($chunkSize = $config->getChunkSize()) !== null) {
35
+        if (($chunkSize = $config->getChunkSize()) !== null){
36 36
             $this->bufferSize = $chunkSize;
37 37
         }
38 38
     }
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
     private function emitBody(ResponseInterface $response): void
63 63
     {
64 64
         $body = $response->getBody();
65
-        if ($body->isSeekable()) {
65
+        if ($body->isSeekable()){
66 66
             $body->rewind();
67 67
         }
68
-        if (!$body->isReadable()) {
68
+        if (!$body->isReadable()){
69 69
             return;
70 70
         }
71
-        while (!$body->eof()) {
71
+        while (!$body->eof()){
72 72
             echo $body->read($this->bufferSize);
73 73
             flush();
74 74
         }
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
      */
86 86
     private function assertNoPreviousOutput(): void
87 87
     {
88
-        if (headers_sent()) {
88
+        if (headers_sent()){
89 89
             throw new EmitterException('Unable to emit response, headers already send.');
90 90
         }
91 91
 
92
-        if (ob_get_level() > 0 && ob_get_length() > 0) {
92
+        if (ob_get_level() > 0 && ob_get_length() > 0){
93 93
             throw new EmitterException('Unable to emit response, found non closed buffered output.');
94 94
         }
95 95
     }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             'HTTP/%s %d%s',
116 116
             $response->getProtocolVersion(),
117 117
             $statusCode,
118
-            ($reasonPhrase ? ' ' . $reasonPhrase : '')
118
+            ($reasonPhrase ? ' '.$reasonPhrase : '')
119 119
         ), true, $statusCode);
120 120
     }
121 121
 
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
     {
134 134
         $statusCode = $response->getStatusCode();
135 135
 
136
-        foreach ($response->getHeaders() as $header => $values) {
136
+        foreach ($response->getHeaders() as $header => $values){
137 137
             $name = $this->filterHeader($header);
138 138
             $first = $name === 'Set-Cookie' ? false : true;
139
-            foreach ($values as $value) {
139
+            foreach ($values as $value){
140 140
                 header(sprintf(
141 141
                     '%s: %s',
142 142
                     $name,
Please login to merge, or discard this patch.