Update Stripe lib to 10.7.0

This commit is contained in:
Laurent Destailleur
2023-04-24 18:42:04 +02:00
parent 06f8291e07
commit 936512d0bb
256 changed files with 8077 additions and 2978 deletions

View File

@@ -5,10 +5,13 @@ namespace Stripe;
/**
* Class Collection.
*
* @template TStripeObject of StripeObject
* @template-implements \IteratorAggregate<TStripeObject>
*
* @property string $object
* @property string $url
* @property bool $has_more
* @property \Stripe\StripeObject[] $data
* @property TStripeObject[] $data
*/
class Collection extends StripeObject implements \Countable, \IteratorAggregate
{
@@ -47,6 +50,10 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
$this->filters = $filters;
}
/**
* @return mixed
*/
#[\ReturnTypeWillChange]
public function offsetGet($k)
{
if (\is_string($k)) {
@@ -60,6 +67,14 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
throw new Exception\InvalidArgumentException($msg);
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws Exception\ApiErrorException
*
* @return Collection<TStripeObject>
*/
public function all($params = null, $opts = null)
{
self::_validateParams($params);
@@ -77,6 +92,14 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
return $obj;
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws Exception\ApiErrorException
*
* @return TStripeObject
*/
public function create($params = null, $opts = null)
{
self::_validateParams($params);
@@ -87,6 +110,15 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
return Util\Util::convertToStripeObject($response, $opts);
}
/**
* @param string $id
* @param null|array $params
* @param null|array|string $opts
*
* @throws Exception\ApiErrorException
*
* @return TStripeObject
*/
public function retrieve($id, $params = null, $opts = null)
{
self::_validateParams($params);
@@ -107,6 +139,7 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
/**
* @return int the number of objects in the current page
*/
#[\ReturnTypeWillChange]
public function count()
{
return \count($this->data);
@@ -116,6 +149,7 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
* @return \ArrayIterator an iterator that can be used to iterate
* across objects in the current page
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return new \ArrayIterator($this->data);
@@ -131,7 +165,7 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
}
/**
* @return \Generator|StripeObject[] A generator that can be used to
* @return \Generator|TStripeObject[] A generator that can be used to
* iterate across all objects across all pages. As page boundaries are
* encountered, the next page will be fetched automatically for
* continued iteration.
@@ -194,7 +228,7 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
* @param null|array $params
* @param null|array|string $opts
*
* @return Collection
* @return Collection<TStripeObject>
*/
public function nextPage($params = null, $opts = null)
{
@@ -222,7 +256,7 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
* @param null|array $params
* @param null|array|string $opts
*
* @return Collection
* @return Collection<TStripeObject>
*/
public function previousPage($params = null, $opts = null)
{
@@ -244,7 +278,7 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
/**
* Gets the first item from the current page. Returns `null` if the current page is empty.
*
* @return null|\Stripe\StripeObject
* @return null|TStripeObject
*/
public function first()
{
@@ -254,7 +288,7 @@ class Collection extends StripeObject implements \Countable, \IteratorAggregate
/**
* Gets the last item from the current page. Returns `null` if the current page is empty.
*
* @return null|\Stripe\StripeObject
* @return null|TStripeObject
*/
public function last()
{