diff --git a/tests/PHPStan/Analyser/nsrt/bug-11311-php72.php b/tests/PHPStan/Analyser/nsrt/bug-11311-php72.php index 098d703179..eb0d32c698 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-11311-php72.php +++ b/tests/PHPStan/Analyser/nsrt/bug-11311-php72.php @@ -4,8 +4,8 @@ use function PHPStan\Testing\assertType; -function doFoo() { - if (1 === preg_match('/(?\d+)\.(?\d+)(?:\.(?\d+))?/', '12.5', $matches, PREG_UNMATCHED_AS_NULL)) { +function doFoo(string $s) { + if (1 === preg_match('/(?\d+)\.(?\d+)(?:\.(?\d+))?/', $s, $matches, PREG_UNMATCHED_AS_NULL)) { // on PHP < 7.4, unmatched-as-null does not return null values; see https://3v4l.org/v3HE4 assertType('array{0: string, major: string, 1: string, minor: string, 2: string, patch?: string, 3?: string}', $matches); } diff --git a/tests/PHPStan/Analyser/nsrt/bug-11311.php b/tests/PHPStan/Analyser/nsrt/bug-11311.php index 2bb6bcad72..bb626412f5 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-11311.php +++ b/tests/PHPStan/Analyser/nsrt/bug-11311.php @@ -4,8 +4,8 @@ use function PHPStan\Testing\assertType; -function doFoo() { - if (1 === preg_match('/(?\d+)\.(?\d+)(?:\.(?\d+))?/', '12.5', $matches, PREG_UNMATCHED_AS_NULL)) { +function doFoo(string $s) { + if (1 === preg_match('/(?\d+)\.(?\d+)(?:\.(?\d+))?/', $s, $matches, PREG_UNMATCHED_AS_NULL)) { assertType('array{0: string, major: string|null, 1: string|null, minor: string|null, 2: string|null, patch: string|null, 3: string|null}', $matches); }