forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbug-5207.php
More file actions
44 lines (35 loc) · 905 Bytes
/
bug-5207.php
File metadata and controls
44 lines (35 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php // lint >= 8.0
declare(strict_types = 1);
namespace Bug5207;
use function PHPStan\Testing\assertType;
abstract class HelloWorld {
abstract public function getChild(): ?HelloWorld;
public function sayHello(): void {
$foo = null !== $this->getChild();
if ($foo) {
assertType('Bug5207\HelloWorld', $this->getChild());
}
}
public function sayHelloInline(): void {
if (null !== $this->getChild()) {
assertType('Bug5207\HelloWorld', $this->getChild());
}
}
}
abstract class ImpureWorld {
/**
* @phpstan-impure
*/
abstract public function getChild(): ?ImpureWorld;
public function sayHello(): void {
$foo = null !== $this->getChild();
if ($foo) {
assertType('Bug5207\ImpureWorld|null', $this->getChild());
}
}
public function sayHelloInline(): void {
if (null !== $this->getChild()) {
assertType('Bug5207\ImpureWorld|null', $this->getChild());
}
}
}