@@ -471,10 +471,6 @@ public function walkFunction($function): string
471
471
}
472
472
473
473
if ($ this ->containsOnlyNumericTypes ($ exprTypeNoNull )) {
474
- if ($ this ->driverType === DriverDetector::PDO_PGSQL ) {
475
- return $ this ->marshalType ($ this ->createNumericString ($ nullable ));
476
- }
477
-
478
474
return $ this ->marshalType ($ exprType ); // retains underlying type
479
475
}
480
476
@@ -627,13 +623,7 @@ public function walkFunction($function): string
627
623
$ type = TypeCombinator::addNull ($ type );
628
624
}
629
625
630
- } elseif ($ this ->driverType === DriverDetector::PDO_PGSQL ) {
631
- $ type = new IntersectionType ([
632
- new StringType (),
633
- new AccessoryNumericStringType (),
634
- ]);
635
-
636
- } elseif ($ this ->driverType === DriverDetector::PGSQL ) {
626
+ } elseif ($ this ->driverType === DriverDetector::PGSQL || $ this ->driverType === DriverDetector::PDO_PGSQL ) {
637
627
$ castedExprType = $ this ->castStringLiteralForNumericExpression ($ exprTypeNoNull );
638
628
639
629
if ($ castedExprType ->isInteger ()->yes () || $ castedExprType ->isFloat ()->yes ()) {
@@ -1771,12 +1761,6 @@ private function inferPlusMinusTimesType(array $termTypes): Type
1771
1761
return $ this ->createInteger ($ nullable );
1772
1762
}
1773
1763
1774
- if ($ this ->driverType === DriverDetector::PDO_PGSQL ) {
1775
- if ($ this ->containsOnlyNumericTypes ($ unionWithoutNull )) {
1776
- return $ this ->createNumericString ($ nullable );
1777
- }
1778
- }
1779
-
1780
1764
if ($ this ->driverType === DriverDetector::SQLITE3 || $ this ->driverType === DriverDetector::PDO_SQLITE ) {
1781
1765
if (!$ this ->containsOnlyNumericTypes (...$ typesNoNull )) {
1782
1766
return new MixedType ();
@@ -1791,7 +1775,7 @@ private function inferPlusMinusTimesType(array $termTypes): Type
1791
1775
return $ this ->createFloatOrInt ($ nullable );
1792
1776
}
1793
1777
1794
- if ($ this ->driverType === DriverDetector::MYSQLI || $ this ->driverType === DriverDetector::PDO_MYSQL || $ this ->driverType === DriverDetector::PGSQL ) {
1778
+ if ($ this ->driverType === DriverDetector::MYSQLI || $ this ->driverType === DriverDetector::PDO_MYSQL || $ this ->driverType === DriverDetector::PGSQL || $ this -> driverType === DriverDetector:: PDO_PGSQL ) {
1795
1779
if ($ this ->containsOnlyTypes ($ unionWithoutNull , [new IntegerType (), new FloatType ()])) {
1796
1780
return $ this ->createFloat ($ nullable );
1797
1781
}
@@ -1857,12 +1841,6 @@ private function inferDivisionType(array $termTypes): Type
1857
1841
return new MixedType ();
1858
1842
}
1859
1843
1860
- if ($ this ->driverType === DriverDetector::PDO_PGSQL ) {
1861
- if ($ this ->containsOnlyTypes ($ unionWithoutNull , [new IntegerType (), new FloatType (), $ this ->createNumericString (false )])) {
1862
- return $ this ->createNumericString ($ nullable );
1863
- }
1864
- }
1865
-
1866
1844
if ($ this ->driverType === DriverDetector::SQLITE3 || $ this ->driverType === DriverDetector::PDO_SQLITE ) {
1867
1845
if (!$ this ->containsOnlyNumericTypes (...$ typesNoNull )) {
1868
1846
return new MixedType ();
@@ -1877,7 +1855,7 @@ private function inferDivisionType(array $termTypes): Type
1877
1855
return $ this ->createFloatOrInt ($ nullable );
1878
1856
}
1879
1857
1880
- if ($ this ->driverType === DriverDetector::MYSQLI || $ this ->driverType === DriverDetector::PDO_MYSQL || $ this ->driverType === DriverDetector::PGSQL ) {
1858
+ if ($ this ->driverType === DriverDetector::MYSQLI || $ this ->driverType === DriverDetector::PDO_MYSQL || $ this ->driverType === DriverDetector::PGSQL || $ this -> driverType === DriverDetector:: PDO_PGSQL ) {
1881
1859
if ($ this ->containsOnlyTypes ($ unionWithoutNull , [new IntegerType (), new FloatType ()])) {
1882
1860
return $ this ->createFloat ($ nullable );
1883
1861
}
@@ -2100,6 +2078,9 @@ private function hasAggregateWithoutGroupBy(): bool
2100
2078
* - pdo_sqlite: https://github.com/php/php-src/commit/438b025a28cda2935613af412fc13702883dd3a2
2101
2079
* - pdo_pgsql: https://github.com/php/php-src/commit/737195c3ae6ac53b9501cfc39cc80fd462909c82
2102
2080
*
2081
+ * Notable 8.4 changes:
2082
+ * - pdo_pgsql: https://github.com/php/php-src/commit/6d10a6989897e9089d62edf939344437128e93ad
2083
+ *
2103
2084
* @param IntegerType|FloatType|BooleanType $type
2104
2085
*/
2105
2086
private function shouldStringifyExpressions (Type $ type ): TrinaryLogic
@@ -2144,7 +2125,14 @@ private function shouldStringifyExpressions(Type $type): TrinaryLogic
2144
2125
}
2145
2126
2146
2127
return TrinaryLogic::createNo ();
2128
+ }
2147
2129
2130
+ if ($ type ->isFloat ()->yes ()) {
2131
+ if ($ this ->phpVersion ->getVersionId () >= 80400 ) {
2132
+ return TrinaryLogic::createFromBoolean ($ stringifyFetches );
2133
+ }
2134
+
2135
+ return TrinaryLogic::createYes ();
2148
2136
}
2149
2137
2150
2138
return TrinaryLogic::createFromBoolean ($ stringifyFetches );
0 commit comments