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