Skip to content

Commit

Permalink
[8.x] Change whereStartsWith, DocBlock to reflect that array is suppo…
Browse files Browse the repository at this point in the history
…rted (#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)
  • Loading branch information
tanthammar authored Oct 26, 2021
1 parent b9fc4df commit 2239b02
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/Illuminate/View/ComponentAttributeBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit 2239b02

Please sign in to comment.