@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator

PHP 8.5: Remove deprecated non-canonical scalar type casts

Summary:
PHP 8.5 deprecates non-canonical scalar type casts.
See https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_non-standard_cast_names and https://wiki.php.net/rfc/deprecations_php_8_5

Closes T16317

Test Plan: In theory, run `./bin/arc unit --everything` (which fails with at least three known issues for me, sigh)

Reviewers: O1 Blessed Committers, mainframe98

Reviewed By: O1 Blessed Committers, mainframe98

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16317

Differential Revision: https://we.phorge.it/D26444

+16 -16
+1 -1
src/applications/conduit/parametertype/ConduitPointsParameterType.php
··· 14 14 } 15 15 16 16 if ($value !== null) { 17 - $value = (double)$value; 17 + $value = (float)$value; 18 18 if ($value < 0) { 19 19 $this->raiseValidationException( 20 20 $request,
+1 -1
src/applications/differential/controller/DifferentialController.php
··· 256 256 // Cast duration to a float since it used to be a string in some 257 257 // cases. 258 258 if (isset($map['duration'])) { 259 - $map['duration'] = (double)$map['duration']; 259 + $map['duration'] = (float)$map['duration']; 260 260 } 261 261 262 262 return $map;
+5 -5
src/applications/fact/chart/PhabricatorChartFunction.php
··· 234 234 235 235 $is_reversed = ($src > $dst); 236 236 if ($is_reversed) { 237 - $min = (double)$dst; 238 - $max = (double)$src; 237 + $min = (float)$dst; 238 + $max = (float)$src; 239 239 } else { 240 - $min = (double)$src; 241 - $max = (double)$dst; 240 + $min = (float)$src; 241 + $max = (float)$dst; 242 242 } 243 243 244 - $step = (double)($max - $min) / (double)($count - 1); 244 + $step = (float)($max - $min) / (float)($count - 1); 245 245 246 246 $steps = array(); 247 247 for ($cursor = $min; $cursor <= $max; $cursor += $step) {
+2 -2
src/applications/maniphest/xaction/ManiphestTaskPointsTransaction.php
··· 88 88 continue; 89 89 } 90 90 91 - if ((double)$new < 0) { 91 + if ((float)$new < 0) { 92 92 $errors[] = $this->newInvalidError( 93 93 pht('Points value must be nonnegative.')); 94 94 continue; ··· 116 116 $value = null; 117 117 } 118 118 if ($value !== null) { 119 - $value = (double)$value; 119 + $value = (float)$value; 120 120 } 121 121 return $value; 122 122 }
+1 -1
src/applications/project/engine/PhabricatorBoardResponseEngine.php
··· 205 205 206 206 public static function newTaskProperties($task) { 207 207 return array( 208 - 'points' => (double)$task->getPoints(), 208 + 'points' => (float)$task->getPoints(), 209 209 'status' => $task->getStatus(), 210 210 'priority' => (int)$task->getPriority(), 211 211 'owner' => $task->getOwnerPHID(),
+1 -1
src/applications/project/order/PhabricatorProjectColumnPointsOrder.php
··· 42 42 43 43 return array( 44 44 $overall_order, 45 - -1.0 * (double)$points, 45 + -1.0 * (float)$points, 46 46 -1 * (int)$object->getID(), 47 47 ); 48 48 }
+1 -1
src/applications/search/management/PhabricatorSearchManagementNgramsWorkflow.php
··· 48 48 pht('Specify a numeric threshold between 0 and 1.')); 49 49 } 50 50 51 - $threshold = (double)$threshold; 51 + $threshold = (float)$threshold; 52 52 if ($threshold <= 0 || $threshold >= 1) { 53 53 throw new PhutilArgumentUsageException( 54 54 pht('Threshold must be greater than 0.0 and less than 1.0.'));
+1 -1
src/infrastructure/export/field/PhabricatorDoubleExportField.php
··· 11 11 return $value; 12 12 } 13 13 14 - return (double)$value; 14 + return (float)$value; 15 15 } 16 16 17 17 /**
+3 -3
src/infrastructure/markup/markuprule/PhutilRemarkupHexColorCodeRule.php
··· 24 24 list($r, $g, $b) = array_map('hexdec', $colors_hex); 25 25 // Calculation adapted from Myndex, CC BY-SA 4.0 26 26 // https://stackoverflow.com/a/69869976 27 - $y = pow((double)$r / 255.0, 2.2) * 0.2126 + 28 - pow((double)$g / 255.0, 2.2) * 0.7152 + 29 - pow((double)$b / 255.0, 2.2) * 0.0722; 27 + $y = pow((float)$r / 255.0, 2.2) * 0.2126 + 28 + pow((float)$g / 255.0, 2.2) * 0.7152 + 29 + pow((float)$b / 255.0, 2.2) * 0.0722; 30 30 31 31 return ($y < 0.34) ? 'white' : 'black'; 32 32 }