File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 44
55use PhpParser \Node \Expr ;
66use PHPStan \TrinaryLogic ;
7+ use PHPStan \Type \IsSuperTypeOfResult ;
78use PHPStan \Type \Type ;
89use PHPStan \Type \TypeCombinator ;
910
@@ -50,17 +51,21 @@ public function equals(self $other): bool
5051 return $ this ->type === $ other ->type || $ this ->type ->equals ($ other ->type );
5152 }
5253
53- public function isSuperTypeOf (self $ other ): bool
54+ public function isSuperTypeOf (self $ other ): IsSuperTypeOfResult
5455 {
5556 if ($ this === $ other ) {
56- return true ;
57+ return IsSuperTypeOfResult:: createYes () ;
5758 }
5859
5960 if (!$ this ->certainty ->equals ($ other ->certainty )) {
60- return false ;
61+ return IsSuperTypeOfResult::createNo ();
62+ }
63+
64+ if ($ this ->type === $ other ->type ) {
65+ return IsSuperTypeOfResult::createYes ();
6166 }
6267
63- return $ this ->type === $ other -> type || $ this -> type -> isSuperTypeOf ($ other ->type )-> yes ( );
68+ return $ this ->type -> isSuperTypeOf ($ other ->type );
6469 }
6570
6671 public function and (self $ other ): self
Original file line number Diff line number Diff line change @@ -3230,7 +3230,7 @@ public function filterBySpecifiedTypes(SpecifiedTypes $specifiedTypes): self
32303230 }
32313231 if (!$ specifiedExpressions [$ holderExprString ]->equals ($ conditionalTypeHolder )) {
32323232 $ allExact = false ;
3233- if (!$ conditionalTypeHolder ->isSuperTypeOf ($ specifiedExpressions [$ holderExprString ])) {
3233+ if (!$ conditionalTypeHolder ->isSuperTypeOf ($ specifiedExpressions [$ holderExprString ])-> yes () ) {
32343234 $ allSuperType = false ;
32353235 break ;
32363236 }
You can’t perform that action at this time.
0 commit comments