From 23f935c01a6d1b896dd94cfa1e2f2881d0a57d04 Mon Sep 17 00:00:00 2001 From: Fran Moreno Date: Thu, 28 Apr 2022 11:33:07 +0200 Subject: [PATCH] Add PHPDoc return types --- lib/Collection.php | 3 +++ lib/SearchResult.php | 3 +++ lib/StripeObject.php | 22 +++++++++++++++++++++- lib/Util/CaseInsensitiveArray.php | 3 +++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/lib/Collection.php b/lib/Collection.php index 4de2f9d73b..67da085d38 100644 --- a/lib/Collection.php +++ b/lib/Collection.php @@ -50,6 +50,9 @@ public function setFilters($filters) $this->filters = $filters; } + /** + * @return mixed + */ #[\ReturnTypeWillChange] public function offsetGet($k) { diff --git a/lib/SearchResult.php b/lib/SearchResult.php index f42769d9ca..b600531462 100644 --- a/lib/SearchResult.php +++ b/lib/SearchResult.php @@ -62,6 +62,9 @@ public function setFilters($filters) $this->filters = $filters; } + /** + * @return mixed + */ #[\ReturnTypeWillChange] public function offsetGet($k) { diff --git a/lib/StripeObject.php b/lib/StripeObject.php index 8e9eb93c11..1240d7fa5b 100644 --- a/lib/StripeObject.php +++ b/lib/StripeObject.php @@ -149,6 +149,9 @@ public function __set($k, $v) $this->_unsavedValues->add($k); } + /** + * @return bool + */ public function __isset($k) { return isset($this->_values[$k]); @@ -187,31 +190,48 @@ public function &__get($k) return $nullval; } - // Magic method for var_dump output. Only works with PHP >= 5.6 + /** + * Magic method for var_dump output. Only works with PHP >= 5.6 + * + * @return array + */ public function __debugInfo() { return $this->_values; } // ArrayAccess methods + + /** + * @return void + */ #[\ReturnTypeWillChange] public function offsetSet($k, $v) { $this->{$k} = $v; } + /** + * @return bool + */ #[\ReturnTypeWillChange] public function offsetExists($k) { return \array_key_exists($k, $this->_values); } + /** + * @return void + */ #[\ReturnTypeWillChange] public function offsetUnset($k) { unset($this->{$k}); } + /** + * @return mixed + */ #[\ReturnTypeWillChange] public function offsetGet($k) { diff --git a/lib/Util/CaseInsensitiveArray.php b/lib/Util/CaseInsensitiveArray.php index b6696cd299..5e1ac7de9d 100644 --- a/lib/Util/CaseInsensitiveArray.php +++ b/lib/Util/CaseInsensitiveArray.php @@ -21,6 +21,9 @@ public function __construct($initial_array = []) $this->container = \array_change_key_case($initial_array, \CASE_LOWER); } + /** + * @return int + */ #[\ReturnTypeWillChange] public function count() {