From fd3c3ec6e86456ac69d412b7008f3efae61ad69b Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Wed, 10 Jul 2024 11:50:00 +0200 Subject: [PATCH] fix test --- tests/PHPStan/Analyser/nsrt/bug-11311-php72.php | 4 ++-- tests/PHPStan/Analyser/nsrt/bug-11311.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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); }