From 75160b12821f7f4299cce7f0b69c83c1502ae071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Mon, 27 May 2024 13:08:29 +0200 Subject: 2024-02-19 upstream --- .../stripe-php/lib/Util/CaseInsensitiveArray.php | 165 ++++++++++++--------- 1 file changed, 93 insertions(+), 72 deletions(-) (limited to 'vendor/stripe/stripe-php/lib/Util/CaseInsensitiveArray.php') diff --git a/vendor/stripe/stripe-php/lib/Util/CaseInsensitiveArray.php b/vendor/stripe/stripe-php/lib/Util/CaseInsensitiveArray.php index 670ab0b..ce6bd3a 100644 --- a/vendor/stripe/stripe-php/lib/Util/CaseInsensitiveArray.php +++ b/vendor/stripe/stripe-php/lib/Util/CaseInsensitiveArray.php @@ -1,72 +1,93 @@ -container = \array_change_key_case($initial_array, \CASE_LOWER); - } - - public function count() - { - return \count($this->container); - } - - public function getIterator() - { - return new \ArrayIterator($this->container); - } - - public function offsetSet($offset, $value) - { - $offset = static::maybeLowercase($offset); - if (null === $offset) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - public function offsetExists($offset) - { - $offset = static::maybeLowercase($offset); - - return isset($this->container[$offset]); - } - - public function offsetUnset($offset) - { - $offset = static::maybeLowercase($offset); - unset($this->container[$offset]); - } - - public function offsetGet($offset) - { - $offset = static::maybeLowercase($offset); - - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - private static function maybeLowercase($v) - { - if (\is_string($v)) { - return \strtolower($v); - } - - return $v; - } -} +container = \array_change_key_case($initial_array, \CASE_LOWER); + } + + #[\ReturnTypeWillChange] + public function count() + { + return \count($this->container); + } + + /** + * @return \ArrayIterator + */ + #[\ReturnTypeWillChange] + public function getIterator() + { + return new \ArrayIterator($this->container); + } + + /** + * @return void + */ + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value) + { + $offset = static::maybeLowercase($offset); + if (null === $offset) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * @return bool + */ + #[\ReturnTypeWillChange] + public function offsetExists($offset) + { + $offset = static::maybeLowercase($offset); + + return isset($this->container[$offset]); + } + + /** + * @return void + */ + #[\ReturnTypeWillChange] + public function offsetUnset($offset) + { + $offset = static::maybeLowercase($offset); + unset($this->container[$offset]); + } + + /** + * @return mixed + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + $offset = static::maybeLowercase($offset); + + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + private static function maybeLowercase($v) + { + if (\is_string($v)) { + return \strtolower($v); + } + + return $v; + } +} -- cgit v1.2.3