File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed
tests/PHPStan/Analyser/nsrt Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments