We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4017da4 commit 50d11a3Copy full SHA for 50d11a3
tests/PHPStanTests/nsrt/preg-match.php
@@ -9,6 +9,8 @@ function doMatch(string $s): void
9
{
10
if (Preg::match('/Price: /i', $s, $matches)) {
11
assertType('array{string}', $matches);
12
+ } else {
13
+ assertType('array{}', $matches);
14
}
15
assertType('array{}|array{string}', $matches);
16
@@ -19,3 +21,23 @@ function doMatch(string $s): void
19
21
20
22
assertType('array{}|array{string, string}', $matches);
23
24
+
25
+function identicalMatch(string $s): void
26
+{
27
+ if (Preg::match('/Price: /i', $s, $matches) === 1) {
28
+ assertType('array{string}', $matches);
29
30
31
+ }
32
+ assertType('array{}|array{string}', $matches);
33
+}
34
35
+function equalMatch(string $s): void
36
37
+ if (Preg::match('/Price: /i', $s, $matches) == 1) {
38
39
40
41
42
43
0 commit comments