Skip to content

Commit b08d974

Browse files
committed
more tests
1 parent 1685f3e commit b08d974

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

tests/PHPStan/Analyser/nsrt/remember-non-nullable-property.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,21 @@ public function doFoo(): void {
1919
}
2020
}
2121

22+
class DontCoercePhpdocType {
23+
/** @var int */
24+
private $i;
25+
26+
public function __construct()
27+
{
28+
$this->i = getIntOrNull();
29+
}
30+
31+
public function doFoo(): void {
32+
assertType('mixed', $this->i);
33+
assertNativeType('mixed', $this->i);
34+
}
35+
}
36+
2237
function getIntOrNull(): ?int {
2338
if (rand(0, 1) === 0) {
2439
return null;
@@ -52,8 +67,8 @@ function getIntOrFloatOrNull(): null|int|float {
5267
return 1;
5368
}
5469

55-
class NarrowsUnion {
56-
private readonly int|float $i;
70+
class NarrowsNativeUnion {
71+
private int|float $i;
5772

5873
public function __construct()
5974
{

0 commit comments

Comments
 (0)