Skip to content

Commit 578c7c3

Browse files
authored
refactor: add CITestStreamFilter to phpstan-analysed list and fix errors (#9515)
1 parent c43119c commit 578c7c3

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

phpstan.neon.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ parameters:
1919
- system/Commands/Generators/Views/*
2020
- system/Debug/Toolbar/Views/toolbar.tpl.php
2121
- system/Images/Handlers/GDHandler.php
22-
- system/Test/Filters/CITestStreamFilter.php
2322
- system/ThirdParty/*
2423
- system/Validation/Views/single.php
2524
- tests/system/View/Views/*

system/Test/Filters/CITestStreamFilter.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ class CITestStreamFilter extends php_user_filter
4848
* @param resource $out
4949
* @param int $consumed
5050
* @param bool $closing
51+
*
52+
* @param-out int $consumed
5153
*/
5254
public function filter($in, $out, &$consumed, $closing): int
5355
{
5456
while ($bucket = stream_bucket_make_writeable($in)) {
5557
static::$buffer .= $bucket->data;
56-
57-
$consumed += $bucket->datalen;
58+
$consumed += (int) $bucket->datalen;
5859
}
5960

6061
return PSFS_PASS_ON;
@@ -92,11 +93,13 @@ public static function removeOutputFilter(): void
9293
}
9394

9495
/**
95-
* @param resource $stream
96+
* @param resource|null $stream
97+
*
98+
* @param-out null $stream
9699
*/
97100
protected static function removeFilter(&$stream): void
98101
{
99-
if (is_resource($stream)) {
102+
if ($stream !== null) {
100103
stream_filter_remove($stream);
101104
$stream = null;
102105
}

0 commit comments

Comments
 (0)