Skip to content

Commit 9b4fbce

Browse files
authored
Make CITestStreamFilter compatible with php_user_filter (#5014)
1 parent a4ff0e9 commit 9b4fbce

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

system/Test/Filters/CITestStreamFilter.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use php_user_filter;
1515

1616
/**
17-
* Class to extract an output snapshot.
1817
* Used to capture output during unit testing, so that it can
1918
* be used in assertions.
2019
*/
@@ -28,28 +27,24 @@ class CITestStreamFilter extends php_user_filter
2827
public static $buffer = '';
2928

3029
/**
31-
* Output filtering - catch it all.
30+
* This method is called whenever data is read from or written to the
31+
* attached stream (such as with fread() or fwrite()).
3232
*
3333
* @param resource $in
3434
* @param resource $out
3535
* @param int $consumed
3636
* @param bool $closing
37-
*
38-
* @return int
3937
*/
40-
public function filter($in, $out, &$consumed, $closing)
38+
public function filter($in, $out, &$consumed, $closing): int
4139
{
4240
while ($bucket = stream_bucket_make_writeable($in)) {
4341
static::$buffer .= $bucket->data;
4442

4543
$consumed += $bucket->datalen;
4644
}
4745

48-
// @phpstan-ignore-next-line
4946
return PSFS_PASS_ON;
5047
}
5148
}
5249

53-
// @codeCoverageIgnoreStart
54-
stream_filter_register('CITestStreamFilter', 'CodeIgniter\Test\Filters\CITestStreamFilter');
55-
// @codeCoverageIgnoreEnd
50+
stream_filter_register('CITestStreamFilter', CITestStreamFilter::class); // @codeCoverageIgnore

0 commit comments

Comments
 (0)