← All changes
|
libraries/vendor/PhpSpreadsheet/Calculation/TextData/Format.php
+10
-11
3.3.1
→
3.4
View file →
| @@ -95,18 +95,15 @@ | ||
| 95 | 95 | $valueResult = round($value, $decimals); |
| 96 | 96 | if ($decimals < 0) { |
| 97 | 97 | $decimals = 0; |
| 98 | 98 | } |
| 99 | - if ($noCommas === false) { | |
| 100 | - $valueResult = number_format( | |
| 101 | - $valueResult, | |
| 102 | - $decimals, | |
| 103 | - StringHelper::getDecimalSeparator(), | |
| 104 | - StringHelper::getThousandsSeparator() | |
| 105 | - ); | |
| 106 | - } | |
| 107 | 99 | |
| 108 | - return (string) $valueResult; | |
| 100 | + return number_format( | |
| 101 | + $valueResult, | |
| 102 | + $decimals, | |
| 103 | + StringHelper::getDecimalSeparator(), | |
| 104 | + $noCommas ? '' : StringHelper::getThousandsSeparator() | |
| 105 | + ); | |
| 109 | 106 | } |
| 110 | 107 | |
| 111 | 108 | /** |
| 112 | 109 | * TEXT. |
| @@ -209,20 +206,22 @@ | ||
| 209 | 206 | $dateSetting = Functions::getReturnDateType(); |
| 210 | 207 | Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); |
| 211 | 208 | |
| 212 | 209 | if (str_contains($value, ':')) { |
| 210 | + /** @var DateTimeInterface|float|int|string */ | |
| 213 | 211 | $timeValue = Functions::scalar(DateTimeExcel\TimeValue::fromString($value)); |
| 214 | 212 | if ($timeValue !== ExcelError::VALUE()) { |
| 215 | 213 | Functions::setReturnDateType($dateSetting); |
| 216 | 214 | |
| 217 | - return $timeValue; //* @phpstan-ignore-line | |
| 215 | + return $timeValue; | |
| 218 | 216 | } |
| 219 | 217 | } |
| 218 | + /** @var DateTimeInterface|float|int|string */ | |
| 220 | 219 | $dateValue = Functions::scalar(DateTimeExcel\DateValue::fromString($value)); |
| 221 | 220 | if ($dateValue !== ExcelError::VALUE()) { |
| 222 | 221 | Functions::setReturnDateType($dateSetting); |
| 223 | 222 | |
| 224 | - return $dateValue; //* @phpstan-ignore-line | |
| 223 | + return $dateValue; | |
| 225 | 224 | } |
| 226 | 225 | Functions::setReturnDateType($dateSetting); |
| 227 | 226 | |
| 228 | 227 | return ExcelError::VALUE(); |