diff --git a/src/QueryReflection/QueryReflection.php b/src/QueryReflection/QueryReflection.php index 9b749804..97207ce7 100644 --- a/src/QueryReflection/QueryReflection.php +++ b/src/QueryReflection/QueryReflection.php @@ -344,6 +344,12 @@ private function resolveQueryExpr(Expr $queryExpr, Scope $scope): ?string */ private function resolveQueryStringExpr(Expr $queryExpr, Scope $scope, bool $resolveVariables = true): ?string { + $type = $scope->getType($queryExpr); + $constStrings = $type->getConstantStrings(); + if (count($constStrings) === 1) { + return QuerySimulation::simulateParamValueType($constStrings[0], false); + } + if (true === $resolveVariables && $queryExpr instanceof Expr\Variable) { $finder = new ExpressionFinder(); // atm we cannot reason about variables which are manipulated via assign ops @@ -399,8 +405,6 @@ private function resolveQueryStringExpr(Expr $queryExpr, Scope $scope, bool $res return $string; } - $type = $scope->getType($queryExpr); - return QuerySimulation::simulateParamValueType($type, false); }