From 5eff3424ed4c7d6e10f3ad3c21451fe9a072bf5d Mon Sep 17 00:00:00 2001 From: Fran Moreno Date: Thu, 28 Apr 2022 11:28:45 +0200 Subject: [PATCH 1/3] Fix some PHPDoc types --- lib/ApiRequestor.php | 6 ++---- lib/Service/SourceService.php | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/ApiRequestor.php b/lib/ApiRequestor.php index b2fa19237..7162e33b5 100644 --- a/lib/ApiRequestor.php +++ b/lib/ApiRequestor.php @@ -295,9 +295,8 @@ private static function _formatAppInfo($appInfo) /** * @static * - * @param string $disabledFunctionsOutput - String value of the 'disable_function' setting, as output by \ini_get('disable_functions') + * @param string $disableFunctionsOutput - String value of the 'disable_function' setting, as output by \ini_get('disable_functions') * @param string $functionName - Name of the function we are interesting in seeing whether or not it is disabled - * @param mixed $disableFunctionsOutput * * @return bool */ @@ -474,8 +473,7 @@ private function _requestRaw($method, $url, $params, $headers) * @param string $url * @param array $params * @param array $headers - * @param callable $readBodyChunk - * @param mixed $readBodyChunkCallable + * @param callable $readBodyChunkCallable * * @throws Exception\AuthenticationException * @throws Exception\ApiConnectionException diff --git a/lib/Service/SourceService.php b/lib/Service/SourceService.php index f3808266f..e9d02de9c 100644 --- a/lib/Service/SourceService.php +++ b/lib/Service/SourceService.php @@ -29,7 +29,7 @@ public function allSourceTransactions($id, $params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Source + * @return \Stripe\Collection<\Stripe\SourceTransaction> */ public function allTransactions($id, $params = null, $opts = null) { From aaa41d1b2aa3fd0227bb4319f4c5c3f684453fe8 Mon Sep 17 00:00:00 2001 From: Fran Moreno Date: Thu, 28 Apr 2022 11:33:07 +0200 Subject: [PATCH 2/3] Add PHPDoc return types --- lib/Collection.php | 3 +++ lib/SearchResult.php | 3 +++ lib/Service/SourceService.php | 2 +- lib/StripeObject.php | 22 +++++++++++++++++++++- lib/Util/CaseInsensitiveArray.php | 3 +++ 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/lib/Collection.php b/lib/Collection.php index 4de2f9d73..67da085d3 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 f42769d9c..b60053146 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/Service/SourceService.php b/lib/Service/SourceService.php index e9d02de9c..f3808266f 100644 --- a/lib/Service/SourceService.php +++ b/lib/Service/SourceService.php @@ -29,7 +29,7 @@ public function allSourceTransactions($id, $params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Collection<\Stripe\SourceTransaction> + * @return \Stripe\Source */ public function allTransactions($id, $params = null, $opts = null) { diff --git a/lib/StripeObject.php b/lib/StripeObject.php index 8e9eb93c1..1240d7fa5 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 b6696cd29..5e1ac7de9 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() { From e17c8e9e839d2e90e645d436058d641d72f362f4 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Mon, 25 Jul 2022 10:02:36 -0700 Subject: [PATCH 3/3] Fix lint errors --- lib/StripeObject.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/StripeObject.php b/lib/StripeObject.php index 1240d7fa5..844cfebd5 100644 --- a/lib/StripeObject.php +++ b/lib/StripeObject.php @@ -150,6 +150,8 @@ public function __set($k, $v) } /** + * @param mixed $k + * * @return bool */ public function __isset($k) @@ -191,7 +193,7 @@ public function &__get($k) } /** - * 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 */