@@ -463,10 +463,6 @@ public function walkFunction($function): string
463
463
}
464
464
465
465
if ($ this ->containsOnlyNumericTypes ($ exprTypeNoNull )) {
466
- if ($ this ->driverType === DriverDetector::PDO_PGSQL ) {
467
- return $ this ->marshalType ($ this ->createNumericString ($ nullable ));
468
- }
469
-
470
466
return $ this ->marshalType ($ exprType ); // retains underlying type
471
467
}
472
468
@@ -619,13 +615,7 @@ public function walkFunction($function): string
619
615
$ type = TypeCombinator::addNull ($ type );
620
616
}
621
617
622
- } elseif ($ this ->driverType === DriverDetector::PDO_PGSQL ) {
623
- $ type = new IntersectionType ([
624
- new StringType (),
625
- new AccessoryNumericStringType (),
626
- ]);
627
-
628
- } elseif ($ this ->driverType === DriverDetector::PGSQL ) {
618
+ } elseif ($ this ->driverType === DriverDetector::PGSQL || $ this ->driverType === DriverDetector::PDO_PGSQL ) {
629
619
$ castedExprType = $ this ->castStringLiteralForNumericExpression ($ exprTypeNoNull );
630
620
631
621
if ($ castedExprType ->isInteger ()->yes () || $ castedExprType ->isFloat ()->yes ()) {
@@ -1763,12 +1753,6 @@ private function inferPlusMinusTimesType(array $termTypes): Type
1763
1753
return $ this ->createInteger ($ nullable );
1764
1754
}
1765
1755
1766
- if ($ this ->driverType === DriverDetector::PDO_PGSQL ) {
1767
- if ($ this ->containsOnlyNumericTypes ($ unionWithoutNull )) {
1768
- return $ this ->createNumericString ($ nullable );
1769
- }
1770
- }
1771
-
1772
1756
if ($ this ->driverType === DriverDetector::SQLITE3 || $ this ->driverType === DriverDetector::PDO_SQLITE ) {
1773
1757
if (!$ this ->containsOnlyNumericTypes (...$ typesNoNull )) {
1774
1758
return new MixedType ();
@@ -1783,7 +1767,7 @@ private function inferPlusMinusTimesType(array $termTypes): Type
1783
1767
return $ this ->createFloatOrInt ($ nullable );
1784
1768
}
1785
1769
1786
- if ($ this ->driverType === DriverDetector::MYSQLI || $ this ->driverType === DriverDetector::PDO_MYSQL || $ this ->driverType === DriverDetector::PGSQL ) {
1770
+ if ($ this ->driverType === DriverDetector::MYSQLI || $ this ->driverType === DriverDetector::PDO_MYSQL || $ this ->driverType === DriverDetector::PGSQL || $ this -> driverType === DriverDetector:: PDO_PGSQL ) {
1787
1771
if ($ this ->containsOnlyTypes ($ unionWithoutNull , [new IntegerType (), new FloatType ()])) {
1788
1772
return $ this ->createFloat ($ nullable );
1789
1773
}
@@ -1849,12 +1833,6 @@ private function inferDivisionType(array $termTypes): Type
1849
1833
return new MixedType ();
1850
1834
}
1851
1835
1852
- if ($ this ->driverType === DriverDetector::PDO_PGSQL ) {
1853
- if ($ this ->containsOnlyTypes ($ unionWithoutNull , [new IntegerType (), new FloatType (), $ this ->createNumericString (false )])) {
1854
- return $ this ->createNumericString ($ nullable );
1855
- }
1856
- }
1857
-
1858
1836
if ($ this ->driverType === DriverDetector::SQLITE3 || $ this ->driverType === DriverDetector::PDO_SQLITE ) {
1859
1837
if (!$ this ->containsOnlyNumericTypes (...$ typesNoNull )) {
1860
1838
return new MixedType ();
@@ -1869,7 +1847,7 @@ private function inferDivisionType(array $termTypes): Type
1869
1847
return $ this ->createFloatOrInt ($ nullable );
1870
1848
}
1871
1849
1872
- if ($ this ->driverType === DriverDetector::MYSQLI || $ this ->driverType === DriverDetector::PDO_MYSQL || $ this ->driverType === DriverDetector::PGSQL ) {
1850
+ if ($ this ->driverType === DriverDetector::MYSQLI || $ this ->driverType === DriverDetector::PDO_MYSQL || $ this ->driverType === DriverDetector::PGSQL || $ this -> driverType === DriverDetector:: PDO_PGSQL ) {
1873
1851
if ($ this ->containsOnlyTypes ($ unionWithoutNull , [new IntegerType (), new FloatType ()])) {
1874
1852
return $ this ->createFloat ($ nullable );
1875
1853
}
@@ -2090,6 +2068,9 @@ private function hasAggregateWithoutGroupBy(): bool
2090
2068
* - pdo_sqlite: https://github.com/php/php-src/commit/438b025a28cda2935613af412fc13702883dd3a2
2091
2069
* - pdo_pgsql: https://github.com/php/php-src/commit/737195c3ae6ac53b9501cfc39cc80fd462909c82
2092
2070
*
2071
+ * Notable 8.4 changes:
2072
+ * - pdo_pgsql: https://github.com/php/php-src/commit/6d10a6989897e9089d62edf939344437128e93ad
2073
+ *
2093
2074
* @param IntegerType|FloatType|BooleanType $type
2094
2075
*/
2095
2076
private function shouldStringifyExpressions (Type $ type ): TrinaryLogic
@@ -2134,7 +2115,14 @@ private function shouldStringifyExpressions(Type $type): TrinaryLogic
2134
2115
}
2135
2116
2136
2117
return TrinaryLogic::createNo ();
2118
+ }
2137
2119
2120
+ if ($ type ->isFloat ()->yes ()) {
2121
+ if ($ this ->phpVersion ->getVersionId () >= 80400 ) {
2122
+ return TrinaryLogic::createFromBoolean ($ stringifyFetches );
2123
+ }
2124
+
2125
+ return TrinaryLogic::createYes ();
2138
2126
}
2139
2127
2140
2128
return TrinaryLogic::createFromBoolean ($ stringifyFetches );
0 commit comments