File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff 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 ) {
You can’t perform that action at this time.
0 commit comments