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