Skip to content

Commit cfe0d19

Browse files
committed
test preg_quote() with non-constant concat
1 parent 4b581de commit cfe0d19

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/PHPStan/Analyser/nsrt/preg_match_shapes.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,3 +419,12 @@ function (string $s): void {
419419
}
420420
assertType('array{}|array{0: string, 1: string, 2?: string}', $matches);
421421
};
422+
423+
function (string $s, $mixed): void {
424+
if (preg_match('{' . preg_quote($s) . '(z)' . preg_quote($s) . '(?:abc)'. $mixed .'(def)?}', $s, $matches)) {
425+
assertType('array<string>', $matches);
426+
} else {
427+
assertType('array{}', $matches);
428+
}
429+
assertType('array<string>', $matches);
430+
};

0 commit comments

Comments
 (0)