File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -455,6 +455,8 @@ public function getMinCount(): int
455
455
return $ prop_min_count ;
456
456
}
457
457
458
+ /** @var int<1, max>|null */
459
+ private ?int $ prop_max_count = null ;
458
460
/**
459
461
* Returns null if there is no upper limit.
460
462
*
@@ -465,14 +467,17 @@ public function getMaxCount(): ?int
465
467
if ($ this ->fallback_params ) {
466
468
return null ;
467
469
}
470
+ if ($ this ->prop_max_count !== null ) {
471
+ return $ this ->prop_max_count ;
472
+ }
468
473
$ prop_max_count = 0 ;
469
474
foreach ($ this ->properties as $ property ) {
470
475
if (!$ property ->isNever ()) {
471
476
$ prop_max_count ++;
472
477
}
473
478
}
474
479
assert ($ prop_max_count !== 0 );
475
- return $ prop_max_count ;
480
+ return $ this -> prop_max_count = $ prop_max_count ;
476
481
}
477
482
/**
478
483
* Whether all keys are always defined (ignores unsealedness).
You can’t perform that action at this time.
0 commit comments