Skip to content

Commit 3d51653

Browse files
herndlmondrejmirtes
authored andcommitted
Fix a couple of nullOr* tests
1 parent 895cbf2 commit 3d51653

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

tests/Type/WebMozartAssert/data/string.php

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class TestStrings
88
{
99

10-
public function length(string $a, string $b, string $c): void
10+
public function length(string $a, string $b, string $c, ?string $d): void
1111
{
1212
Assert::length($a, 0);
1313
\PHPStan\Testing\assertType('\'\'', $a);
@@ -16,10 +16,13 @@ public function length(string $a, string $b, string $c): void
1616
\PHPStan\Testing\assertType('non-empty-string', $b);
1717

1818
Assert::nullOrLength($c, 1);
19-
\PHPStan\Testing\assertType('non-empty-string', $c); // should be non-empty-string|null
19+
\PHPStan\Testing\assertType('non-empty-string', $c);
20+
21+
Assert::nullOrLength($d, 1);
22+
\PHPStan\Testing\assertType('string|null', $d); // should be non-empty-string|null
2023
}
2124

22-
public function minLength(string $a, string $b, string $c): void
25+
public function minLength(string $a, string $b, string $c, ?string $d): void
2326
{
2427
Assert::minLength($a, 0);
2528
\PHPStan\Testing\assertType('string', $a);
@@ -28,10 +31,13 @@ public function minLength(string $a, string $b, string $c): void
2831
\PHPStan\Testing\assertType('non-empty-string', $b);
2932

3033
Assert::nullOrMinLength($c, 1);
31-
\PHPStan\Testing\assertType('non-empty-string', $c); // should be non-empty-string|null
34+
\PHPStan\Testing\assertType('non-empty-string', $c);
35+
36+
Assert::nullOrMinLength($d, 1);
37+
\PHPStan\Testing\assertType('string|null', $d); // should be non-empty-string|null
3238
}
3339

34-
public function maxLength(string $a, string $b, string $c): void
40+
public function maxLength(string $a, string $b, string $c, ?string $d): void
3541
{
3642
Assert::maxLength($a, 0);
3743
\PHPStan\Testing\assertType('\'\'', $a);
@@ -40,10 +46,13 @@ public function maxLength(string $a, string $b, string $c): void
4046
\PHPStan\Testing\assertType('string', $b);
4147

4248
Assert::nullOrMaxLength($c, 1);
43-
\PHPStan\Testing\assertType('string', $c); // should be string|null
49+
\PHPStan\Testing\assertType('string', $c);
50+
51+
Assert::nullOrMaxLength($d, 1);
52+
\PHPStan\Testing\assertType('string|null', $d);
4453
}
4554

46-
public function lengthBetween(string $a, string $b, string $c, string $d, string $e): void
55+
public function lengthBetween(string $a, string $b, string $c, string $d, string $e, ?string $f): void
4756
{
4857
Assert::lengthBetween($a, 0, 0);
4958
\PHPStan\Testing\assertType('\'\'', $a);
@@ -58,7 +67,10 @@ public function lengthBetween(string $a, string $b, string $c, string $d, string
5867
\PHPStan\Testing\assertType('non-empty-string', $d);
5968

6069
Assert::nullOrLengthBetween($e, 1, 1);
61-
\PHPStan\Testing\assertType('non-empty-string', $e); // should be non-empty-string|null
70+
\PHPStan\Testing\assertType('non-empty-string', $e);
71+
72+
Assert::nullOrLengthBetween($f, 1, 1);
73+
\PHPStan\Testing\assertType('string|null', $f); // should be non-empty-string|null
6274
}
6375

6476
}

0 commit comments

Comments
 (0)