Skip to content

Commit 80ab722

Browse files
committed
fix(policy): treat empty allowed values as unconstrained
Signed-off-by: Vitor Mattos <[email protected]>
1 parent 808247b commit 80ab722

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

lib/Service/Policy/Model/PolicySpec.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ public function validateValue(mixed $value, PolicyContext $context): void {
8282
return;
8383
}
8484

85+
// Empty allowedValues means "no explicit restriction" for this policy key.
86+
if ($this->allowedValues($context) === []) {
87+
return;
88+
}
89+
8590
if (!in_array($value, $this->allowedValues($context), true)) {
8691
throw new \InvalidArgumentException(sprintf('Invalid value for %s', $this->key()));
8792
}

0 commit comments

Comments
 (0)