Skip to content

Commit

Permalink
Use root namespace for std functions explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
Smoren committed Mar 18, 2024
1 parent ad87d02 commit 0fdd301
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Structs/NormalizedSlice.php
Original file line number Diff line number Diff line change
Expand Up @@ -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))));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Structs/Slice.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}\".");
}

Expand Down
8 changes: 4 additions & 4 deletions src/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}
Expand All @@ -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);
}
}

0 comments on commit 0fdd301

Please sign in to comment.