Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PHPDoc return types #1230

Merged
merged 2 commits into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
// but we can feel free to remove it in a major version (or maybe in a minor if
// we devote some effort into determining that it is safe)
'no_null_property_initialization' => false,

// We have to support `@return void` to satisfy Symfony deprecations helper.
// See https://github.com/stripe/stripe-php/pull/1230
'phpdoc_no_empty_return' => false,
]);
$config->setFinder($finder);
return $config;
7 changes: 6 additions & 1 deletion lib/StripeObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ public function offsetGet($k)
return \array_key_exists($k, $this->_values) ? $this->_values[$k] : null;
}

// Countable method
/**
* @return int
*/
#[\ReturnTypeWillChange]
public function count()
{
Expand Down Expand Up @@ -424,6 +426,9 @@ public function serializeParamsValue($value, $original, $unsaved, $force, $key =
}
}

/**
* @return mixed
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
Expand Down
15 changes: 15 additions & 0 deletions lib/Util/CaseInsensitiveArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,18 @@ 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)
{
Expand All @@ -44,6 +50,9 @@ public function offsetSet($offset, $value)
}
}

/**
* @return bool
*/
#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
Expand All @@ -52,13 +61,19 @@ public function offsetExists($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)
{
Expand Down
3 changes: 3 additions & 0 deletions lib/Util/Set.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public function toArray()
return \array_keys($this->_elts);
}

/**
* @return ArrayIterator
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
Expand Down