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
83 lines (68 loc) · 1.78 KB
/
bug-5207.php
File metadata and controls
83 lines (68 loc) · 1.78 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php // lint >= 8.0
declare(strict_types = 1);
namespace Bug5207;
use function PHPStan\Testing\assertType;
abstract class HelloWorld {
/** @phpstan-pure */
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 StaticWorld {
/** @phpstan-pure */
abstract public static function getChild(): ?StaticWorld;
public static function sayHello(): void {
$foo = null !== static::getChild();
if ($foo) {
assertType('Bug5207\StaticWorld', static::getChild());
}
}
public static function sayHelloInline(): void {
if (null !== static::getChild()) {
assertType('Bug5207\StaticWorld', static::getChild());
}
}
}
abstract class ImpureStaticWorld {
/**
* @phpstan-impure
*/
abstract public static function getChild(): ?ImpureStaticWorld;
public static function sayHello(): void {
$foo = null !== static::getChild();
if ($foo) {
assertType('Bug5207\ImpureStaticWorld|null', static::getChild());
}
}
public static function sayHelloInline(): void {
if (null !== static::getChild()) {
assertType('Bug5207\ImpureStaticWorld|null', static::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());
}
}
}