From 2239b02798abab6b0680868cf5361e30bdcdf219 Mon Sep 17 00:00:00 2001 From: TinaH Date: Tue, 26 Oct 2021 20:50:42 +0200 Subject: [PATCH] [8.x] Change whereStartsWith, DocBlock to reflect that array is supported (#39370) * Change DocBlock to reflect that array is supported whereStartsWith, whereDoesntStartWith, thatStartWith DocBlocks says it only accepts a string, but an array is accepted as it's being passed to Str::startsWith($haystack, $needles) which accepts an array too. * Changed docBlock for php 7 compat * change use ($string) -> use ($needles) --- src/Illuminate/View/ComponentAttributeBag.php | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Illuminate/View/ComponentAttributeBag.php b/src/Illuminate/View/ComponentAttributeBag.php index c7b1dd04d1b7..3efb8c6b7966 100644 --- a/src/Illuminate/View/ComponentAttributeBag.php +++ b/src/Illuminate/View/ComponentAttributeBag.php @@ -119,38 +119,38 @@ public function filter($callback) /** * Return a bag of attributes that have keys starting with the given value / pattern. * - * @param string $string + * @param string|string[] $needles * @return static */ - public function whereStartsWith($string) + public function whereStartsWith($needles) { - return $this->filter(function ($value, $key) use ($string) { - return Str::startsWith($key, $string); + return $this->filter(function ($value, $key) use ($needles) { + return Str::startsWith($key, $needles); }); } /** * Return a bag of attributes with keys that do not start with the given value / pattern. * - * @param string $string + * @param string|string[] $needles * @return static */ - public function whereDoesntStartWith($string) + public function whereDoesntStartWith($needles) { - return $this->filter(function ($value, $key) use ($string) { - return ! Str::startsWith($key, $string); + return $this->filter(function ($value, $key) use ($needles) { + return ! Str::startsWith($key, $needles); }); } /** * Return a bag of attributes that have keys starting with the given value / pattern. * - * @param string $string + * @param string|string[] $needles * @return static */ - public function thatStartWith($string) + public function thatStartWith($needles) { - return $this->whereStartsWith($string); + return $this->whereStartsWith($needles); } /**