55use PHPStan \PhpDocParser \Ast \Type \GenericTypeNode ;
66use PHPStan \ShouldNotHappenException ;
77use PHPStan \TrinaryLogic ;
8+ use PHPStan \Type \AcceptsResult ;
89use PHPStan \Type \BenevolentUnionType ;
910use PHPStan \Type \IsSuperTypeOfResult ;
1011use PHPStan \Type \MixedType ;
@@ -134,30 +135,30 @@ public function isValidVariance(Type $a, Type $b): TrinaryLogic
134135 return $ this ->isValidVarianceWithReason (null , $ a , $ b )->result ;
135136 }
136137
137- public function isValidVarianceWithReason (?TemplateType $ templateType , Type $ a , Type $ b ): IsSuperTypeOfResult
138+ public function isValidVarianceWithReason (?TemplateType $ templateType , Type $ a , Type $ b ): AcceptsResult
138139 {
139140 if ($ b instanceof NeverType) {
140- return IsSuperTypeOfResult ::createYes ();
141+ return AcceptsResult ::createYes ();
141142 }
142143
143144 if ($ a instanceof MixedType && !$ a instanceof TemplateType) {
144- return IsSuperTypeOfResult ::createYes ();
145+ return AcceptsResult ::createYes ();
145146 }
146147
147148 if ($ a instanceof BenevolentUnionType) {
148149 if (!$ a ->isSuperTypeOf ($ b )->no ()) {
149- return IsSuperTypeOfResult ::createYes ();
150+ return AcceptsResult ::createYes ();
150151 }
151152 }
152153
153154 if ($ b instanceof BenevolentUnionType) {
154155 if (!$ b ->isSuperTypeOf ($ a )->no ()) {
155- return IsSuperTypeOfResult ::createYes ();
156+ return AcceptsResult ::createYes ();
156157 }
157158 }
158159
159160 if ($ b instanceof MixedType && !$ b instanceof TemplateType) {
160- return IsSuperTypeOfResult ::createYes ();
161+ return AcceptsResult ::createYes ();
161162 }
162163
163164 if ($ this ->invariant ()) {
@@ -177,19 +178,19 @@ public function isValidVarianceWithReason(?TemplateType $templateType, Type $a,
177178 }
178179 }
179180
180- return new IsSuperTypeOfResult (TrinaryLogic::createFromBoolean ($ result ), $ reasons );
181+ return new AcceptsResult (TrinaryLogic::createFromBoolean ($ result ), $ reasons );
181182 }
182183
183184 if ($ this ->covariant ()) {
184- return $ a ->isSuperTypeOfWithReason ($ b );
185+ return $ a ->isSuperTypeOfWithReason ($ b )-> toAcceptsResult () ;
185186 }
186187
187188 if ($ this ->contravariant ()) {
188- return $ b ->isSuperTypeOfWithReason ($ a );
189+ return $ b ->isSuperTypeOfWithReason ($ a )-> toAcceptsResult () ;
189190 }
190191
191192 if ($ this ->bivariant ()) {
192- return IsSuperTypeOfResult ::createYes ();
193+ return AcceptsResult ::createYes ();
193194 }
194195
195196 throw new ShouldNotHappenException ();
0 commit comments