Skip to content

Commit ef44f28

Browse files
committed
Fix tests
1 parent 2fdef47 commit ef44f28

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php // lint >= 8.4
2+
3+
namespace Bug7341Php84;
4+
5+
use function PHPStan\Testing\assertType;
6+
7+
final class CsvWriterTerminate extends \php_user_filter
8+
{
9+
/**
10+
* @param resource $in
11+
* @param resource $out
12+
* @param int $consumed
13+
* @param bool $closing
14+
*/
15+
public function filter($in, $out, &$consumed, $closing): int
16+
{
17+
while ($bucket = stream_bucket_make_writeable($in)) {
18+
assertType('StreamBucket', $bucket);
19+
20+
if (isset($this->params['terminate'])) {
21+
$bucket->data = preg_replace('/([^\r])\n/', '$1'.$this->params['terminate'], $bucket->data);
22+
}
23+
$consumed += $bucket->datalen;
24+
stream_bucket_append($out, $bucket);
25+
}
26+
27+
return \PSFS_PASS_ON;
28+
}
29+
}

tests/PHPStan/Analyser/nsrt/bug-7341.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php // lint < 8.4
22

33
namespace Bug7341;
44

tests/PHPStan/Rules/Regexp/RegularExpressionPatternRuleTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ public function testValidRegexPatternAfter73(): void
156156
if (PHP_VERSION_ID >= 80200) {
157157
$messagePart = 'alphanumeric, backslash, or NUL';
158158
}
159+
if (PHP_VERSION_ID >= 80400) {
160+
$messagePart = 'alphanumeric, backslash, or NUL byte';
161+
}
159162

160163
$this->analyse(
161164
[__DIR__ . '/data/valid-regex-pattern.php'],

0 commit comments

Comments
 (0)