Skip to content

Commit 0f08b29

Browse files
committed
Fix PHP8.1 return types of internal PHP interfaces
1 parent 6f3287b commit 0f08b29

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

lib/recurly/currency_list.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,35 @@ public function getCurrency($currencyCode) {
2020
return isset($this->currencies[$currencyCode]) ? $this->currencies[$currencyCode] : null;
2121
}
2222

23-
public function offsetSet($offset, $value) {
24-
return $this->addCurrency($offset, $value);
23+
public function offsetSet($offset, $value): void {
24+
$this->addCurrency($offset, $value);
2525
}
2626

27-
public function offsetExists($offset) {
27+
public function offsetExists($offset): bool {
2828
return isset($this->currencies[$offset]);
2929
}
3030

31-
public function offsetUnset($offset) {
31+
public function offsetUnset($offset): void {
3232
unset($this->currencies[$offset]);
3333
}
3434

35-
public function offsetGet($offset) {
35+
public function offsetGet($offset): mixed {
3636
return $this->getCurrency($offset);
3737
}
3838

3939
public function __set($k, $v) {
40-
return $this->offsetSet($k, $v);
40+
$this->offsetSet($k, $v);
4141
}
4242

4343
public function __get($k) {
4444
return $this->offsetGet($k);
4545
}
4646

47-
public function count() {
47+
public function count(): int {
4848
return count($this->currencies);
4949
}
5050

51-
public function getIterator() {
51+
public function getIterator(): Traversable {
5252
return new ArrayIterator($this->currencies);
5353
}
5454

lib/recurly/custom_field_list.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Recurly_CustomFieldList extends ArrayObject
1010
* @param object $value Must be instance of Recurly_CustomField
1111
* @throws Exception
1212
*/
13-
public function offsetSet($index, $value) {
13+
public function offsetSet($index, $value): void {
1414
if (!$value instanceof Recurly_CustomField) {
1515
throw new Exception("value must be an instance of Recurly_CustomField");
1616
}
@@ -25,7 +25,7 @@ public function offsetSet($index, $value) {
2525
parent::offsetSet($index, $value);
2626
}
2727

28-
public function offsetUnset($index) {
28+
public function offsetUnset($index): void {
2929
parent::offsetSet($index, new Recurly_CustomField($index, null));
3030
}
3131

lib/recurly/error_list.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,29 @@ function __construct() {
2525
}
2626

2727
// array access to the errors collection
28-
public function offsetSet($offset, $value) {
28+
public function offsetSet($offset, $value): void {
2929
if (is_null($offset)) {
3030
$this->errors[] = $value;
3131
} else {
3232
$this->errors[$offset] = $value;
3333
}
3434
}
35-
public function offsetExists($offset) {
35+
public function offsetExists($offset): bool {
3636
return isset($this->errors[$offset]);
3737
}
38-
public function offsetUnset($offset) {
38+
public function offsetUnset($offset): void {
3939
unset($this->errors[$offset]);
4040
}
41-
public function offsetGet($offset) {
41+
public function offsetGet($offset): mixed {
4242
return isset($this->errors[$offset]) ? $this->errors[$offset] : null;
4343
}
4444

45-
public function count()
45+
public function count(): int
4646
{
4747
return count($this->errors);
4848
}
4949

50-
public function getIterator() {
50+
public function getIterator(): Traversable {
5151
return new ArrayIterator($this->errors);
5252
}
5353

lib/recurly/pager.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ abstract class Recurly_Pager extends Recurly_Base implements Iterator, Countable
1818
* @return integer number of records in list
1919
* @throws Recurly_Error
2020
*/
21-
public function count() {
21+
public function count(): int {
2222
if (isset($this->_href)) {
2323
$headers = Recurly_Base::_head($this->_href, $this->_client);
2424
if (isset($headers['x-records'])) {
@@ -28,7 +28,7 @@ public function count() {
2828
return count($this->_objects);
2929
}
3030

31-
return null;
31+
return 0;
3232
}
3333

3434
protected function get_first_page() {
@@ -47,7 +47,7 @@ protected function get_first_page() {
4747
*
4848
* @throws Recurly_Error
4949
*/
50-
public function rewind() {
50+
public function rewind(): void {
5151
$this->_loadFrom($this->_href);
5252
$this->_position = 0;
5353
}
@@ -58,7 +58,7 @@ public function rewind() {
5858
* @return Recurly_Resource the current object
5959
* @throws Recurly_Error
6060
*/
61-
public function current()
61+
public function current(): mixed
6262
{
6363
// Work around pre-PHP 5.5 issue that prevents `empty($this->count())`:
6464
if (!isset($this->_objects)) {
@@ -84,21 +84,21 @@ public function current()
8484
/**
8585
* @return integer current position within the current page
8686
*/
87-
public function key() {
87+
public function key(): mixed {
8888
return $this->_position;
8989
}
9090

9191
/**
9292
* Increments the position to the next element
9393
*/
94-
public function next() {
94+
public function next(): void {
9595
++$this->_position;
9696
}
9797

9898
/**
9999
* @return boolean True if the current position is valid.
100100
*/
101-
public function valid() {
101+
public function valid(): bool {
102102
return (isset($this->_objects[$this->_position]) || isset($this->_links['next']));
103103
}
104104

0 commit comments

Comments
 (0)