Skip to content

Commit d74d107

Browse files
committed
move test into separate file
1 parent db824cd commit d74d107

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

Diff for: tests/PHPStan/Analyser/nsrt/preg_match_shapes_php74.php

-8
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,6 @@ function doUnmatchedAsNull(string $s): void {
113113
assertType('array{}|array{0: string, 1?: string|null, 2?: string|null, 3?: string|null}', $matches);
114114
}
115115

116-
function doOffsetCaptureWithUnmatchedNull(string $s): void {
117-
// see https://3v4l.org/07rBO#v8.2.9
118-
if (preg_match('/(foo)(bar)(baz)/', $s, $matches, PREG_OFFSET_CAPTURE|PREG_UNMATCHED_AS_NULL)) {
119-
assertType('array{array{string|null, int<-1, max>}, array{string|null, int<-1, max>}, array{string|null, int<-1, max>}, array{string|null, int<-1, max>}}', $matches);
120-
}
121-
assertType('array{}|array{array{string|null, int<-1, max>}, array{string|null, int<-1, max>}, array{string|null, int<-1, max>}, array{string|null, int<-1, max>}}', $matches);
122-
}
123-
124116
function doUnknownFlags(string $s, int $flags): void {
125117
if (preg_match('/(foo)(bar)(baz)/xyz', $s, $matches, $flags)) {
126118
assertType('array<array{string|null, int<-1, max>}|string|null>', $matches);
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php // lint >= 8.0
2+
3+
namespace PregMatchShapesPhp82;
4+
5+
use function PHPStan\Testing\assertType;
6+
7+
function doOffsetCaptureWithUnmatchedNull(string $s): void {
8+
// see https://3v4l.org/07rBO#v8.2.9
9+
if (preg_match('/(foo)(bar)(baz)/', $s, $matches, PREG_OFFSET_CAPTURE|PREG_UNMATCHED_AS_NULL)) {
10+
assertType('array{array{string|null, int<-1, max>}, array{string|null, int<-1, max>}, array{string|null, int<-1, max>}, array{string|null, int<-1, max>}}', $matches);
11+
}
12+
assertType('array{}|array{array{string|null, int<-1, max>}, array{string|null, int<-1, max>}, array{string|null, int<-1, max>}, array{string|null, int<-1, max>}}', $matches);
13+
}

0 commit comments

Comments
 (0)