From f541575b21ff4291aad9e7c8dbbdea6cb887d617 Mon Sep 17 00:00:00 2001 From: Jamison Valenta Date: Fri, 13 Jan 2023 11:21:05 -0700 Subject: [PATCH] v9.38.0 changes --- src/Collect/Support/Enumerable.php | 2 +- tests/files/Support/Str.php | 12 ++++++++---- upgrade.sh | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Collect/Support/Enumerable.php b/src/Collect/Support/Enumerable.php index c50031e..f2e164d 100644 --- a/src/Collect/Support/Enumerable.php +++ b/src/Collect/Support/Enumerable.php @@ -1168,7 +1168,7 @@ public function count(): int; * @param (callable(TValue, TKey): mixed)|string|null $countBy * @return static */ - public function countBy($callback = null); + public function countBy($countBy = null); /** * Zip the collection together with one or more arrays. diff --git a/tests/files/Support/Str.php b/tests/files/Support/Str.php index 81cc958..73144ec 100644 --- a/tests/files/Support/Str.php +++ b/tests/files/Support/Str.php @@ -1014,7 +1014,7 @@ public static function singular($value) * @param string|null $language * @return string */ - public static function slug($title, $separator = '-', $language = 'en') + public static function slug($title, $separator = '-', $language = 'en', $dictionary = ['@' => 'at']) { $title = $language ? static::ascii($title, $language) : $title; @@ -1023,10 +1023,14 @@ public static function slug($title, $separator = '-', $language = 'en') $title = preg_replace('!['.preg_quote($flip).']+!u', $separator, $title); - // Replace @ with the word 'at' - $title = str_replace('@', $separator.'at'.$separator, $title); + // Replace dictionary words + foreach ($dictionary as $key => $value) { + $dictionary[$key] = $separator.$value.$separator; + } + + $title = str_replace(array_keys($dictionary), array_values($dictionary), $title); - // Remove all characters that are not the separator, letters, numbers, or whitespace. + // Remove all characters that are not the separator, letters, numbers, or whitespace $title = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', static::lower($title)); // Replace all separator characters and whitespace by a single separator diff --git a/upgrade.sh b/upgrade.sh index d94e718..85da889 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -381,7 +381,7 @@ function getCurrentVersionFromGitHub() echo Getting current version from $repository... if [ -z "$requestedVersion" ]; then - collectionVersion=$(git ls-remote $repository --tags v9.35\* | grep tags/ | grep -v {} | cut -d \/ -f 3 | cut -d v -f 2 | grep -v RC | grep -vi beta | sort -t. -k 1,1n -k 2,2n -k 3,3n| tail -1) + collectionVersion=$(git ls-remote $repository --tags v9.38\* | grep tags/ | grep -v {} | cut -d \/ -f 3 | cut -d v -f 2 | grep -v RC | grep -vi beta | sort -t. -k 1,1n -k 2,2n -k 3,3n| tail -1) else collectionVersion=$requestedVersion fi