Skip to content

Commit 38c5cef

Browse files
committed
Make priority clearer
1 parent 7295ca8 commit 38c5cef

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Engine/Engine.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424

2525
class Engine
2626
{
27+
private const float STRONGEST_PRIORITY = -INF;
28+
private const float WEAKEST_PRIORITY = +INF;
29+
2730
/**
2831
* Get the evaluation result for a given context.
2932
*
@@ -63,8 +66,8 @@ public static function getEvaluationResult($context): EvaluationResult
6366
$evaluatedFeature = $evaluatedFeatures[$featureKey] ?? null;
6467
if ($evaluatedFeature) {
6568
$overrideWinsPriority =
66-
($overrideFeature->priority ?? INF) <
67-
($evaluatedFeature->priority ?? INF);
69+
($overrideFeature->priority ?? self::WEAKEST_PRIORITY) <
70+
($evaluatedFeature->priority ?? self::WEAKEST_PRIORITY);
6871
if (!$overrideWinsPriority) {
6972
continue;
7073
}

0 commit comments

Comments
 (0)