From a1e8324fb57f7093d9941f92463593d5d494dd55 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Thu, 29 May 2025 13:13:41 +0200 Subject: [PATCH] Use consistent shortest path terminology --- src/RLS/PolicyManagers/TableRLSManager.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/RLS/PolicyManagers/TableRLSManager.php b/src/RLS/PolicyManagers/TableRLSManager.php index 17711c97..8854a419 100644 --- a/src/RLS/PolicyManagers/TableRLSManager.php +++ b/src/RLS/PolicyManagers/TableRLSManager.php @@ -489,26 +489,26 @@ class TableRLSManager implements RLSPolicyManager } /** - * Determine if the passed path is better than the current shortest path. + * Determine if the passed path is preferred to the current shortest path. * - * Non-nullable paths are preferred over nullable paths. + * Non-nullable paths are preferred to nullable paths. * From paths of the same nullability, the shorter will be preferred. */ - protected function determineBetterPath(array $path, array $currentBestPath): bool + protected function determineBetterPath(array $path, array $shortestPath): bool { - if (! $currentBestPath) { + if (! $shortestPath) { return true; } $pathIsNullable = $this->isPathNullable($path['steps']); - $bestPathIsNullable = $this->isPathNullable($currentBestPath['steps']); + $shortestPathIsNullable = $this->isPathNullable($shortestPath['steps']); // Prefer non-nullable - if ($pathIsNullable !== $bestPathIsNullable) { + if ($pathIsNullable !== $shortestPathIsNullable) { return ! $pathIsNullable; } // Prefer shorter - return count($path['steps']) < count($currentBestPath['steps']); + return count($path['steps']) < count($shortestPath['steps']); } }