diff --git a/lib/recurly/currency_list.php b/lib/recurly/currency_list.php index 246af95d..f54a7d68 100644 --- a/lib/recurly/currency_list.php +++ b/lib/recurly/currency_list.php @@ -20,35 +20,35 @@ public function getCurrency($currencyCode) { return isset($this->currencies[$currencyCode]) ? $this->currencies[$currencyCode] : null; } - public function offsetSet($offset, $value) { - return $this->addCurrency($offset, $value); + public function offsetSet($offset, $value): void { + $this->addCurrency($offset, $value); } - public function offsetExists($offset) { + public function offsetExists($offset): bool { return isset($this->currencies[$offset]); } - public function offsetUnset($offset) { + public function offsetUnset($offset): void { unset($this->currencies[$offset]); } - public function offsetGet($offset) { + public function offsetGet($offset): mixed { return $this->getCurrency($offset); } public function __set($k, $v) { - return $this->offsetSet($k, $v); + $this->offsetSet($k, $v); } public function __get($k) { return $this->offsetGet($k); } - public function count() { + public function count(): int { return count($this->currencies); } - public function getIterator() { + public function getIterator(): Traversable { return new ArrayIterator($this->currencies); } diff --git a/lib/recurly/custom_field_list.php b/lib/recurly/custom_field_list.php index 9604d5a7..38944845 100644 --- a/lib/recurly/custom_field_list.php +++ b/lib/recurly/custom_field_list.php @@ -10,7 +10,7 @@ class Recurly_CustomFieldList extends ArrayObject * @param object $value Must be instance of Recurly_CustomField * @throws Exception */ - public function offsetSet($index, $value) { + public function offsetSet($index, $value): void { if (!$value instanceof Recurly_CustomField) { throw new Exception("value must be an instance of Recurly_CustomField"); } @@ -25,7 +25,7 @@ public function offsetSet($index, $value) { parent::offsetSet($index, $value); } - public function offsetUnset($index) { + public function offsetUnset($index): void { parent::offsetSet($index, new Recurly_CustomField($index, null)); } diff --git a/lib/recurly/error_list.php b/lib/recurly/error_list.php index 8b49822d..f4b3169c 100644 --- a/lib/recurly/error_list.php +++ b/lib/recurly/error_list.php @@ -25,29 +25,29 @@ function __construct() { } // array access to the errors collection - public function offsetSet($offset, $value) { + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->errors[] = $value; } else { $this->errors[$offset] = $value; } } - public function offsetExists($offset) { + public function offsetExists($offset): bool { return isset($this->errors[$offset]); } - public function offsetUnset($offset) { + public function offsetUnset($offset): void { unset($this->errors[$offset]); } - public function offsetGet($offset) { + public function offsetGet($offset): mixed { return isset($this->errors[$offset]) ? $this->errors[$offset] : null; } - public function count() + public function count(): int { return count($this->errors); } - public function getIterator() { + public function getIterator(): Traversable { return new ArrayIterator($this->errors); } diff --git a/lib/recurly/pager.php b/lib/recurly/pager.php index 8201be59..dffb19f4 100644 --- a/lib/recurly/pager.php +++ b/lib/recurly/pager.php @@ -18,7 +18,7 @@ abstract class Recurly_Pager extends Recurly_Base implements Iterator, Countable * @return integer number of records in list * @throws Recurly_Error */ - public function count() { + public function count(): int { if (isset($this->_href)) { $headers = Recurly_Base::_head($this->_href, $this->_client); if (isset($headers['x-records'])) { @@ -28,7 +28,7 @@ public function count() { return count($this->_objects); } - return null; + return 0; } protected function get_first_page() { @@ -47,7 +47,7 @@ protected function get_first_page() { * * @throws Recurly_Error */ - public function rewind() { + public function rewind(): void { $this->_loadFrom($this->_href); $this->_position = 0; } @@ -58,7 +58,7 @@ public function rewind() { * @return Recurly_Resource the current object * @throws Recurly_Error */ - public function current() + public function current(): mixed { // Work around pre-PHP 5.5 issue that prevents `empty($this->count())`: if (!isset($this->_objects)) { @@ -84,21 +84,21 @@ public function current() /** * @return integer current position within the current page */ - public function key() { + public function key(): mixed { return $this->_position; } /** * Increments the position to the next element */ - public function next() { + public function next(): void { ++$this->_position; } /** * @return boolean True if the current position is valid. */ - public function valid() { + public function valid(): bool { return (isset($this->_objects[$this->_position]) || isset($this->_links['next'])); }