Skip to content

Commit 5a7fa2f

Browse files
committed
Fix redundant type casts
1 parent 35e5824 commit 5a7fa2f

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

NumberFormatter/NumberFormatter.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ public function __construct(?string $locale = 'en', int $style = null, $pattern
272272
throw new MethodArgumentNotImplementedException(__METHOD__, 'pattern');
273273
}
274274

275-
$this->style = null !== $style ? (int) $style : null;
275+
$this->style = $style;
276276
}
277277

278278
/**
@@ -796,8 +796,6 @@ private function isInitializedAttribute(string $attr): bool
796796
*/
797797
private function convertValueDataType($value, int $type)
798798
{
799-
$type = (int) $type;
800-
801799
if (self::TYPE_DOUBLE === $type) {
802800
$value = (float) $value;
803801
} elseif (self::TYPE_INT32 === $type) {

Tests/NumberFormatter/AbstractNumberFormatterTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -674,12 +674,12 @@ public function parseProvider()
674674
return [
675675
['prefix1', false, '->parse() does not parse a number with a string prefix.', 0],
676676
['prefix1', false, '->parse() does not parse a number with a string prefix.', 0, false],
677-
['1.4suffix', (float) 1.4, '->parse() parses a number with a string suffix.', 3],
678-
['1.4suffix', (float) 1.4, '->parse() parses a number with a string suffix.', 3, false],
677+
['1.4suffix', 1.4, '->parse() parses a number with a string suffix.', 3],
678+
['1.4suffix', 1.4, '->parse() parses a number with a string suffix.', 3, false],
679679
['1,234.4suffix', 1234.4, '->parse() parses a number with a string suffix.', 7],
680680
['1,234.4suffix', 1.0, '->parse() parses a number with a string suffix.', 1, false],
681-
['-.4suffix', (float) -0.4, '->parse() parses a negative dot float with suffix.', 3],
682-
['-.4suffix', (float) -0.4, '->parse() parses a negative dot float with suffix.', 3, false],
681+
['-.4suffix', -0.4, '->parse() parses a negative dot float with suffix.', 3],
682+
['-.4suffix', -0.4, '->parse() parses a negative dot float with suffix.', 3, false],
683683
[',4', false, '->parse() does not parse when invalid grouping used.', 0],
684684
[',4', false, '->parse() does not parse when invalid grouping used.', 0, false],
685685
['123,4', false, '->parse() does not parse when invalid grouping used.', 0],

0 commit comments

Comments
 (0)