File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -849,18 +849,27 @@ public function walkSelectExpression($selectExpression): string
849
849
// the driver and PHP version.
850
850
// Here we assume that the value may or may not be casted to
851
851
// string by the driver.
852
- $ type = TypeTraverser::map ($ type , static function (Type $ type , callable $ traverse ): Type {
852
+ $ casted = false ;
853
+ $ type = TypeTraverser::map ($ type , static function (Type $ type , callable $ traverse ) use (&$ casted ): Type {
853
854
if ($ type instanceof UnionType || $ type instanceof IntersectionType) {
854
855
return $ traverse ($ type );
855
856
}
856
857
if ($ type instanceof IntegerType || $ type instanceof FloatType) {
858
+ $ casted = true ;
857
859
return TypeCombinator::union ($ type ->toString (), $ type );
858
860
}
859
861
if ($ type instanceof BooleanType) {
862
+ $ casted = true ;
860
863
return TypeCombinator::union ($ type ->toInteger ()->toString (), $ type );
861
864
}
862
865
return $ traverse ($ type );
863
866
});
867
+
868
+ // Since we made supposition about possibly casted values,
869
+ // we can only provide a benevolent union.
870
+ if ($ casted && $ type instanceof UnionType) {
871
+ $ type = TypeUtils::toBenevolentUnion ($ type );
872
+ }
864
873
}
865
874
866
875
$ this ->addScalar ($ resultAlias , $ type );
You can’t perform that action at this time.
0 commit comments