From 2943cc61b199e2489a5e514f707d495711280997 Mon Sep 17 00:00:00 2001 From: Hugo Rafael Azevedo Date: Fri, 31 May 2019 15:42:25 +0100 Subject: [PATCH] Removed `intval()` usage. --- src/Scalar/AbstractReadString.php | 4 ++-- src/Scalar/AbstractWriteInteger.php | 2 +- src/Scalar/ImmutableInteger.php | 2 +- src/Scalar/MutableInteger.php | 2 +- src/Scalar/ReadonlyInteger.php | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Scalar/AbstractReadString.php b/src/Scalar/AbstractReadString.php index 7aae0b7..b3a21a2 100644 --- a/src/Scalar/AbstractReadString.php +++ b/src/Scalar/AbstractReadString.php @@ -233,8 +233,8 @@ public function count(string $search, int $start = 0, int $length = null): int protected function validateStartAndLength(int $start, ?int $length): void { // Calculates the absolute values for validations. - $absStart = \intval(\abs($start)); - $absLength = \intval(\abs($length)); + $absStart = (int) \abs($start); + $absLength = (int) \abs($length); // Validates the starting value. if ($absStart > $this->length()) { diff --git a/src/Scalar/AbstractWriteInteger.php b/src/Scalar/AbstractWriteInteger.php index 67a8946..9d3fca6 100644 --- a/src/Scalar/AbstractWriteInteger.php +++ b/src/Scalar/AbstractWriteInteger.php @@ -63,6 +63,6 @@ protected function doMultiply(int $value): int */ protected function doDivide(int $value): int { - return \intval($this->value / $value); + return ((int) ($this->value / $value)); } } diff --git a/src/Scalar/ImmutableInteger.php b/src/Scalar/ImmutableInteger.php index 834456e..a871cc2 100644 --- a/src/Scalar/ImmutableInteger.php +++ b/src/Scalar/ImmutableInteger.php @@ -35,7 +35,7 @@ public static function fromString(string $number): ImmutableInteger } return new ImmutableInteger( - \intval($number) + ((int) $number) ); } diff --git a/src/Scalar/MutableInteger.php b/src/Scalar/MutableInteger.php index fd17c1c..fdce060 100644 --- a/src/Scalar/MutableInteger.php +++ b/src/Scalar/MutableInteger.php @@ -37,7 +37,7 @@ public static function fromString(string $number): MutableInteger } return new MutableInteger( - \intval($number) + ((int) $number) ); } diff --git a/src/Scalar/ReadonlyInteger.php b/src/Scalar/ReadonlyInteger.php index 4f1b27c..c9c769a 100644 --- a/src/Scalar/ReadonlyInteger.php +++ b/src/Scalar/ReadonlyInteger.php @@ -36,7 +36,7 @@ public static function fromString(string $number): ReadonlyInteger } return new ReadonlyInteger( - \intval($number) + ((int) $number) ); }