File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 33namespace PHPStan \Analyser ;
44
55use PhpParser \Node \Expr ;
6+ use PHPStan \Type \GeneralizePrecision ;
67use PHPStan \Type \Type ;
78use PHPStan \Type \TypeCombinator ;
9+ use PHPStan \Type \UnionType ;
810use function array_key_exists ;
911use function array_merge ;
1012
1113final class SpecifiedTypes
1214{
15+ private const MAX_SURE_NOT_TYPES = 8 ;
1316
1417 private bool $ overwrite = false ;
1518
@@ -179,6 +182,10 @@ public function unionWith(SpecifiedTypes $other): self
179182 continue ;
180183 }
181184
185+ if ($ type instanceof UnionType && count ($ type ->getTypes ()) >= self ::MAX_SURE_NOT_TYPES ) {
186+ continue ;
187+ }
188+
182189 $ sureNotTypeUnion [$ exprString ] = [
183190 $ exprNode ,
184191 TypeCombinator::union ($ type , $ other ->sureNotTypes [$ exprString ][1 ]),
You can’t perform that action at this time.
0 commit comments