Skip to content

Commit d05a40f

Browse files
committed
added preg_quote() with delimiter arg test
1 parent cfe0d19 commit d05a40f

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
@@ -411,6 +411,15 @@ function (string $s): void {
411411
assertType('array{}|array{string, string}', $matches);
412412
};
413413

414+
function (string $s): void {
415+
if (preg_match('/' . preg_quote($s, '/') . '(\d)/', $s, $matches)) {
416+
assertType('array{string, string}', $matches);
417+
} else {
418+
assertType('array{}', $matches);
419+
}
420+
assertType('array{}|array{string, string}', $matches);
421+
};
422+
414423
function (string $s): void {
415424
if (preg_match('{' . preg_quote($s) . '(z)' . preg_quote($s) . '(?:abc)(def)?}', $s, $matches)) {
416425
assertType('array{0: string, 1: string, 2?: string}', $matches);

0 commit comments

Comments
 (0)