Skip to content

Commit 551545e

Browse files
committed
feat(policy): support resolution mode in policy spec
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 95f03c1 commit 551545e

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

lib/Service/Policy/Model/PolicySpec.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
use function sprintf;
1616

1717
final class PolicySpec implements IPolicyDefinition {
18+
public const RESOLUTION_MODE_RESOLVED = 'resolved';
19+
public const RESOLUTION_MODE_VALUE_CHOICE = 'value_choice';
20+
1821
/** @var list<mixed>|Closure(PolicyContext): list<mixed> */
1922
private array|Closure $allowedValuesResolver;
2023
/** @var Closure(mixed): mixed|null */
@@ -35,6 +38,7 @@ public function __construct(
3538
?Closure $validator = null,
3639
private ?string $appConfigKey = null,
3740
private ?string $userPreferenceKey = null,
41+
private string $resolutionMode = self::RESOLUTION_MODE_RESOLVED,
3842
) {
3943
$this->allowedValuesResolver = $allowedValues;
4044
$this->normalizer = $normalizer;
@@ -46,6 +50,11 @@ public function key(): string {
4650
return $this->key;
4751
}
4852

53+
#[\Override]
54+
public function resolutionMode(): string {
55+
return $this->resolutionMode;
56+
}
57+
4958
#[\Override]
5059
public function getAppConfigKey(): string {
5160
return $this->appConfigKey ?? $this->key;

0 commit comments

Comments
 (0)