diff --git a/src/Number/random.php b/src/Number/random.php index 7da25a7..8d322af 100644 --- a/src/Number/random.php +++ b/src/Number/random.php @@ -74,5 +74,5 @@ function random($lower = null, $upper = null, $floating = null) return $lower + \abs($upper - $lower) * \mt_rand(0, $randMax) / $randMax; } - return \rand((int) $lower, (int) $upper); + return \random_int((int) $lower, (int) $upper); } diff --git a/src/String/template.php b/src/String/template.php index a035e74..559e2b4 100644 --- a/src/String/template.php +++ b/src/String/template.php @@ -120,17 +120,17 @@ function template(string $string, array $options = []): callable if ($escapeValue) { $escapeValue = \trim($escapeValue); - $source .= "=__e(\$${escapeValue});?>"; + $source .= "=__e(\${$escapeValue});?>"; } if ($evaluateValue) { - $source .= ""; + $source .= ""; } if ($interpolateValue) { $interpolateValue = \trim($interpolateValue ?? $esTemplateValue); $interpolateValue = \preg_replace('#^([\p{L}\p{N}_]+)$#u', '$$1', $interpolateValue); - $source .= "=${interpolateValue};?>"; + $source .= "={$interpolateValue};?>"; } return $source; diff --git a/src/String/truncate.php b/src/String/truncate.php index cdca582..7fc4601 100644 --- a/src/String/truncate.php +++ b/src/String/truncate.php @@ -101,7 +101,7 @@ function truncate($string, array $options = []) $newEnd = \end($match[0])[1]; } - $result = \substr($result, 0, null === $newEnd ? $end : $newEnd); + $result = \substr($result, 0, $newEnd ?? $end); } } elseif (\strpos($string, $separator) !== $end) { $index = \strrpos($result, $separator); diff --git a/src/internal/baseMatches.php b/src/internal/baseMatches.php index d7c919b..3f39f4f 100644 --- a/src/internal/baseMatches.php +++ b/src/internal/baseMatches.php @@ -21,7 +21,7 @@ function baseMatches($source): callable return true; } - if (\is_array($source) || $source instanceof \Traversable) { + if (\is_iterable($source)) { foreach ($source as $k => $v) { if (!isEqual(property($k)($value, $index, $collection), $v)) { return false; diff --git a/src/internal/castSlice.php b/src/internal/castSlice.php index fcb027c..6d50495 100644 --- a/src/internal/castSlice.php +++ b/src/internal/castSlice.php @@ -25,7 +25,7 @@ function castSlice(array $array, int $start, ?int $end = null): array { $length = \count($array); - $end = null === $end ? $length : $end; + $end = $end ?? $length; return (!$start && $end >= $length) ? $array : \array_slice($array, $start, $end); }
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: