Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Psalm/Type/Atomic/TKeyedArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,8 @@
return $prop_min_count;
}

/** @var int<1, max>|null */
private ?int $prop_max_count = null;
/**
* Returns null if there is no upper limit.
*
Expand All @@ -465,14 +467,17 @@
if ($this->fallback_params) {
return null;
}
if ($this->prop_max_count !== null) {
return $this->prop_max_count;
}
$prop_max_count = 0;
foreach ($this->properties as $property) {
if (!$property->isNever()) {
$prop_max_count++;
}
}
assert($prop_max_count !== 0);
return $prop_max_count;
return $this->prop_max_count = $prop_max_count;

Check failure on line 480 in src/Psalm/Type/Atomic/TKeyedArray.php

View workflow job for this annotation

GitHub Actions / build

InaccessibleProperty

src/Psalm/Type/Atomic/TKeyedArray.php:480:16: InaccessibleProperty: Psalm\Type\Atomic\TKeyedArray::$prop_max_count is marked readonly (see https://psalm.dev/054)

Check failure on line 480 in src/Psalm/Type/Atomic/TKeyedArray.php

View workflow job for this annotation

GitHub Actions / build

InaccessibleProperty

src/Psalm/Type/Atomic/TKeyedArray.php:480:16: InaccessibleProperty: Psalm\Type\Atomic\TKeyedArray::$prop_max_count is marked readonly (see https://psalm.dev/054)

Check failure on line 480 in src/Psalm/Type/Atomic/TKeyedArray.php

View workflow job for this annotation

GitHub Actions / build

InaccessibleProperty

src/Psalm/Type/Atomic/TKeyedArray.php:480:16: InaccessibleProperty: Psalm\Type\Atomic\TKeyedArray::$prop_max_count is marked readonly (see https://psalm.dev/054)

Check failure on line 480 in src/Psalm/Type/Atomic/TKeyedArray.php

View workflow job for this annotation

GitHub Actions / build

InaccessibleProperty

src/Psalm/Type/Atomic/TKeyedArray.php:480:16: InaccessibleProperty: Psalm\Type\Atomic\TKeyedArray::$prop_max_count is marked readonly (see https://psalm.dev/054)
}
/**
* Whether all keys are always defined (ignores unsealedness).
Expand Down
Loading