Skip to content

Commit 695803c

Browse files
committed
use benevolent union for stream_get_contents() to prevent strict-rules errors
1 parent 1f150cc commit 695803c

File tree

2 files changed

+20
-41
lines changed

2 files changed

+20
-41
lines changed

src/Type/Php/StreamGetContentsFunctionReturnTypeExtension.php

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace Bug13289;
4+
5+
class HelloWorld
6+
{
7+
/**
8+
* @param resource $resource
9+
**/
10+
public function base64Response($resource): string
11+
{
12+
$content = stream_get_contents($resource);
13+
14+
if (false === $content) {
15+
throw new \UnexpectedValueException('Invalid content given');
16+
}
17+
18+
return base64_encode($content);
19+
}
20+
}

0 commit comments

Comments
 (0)