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 @@ -846,18 +846,27 @@ public function walkSelectExpression($selectExpression)
846846 // the driver and PHP version.
847847 // Here we assume that the value may or may not be casted to
848848 // 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 {
850851 if ($ type instanceof UnionType || $ type instanceof IntersectionType) {
851852 return $ traverse ($ type );
852853 }
853854 if ($ type instanceof IntegerType || $ type instanceof FloatType) {
855+ $ casted = true ;
854856 return TypeCombinator::union ($ type ->toString (), $ type );
855857 }
856858 if ($ type instanceof BooleanType) {
859+ $ casted = true ;
857860 return TypeCombinator::union ($ type ->toInteger ()->toString (), $ type );
858861 }
859862 return $ traverse ($ type );
860863 });
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+ }
861870 }
862871
863872 $ this ->addScalar ($ resultAlias , $ type );
You can’t perform that action at this time.
0 commit comments