File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,6 +61,8 @@ class ArrayType implements Type
6161 private Type $ keyType ;
6262
6363 private ?Type $ cachedIterableKeyType = null ;
64+
65+ private ?TrinaryLogic $ isList = null ;
6466
6567 /** @api */
6668 public function __construct (Type $ keyType , private Type $ itemType )
@@ -296,15 +298,19 @@ public function isConstantArray(): TrinaryLogic
296298
297299 public function isList (): TrinaryLogic
298300 {
299- if (IntegerRangeType::fromInterval (0 , null )->isSuperTypeOf ($ this ->getKeyType ())->no ()) {
300- return TrinaryLogic::createNo ();
301- }
301+ if ($ this ->isList === null ) {
302+ if (IntegerRangeType::fromInterval (0 , null )->isSuperTypeOf ($ this ->getKeyType ())->no ()) {
303+ return $ this ->isList = TrinaryLogic::createNo ();
304+ }
302305
303- if ($ this ->getKeyType ()->isSuperTypeOf (new ConstantIntegerType (0 ))->no ()) {
304- return TrinaryLogic::createNo ();
306+ if ($ this ->getKeyType ()->isSuperTypeOf (new ConstantIntegerType (0 ))->no ()) {
307+ return $ this ->isList = TrinaryLogic::createNo ();
308+ }
309+
310+ return $ this ->isList = TrinaryLogic::createMaybe ();
305311 }
306312
307- return TrinaryLogic:: createMaybe () ;
313+ return $ this -> isList ;
308314 }
309315
310316 public function isConstantValue (): TrinaryLogic
You can’t perform that action at this time.
0 commit comments