From 92cb03679f5aee883100f972161b4d5d145ecd84 Mon Sep 17 00:00:00 2001 From: rkr Date: Tue, 12 Dec 2023 10:23:50 +0100 Subject: [PATCH 1/5] Fix for "PHP Deprecated: Using ${var} in strings is deprecated, use {$var} instead" --- src/String/template.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 .= ""; + $source .= ""; } if ($evaluateValue) { - $source .= ""; + $source .= ""; } if ($interpolateValue) { $interpolateValue = \trim($interpolateValue ?? $esTemplateValue); $interpolateValue = \preg_replace('#^([\p{L}\p{N}_]+)$#u', '$$1', $interpolateValue); - $source .= ""; + $source .= ""; } return $source; From 8cc5fa15cfc872e3ac01ca76173c9eeb9630e2ec Mon Sep 17 00:00:00 2001 From: rkr Date: Tue, 12 Dec 2023 10:24:39 +0100 Subject: [PATCH 2/5] Use of `is_iterable` instead of `is_array($source) || $source instanceof Traversable` --- src/internal/baseMatches.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; From 2294511a7685957147e16542c409e25aa732a4df Mon Sep 17 00:00:00 2001 From: rkr Date: Tue, 12 Dec 2023 10:25:27 +0100 Subject: [PATCH 3/5] Use of null coalesce operator, that comes with PHP7.1 --- src/String/truncate.php | 2 +- src/internal/castSlice.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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/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); } From bbc8fc469f70e450d5788d149be49494928784d9 Mon Sep 17 00:00:00 2001 From: rkr Date: Tue, 12 Dec 2023 10:26:05 +0100 Subject: [PATCH 4/5] The rand() function has been replaced with the random_int() function. This change provides more reliable randomness and mitigates potential security vulnerabilities associated with the previous function. --- src/Number/random.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Number/random.php b/src/Number/random.php index 7da25a7..7a72b97 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); } From 822764e64df62939aa4f7447ea7a63e63691d289 Mon Sep 17 00:00:00 2001 From: Pierre du Plessis Date: Tue, 12 Dec 2023 11:46:44 +0200 Subject: [PATCH 5/5] Use root namespace for function call --- src/Number/random.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Number/random.php b/src/Number/random.php index 7a72b97..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 random_int((int) $lower, (int) $upper); + return \random_int((int) $lower, (int) $upper); } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

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:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy