upgraded dependencies

This commit is contained in:
RafficMohammed
2023-01-08 01:59:16 +05:30
parent 51056e3aad
commit f9ae387337
6895 changed files with 133617 additions and 178680 deletions

View File

@@ -47,15 +47,13 @@ class AcceptHeader
/**
* Builds an AcceptHeader instance from a string.
*
* @param string $headerValue
*
* @return self
*/
public static function fromString($headerValue)
public static function fromString(?string $headerValue)
{
$index = 0;
$parts = HeaderUtils::split((string) $headerValue, ',;=');
$parts = HeaderUtils::split($headerValue ?? '', ',;=');
return new self(array_map(function ($subParts) use (&$index) {
$part = array_shift($subParts);
@@ -81,11 +79,9 @@ class AcceptHeader
/**
* Tests if header has given value.
*
* @param string $value
*
* @return bool
*/
public function has($value)
public function has(string $value)
{
return isset($this->items[$value]);
}
@@ -93,11 +89,9 @@ class AcceptHeader
/**
* Returns given value's item, if exists.
*
* @param string $value
*
* @return AcceptHeaderItem|null
*/
public function get($value)
public function get(string $value)
{
return $this->items[$value] ?? $this->items[explode('/', $value)[0].'/*'] ?? $this->items['*/*'] ?? $this->items['*'] ?? null;
}
@@ -130,11 +124,9 @@ class AcceptHeader
/**
* Filters items on their value using given regex.
*
* @param string $pattern
*
* @return self
*/
public function filter($pattern)
public function filter(string $pattern)
{
return new self(array_filter($this->items, function (AcceptHeaderItem $item) use ($pattern) {
return preg_match($pattern, $item->getValue());