From f287abe8bbcc3def177d9472d501de40abd21bfd Mon Sep 17 00:00:00 2001 From: Jamison Valenta Date: Fri, 15 Apr 2022 13:57:49 -0600 Subject: [PATCH] v9.7.0 changes --- src/Collect/Support/Collection.php | 2 +- tests/files/Support/Str.php | 11 +++++++++++ tests/files/Support/Stringable.php | 10 ++++++++++ upgrade.sh | 2 +- 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/Collect/Support/Collection.php b/src/Collect/Support/Collection.php index e96569a..bd9676d 100644 --- a/src/Collect/Support/Collection.php +++ b/src/Collect/Support/Collection.php @@ -701,7 +701,7 @@ public function last(callable $callback = null, $default = null) /** * Get the values of a given key. * - * @param string|array $value + * @param string|int|array $value * @param string|null $key * @return static */ diff --git a/tests/files/Support/Str.php b/tests/files/Support/Str.php index 86e5054..3fd6b71 100644 --- a/tests/files/Support/Str.php +++ b/tests/files/Support/Str.php @@ -881,6 +881,17 @@ public static function snake($value, $delimiter = '_') return static::$snakeCache[$key][$delimiter] = $value; } + /** + * Remove all "extra" blank space from the given string. + * + * @param string $value + * @return string + */ + public static function squish($value) + { + return preg_replace('/\s+/', ' ', trim($value)); + } + /** * Determine if a given string starts with a given substring. * diff --git a/tests/files/Support/Stringable.php b/tests/files/Support/Stringable.php index a86980f..50eaf1e 100644 --- a/tests/files/Support/Stringable.php +++ b/tests/files/Support/Stringable.php @@ -624,6 +624,16 @@ public function scan($format) return collect(sscanf($this->value, $format)); } + /** + * Remove all "extra" blank space from the given string. + * + * @return static + */ + public function squish() + { + return new static(Str::squish($this->value)); + } + /** * Begin a string with a single instance of a given value. * diff --git a/upgrade.sh b/upgrade.sh index d84f14e..8337f84 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -380,7 +380,7 @@ function getCurrentVersionFromGitHub() echo Getting current version from $repository... if [ -z "$requestedVersion" ]; then - collectionVersion=$(git ls-remote $repository --tags v9\* | 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.7\* | 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