This commit is contained in:
Fabien Potencier 2020-09-11 07:50:30 +02:00
parent 44dd80f3fd
commit 1b5f996378
5 changed files with 10 additions and 10 deletions

View File

@ -251,7 +251,7 @@ class NumberToLocalizedStringTransformer implements DataTransformerInterface
{
if (null !== $this->scale && null !== $this->roundingMode) {
// shift number to maintain the correct scale during rounding
$roundingCoef = pow(10, $this->scale);
$roundingCoef = 10 ** $this->scale;
// string representation to avoid rounding errors, similar to bcmul()
$number = (string) ($number * $roundingCoef);

View File

@ -338,10 +338,10 @@ abstract class AbstractRequestHandlerTest extends TestCase
public function getPostMaxSizeFixtures()
{
return [
[pow(1024, 3) + 1, '1G', true, ['{{ max }}' => '1G']],
[pow(1024, 3), '1G', false],
[pow(1024, 2) + 1, '1M', true, ['{{ max }}' => '1M']],
[pow(1024, 2), '1M', false],
[1024 ** 3 + 1, '1G', true, ['{{ max }}' => '1G']],
[1024 ** 3, '1G', false],
[1024 ** 2 + 1, '1M', true, ['{{ max }}' => '1M']],
[1024 ** 2, '1M', false],
[1024 + 1, '1K', true, ['{{ max }}' => '1K']],
[1024, '1K', false],
[null, '1K', false],

View File

@ -89,7 +89,7 @@ class CachingHttpClientTest extends TestCase
'test', [
'response_headers' => [
'X-Content-Digest' => 'some-hash',
]
],
]));
$headers = $response->getHeaders();
@ -100,7 +100,7 @@ class CachingHttpClientTest extends TestCase
{
$mockClient = new MockHttpClient($mockResponse);
$store = new Store(sys_get_temp_dir() . '/sf_http_cache');
$store = new Store(sys_get_temp_dir().'/sf_http_cache');
$client = new CachingHttpClient($mockClient, $store);
$response = $client->request('GET', 'http://test');

View File

@ -699,7 +699,7 @@ abstract class NumberFormatter
// Swiss rounding
if (0 < $roundingIncrement && 0 < $fractionDigits) {
$roundingFactor = $roundingIncrement / pow(10, $fractionDigits);
$roundingFactor = $roundingIncrement / 10 ** $fractionDigits;
$value = round($value / $roundingFactor) * $roundingFactor;
}
@ -721,7 +721,7 @@ abstract class NumberFormatter
if (isset(self::$phpRoundingMap[$roundingModeAttribute])) {
$value = round($value, $precision, self::$phpRoundingMap[$roundingModeAttribute]);
} elseif (isset(self::$customRoundingList[$roundingModeAttribute])) {
$roundingCoef = pow(10, $precision);
$roundingCoef = 10 ** $precision;
$value *= $roundingCoef;
$value = (float) (string) $value;

View File

@ -74,7 +74,7 @@ class MultiplierRetryStrategy implements RetryStrategyInterface
{
$retries = RedeliveryStamp::getRetryCountFromEnvelope($message);
$delay = $this->delayMilliseconds * pow($this->multiplier, $retries);
$delay = $this->delayMilliseconds * $this->multiplier ** $retries;
if ($delay > $this->maxDelayMilliseconds && 0 !== $this->maxDelayMilliseconds) {
return $this->maxDelayMilliseconds;