Skip to content

Commit 581537a

Browse files
Make Psalm happy
1 parent 7d26d74 commit 581537a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Util/Printer.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Printer
2424
protected $autoFlush = false;
2525

2626
/**
27-
* @var resource
27+
* @var resource|closed-resource
2828
*/
2929
protected $out;
3030

@@ -77,6 +77,8 @@ public function __construct($out = null)
7777
public function flush(): void
7878
{
7979
if ($this->out && \strncmp($this->outTarget, 'php://', 6) !== 0) {
80+
\assert(\is_resource($this->out));
81+
8082
\fclose($this->out);
8183
}
8284
}
@@ -91,6 +93,8 @@ public function flush(): void
9193
public function incrementalFlush(): void
9294
{
9395
if ($this->out) {
96+
\assert(\is_resource($this->out));
97+
9498
\fflush($this->out);
9599
} else {
96100
\flush();
@@ -100,6 +104,8 @@ public function incrementalFlush(): void
100104
public function write(string $buffer): void
101105
{
102106
if ($this->out) {
107+
\assert(\is_resource($this->out));
108+
103109
\fwrite($this->out, $buffer);
104110

105111
if ($this->autoFlush) {

0 commit comments

Comments
 (0)