Skip to content

Commit 465301f

Browse files
committed
Update bug-5207b.php
1 parent 45e5b4a commit 465301f

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

tests/PHPStan/Analyser/nsrt/bug-5207b.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,26 @@ abstract public function getChild(): ?HelloWorld;
1212
public function sayHello(): void {
1313
$foo = null !== $this->getChild()->getChild();
1414
if ($foo) {
15-
assertType('Bug5207\HelloWorld', $this->getChild());
16-
assertType('Bug5207\HelloWorld', $this->getChild()->getChild());
15+
assertType('Bug5207b\HelloWorld|null', $this->getChild()); // could be Bug5207b\HelloWorld
16+
assertType('Bug5207b\HelloWorld', $this->getChild()->getChild());
17+
assertType('Bug5207b\HelloWorld|null', $this->getChild()->getChild()->getChild());
18+
}
19+
}
20+
21+
public function sayFoo(): void {
22+
$foo = null !== $this?->getChild()?->getChild();
23+
if ($foo) {
24+
assertType('Bug5207b\HelloWorld', $this->getChild());
25+
assertType('Bug5207b\HelloWorld', $this->getChild()->getChild());
26+
assertType('Bug5207b\HelloWorld|null', $this->getChild()->getChild()->getChild());
27+
}
28+
}
29+
30+
public function sayBar(): void {
31+
$foo = null !== $this?->getChild()->getChild();
32+
if ($foo) {
33+
assertType('Bug5207b\HelloWorld', $this->getChild());
34+
assertType('Bug5207b\HelloWorld', $this->getChild()->getChild());
1735
assertType('Bug5207b\HelloWorld|null', $this->getChild()->getChild()->getChild());
1836
}
1937
}

0 commit comments

Comments
 (0)