File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed
tests/PHPStan/Analyser/nsrt Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php declare (strict_types = 1 );
2+
3+ namespace Bug13358 ;
4+
5+ use function PHPStan \Testing \assertType ;
6+
7+ /**
8+ * @phpstan-sealed SystemActor|AnonymousVisitorActor
9+ */
10+ abstract class Actor
11+ {
12+ /**
13+ * @phpstan-assert-if-true SystemActor $this
14+ */
15+ public function isSystem () : bool
16+ {
17+ return $ this instanceof SystemActor;
18+ }
19+
20+ /**
21+ * @phpstan-assert-if-true AnonymousVisitorActor $this
22+ */
23+ public function isAnonymousVisitor () : bool
24+ {
25+ return $ this instanceof AnonymousVisitorActor;
26+ }
27+ }
28+
29+ class SystemActor extends Actor
30+ {
31+ }
32+
33+ class AnonymousVisitorActor extends Actor
34+ {
35+ }
36+
37+ function (AnonymousVisitorActor |SystemActor $ actor ): void {
38+ assertType ('Bug13358\AnonymousVisitorActor|Bug13358\SystemActor ' , $ actor );
39+
40+ if ($ actor ->isSystem ()) {
41+ assertType ('Bug13358\SystemActor ' , $ actor );
42+ } else {
43+ assertType ('Bug13358\AnonymousVisitorActor ' , $ actor );
44+ }
45+ };
You can’t perform that action at this time.
0 commit comments