Skip to content

Commit 70b5102

Browse files
committed
🚿
1 parent 31be9e9 commit 70b5102

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

src/MessageUtil.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static function getContents(MessageInterface $message):string{
3232
$content = StreamUtil::getContents($message->getBody());
3333

3434
if($content === null){
35-
throw new RuntimeException('invalid message content');
35+
throw new RuntimeException('invalid message content'); // @codeCoverageIgnore
3636
}
3737

3838
return $content;
@@ -104,7 +104,7 @@ public static function toString(MessageInterface $message, bool|null $appendBody
104104
* @see https://github.com/kjdev/php-ext-zstd
105105
* @see https://en.wikipedia.org/wiki/HTTP_compression#Content-Encoding_tokens
106106
*
107-
* @throws \RuntimeException
107+
* @throws \Throwable|\RuntimeException
108108
*/
109109
public static function decompress(MessageInterface $message):string{
110110
$data = self::getContents($message);
@@ -122,7 +122,6 @@ public static function decompress(MessageInterface $message):string{
122122
}
123123
catch(Throwable $e){
124124
if(in_array($encoding, ['br', 'zstd'])){
125-
/** @var \RuntimeException $e */
126125
throw $e;
127126
}
128127
}
@@ -131,7 +130,7 @@ public static function decompress(MessageInterface $message):string{
131130
}
132131

133132
/**
134-
*
133+
* @codeCoverageIgnore
135134
*/
136135
protected static function call_decompress_func(string $func, string $data):string{
137136
$fn = $func.'_uncompress';
@@ -140,7 +139,7 @@ protected static function call_decompress_func(string $func, string $data):strin
140139
throw new RuntimeException(sprintf('cannot decompress %s compressed message body', $func));
141140
}
142141

143-
return call_user_func($fn, $data);
142+
return $fn($data);
144143
}
145144

146145
/**
@@ -176,7 +175,7 @@ public static function setContentTypeHeader(
176175
);
177176

178177
if($mime === null){
179-
throw new RuntimeException('could not determine content type');
178+
throw new RuntimeException('could not determine content type'); // @codeCoverageIgnore
180179
}
181180

182181
return $message->withHeader('Content-Type', $mime);

src/MimeTypeUtil.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,7 @@ public static function getFromContent(string $content):string|null{
13251325
$mime = $finfo->buffer($content);
13261326

13271327
if($mime === false){
1328-
return null;
1328+
return null; // @codeCoverageIgnore
13291329
}
13301330

13311331
return $mime;

src/ServerUtil.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public function createUploadedFileFromSpec(array $value):UploadedFileInterface|a
167167
// not sure if dumb or genius
168168
$stream = is_file($value['tmp_name'])
169169
? $this->streamFactory->createStreamFromFile($value['tmp_name'])
170-
: $this->streamFactory->createStream($value['tmp_name']);
170+
: $this->streamFactory->createStream($value['tmp_name']); // @codeCoverageIgnore
171171

172172
return $this->uploadedFileFactory
173173
->createUploadedFile($stream, (int)$value['size'], (int)$value['error'], $value['name'], $value['type']);

src/StreamUtil.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public static function copyToStream(StreamInterface $source, StreamInterface $de
154154
$bytesRead += $length;
155155

156156
if($length === 0){
157-
break;
157+
break; // @codeCoverageIgnore
158158
}
159159

160160
$remaining -= $length;

0 commit comments

Comments
 (0)