File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,6 +57,8 @@ class ArrayType implements Type
5757
5858 private Type $ keyType ;
5959
60+ private ?TrinaryLogic $ isList = null ;
61+
6062 /** @api */
6163 public function __construct (Type $ keyType , private Type $ itemType )
6264 {
@@ -262,15 +264,19 @@ public function isConstantArray(): TrinaryLogic
262264
263265 public function isList (): TrinaryLogic
264266 {
265- if (IntegerRangeType::fromInterval (0 , null )->isSuperTypeOf ($ this ->getKeyType ())->no ()) {
266- return TrinaryLogic::createNo ();
267- }
267+ if ($ this ->isList === null ) {
268+ if (IntegerRangeType::fromInterval (0 , null )->isSuperTypeOf ($ this ->getKeyType ())->no ()) {
269+ return $ this ->isList = TrinaryLogic::createNo ();
270+ }
268271
269- if ($ this ->getKeyType ()->isSuperTypeOf (new ConstantIntegerType (0 ))->no ()) {
270- return TrinaryLogic::createNo ();
272+ if ($ this ->getKeyType ()->isSuperTypeOf (new ConstantIntegerType (0 ))->no ()) {
273+ return $ this ->isList = TrinaryLogic::createNo ();
274+ }
275+
276+ return $ this ->isList = TrinaryLogic::createMaybe ();
271277 }
272278
273- return TrinaryLogic:: createMaybe () ;
279+ return $ this -> isList ;
274280 }
275281
276282 public function isConstantValue (): TrinaryLogic
You can’t perform that action at this time.
0 commit comments