From 0fdd3018da45433c04339612dee7a2b176c82095 Mon Sep 17 00:00:00 2001 From: Smoren Date: Mon, 18 Mar 2024 10:35:03 +0300 Subject: [PATCH] Use root namespace for std functions explicitly --- src/Structs/NormalizedSlice.php | 2 +- src/Structs/Slice.php | 2 +- src/Util.php | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Structs/NormalizedSlice.php b/src/Structs/NormalizedSlice.php index e7044e3..05a507b 100644 --- a/src/Structs/NormalizedSlice.php +++ b/src/Structs/NormalizedSlice.php @@ -65,7 +65,7 @@ public function getStep(): int */ public function count(): int { - return intval(ceil(abs((($this->end - $this->start) / $this->step)))); + return \intval(\ceil(\abs((($this->end - $this->start) / $this->step)))); } /** diff --git a/src/Structs/Slice.php b/src/Structs/Slice.php index 56d056c..5fffc6c 100644 --- a/src/Structs/Slice.php +++ b/src/Structs/Slice.php @@ -47,7 +47,7 @@ public static function toSlice($s): Slice } if (!self::isSliceString($s)) { - $str = \is_scalar($s) ? "{$s}" : gettype($s); + $str = \is_scalar($s) ? "{$s}" : \gettype($s); throw new ValueError("Invalid slice: \"{$str}\"."); } diff --git a/src/Util.php b/src/Util.php index 6eb12f3..7b51f9e 100644 --- a/src/Util.php +++ b/src/Util.php @@ -26,7 +26,7 @@ class Util */ public static function normalizeIndex(int $index, int $containerLength, bool $throwError = true): int { - $dist = $index >= 0 ? $index : abs($index) - 1; + $dist = $index >= 0 ? $index : \abs($index) - 1; if ($throwError && $dist >= $containerLength) { throw new IndexError("Index {$index} is out of range."); } @@ -43,9 +43,9 @@ public static function normalizeIndex(int $index, int $containerLength, bool $th */ public static function isArraySequential(array $source, bool $forceCustomImplementation = false): bool { - if (!function_exists('array_is_list') || $forceCustomImplementation) { - return \count($source) === 0 || array_keys($source) === range(0, count($source) - 1); + if (!\function_exists('array_is_list') || $forceCustomImplementation) { + return \count($source) === 0 || \array_keys($source) === \range(0, \count($source) - 1); } - return array_is_list($source); + return \array_is_list($source); } }