diff --git a/Tests/Recurly/AccountAcquisition_Test.php b/Tests/Recurly/AccountAcquisition_Test.php index c568ba96..bf74e7a9 100644 --- a/Tests/Recurly/AccountAcquisition_Test.php +++ b/Tests/Recurly/AccountAcquisition_Test.php @@ -2,7 +2,7 @@ class Recurly_AccountAcquisitionTest extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/accounts/abcdef1234567890/acquisition', 'account_acquisition/show-200.xml'), array('PUT', '/accounts/abcdef1234567890/acquisition', 'account_acquisition/create-201.xml'), diff --git a/Tests/Recurly/AccountBalance_Test.php b/Tests/Recurly/AccountBalance_Test.php index fc696d14..01c9e46c 100644 --- a/Tests/Recurly/AccountBalance_Test.php +++ b/Tests/Recurly/AccountBalance_Test.php @@ -2,7 +2,7 @@ class Recurly_AccountBalanceTest extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/accounts/abcdef1234567890/balance', 'balance/show-200.xml'), ); diff --git a/Tests/Recurly/Account_List_Test.php b/Tests/Recurly/Account_List_Test.php index 60b54808..cfda8c7a 100644 --- a/Tests/Recurly/Account_List_Test.php +++ b/Tests/Recurly/Account_List_Test.php @@ -3,7 +3,7 @@ class Recurly_AccountListTest extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/accounts', 'accounts/index-200.xml') ); diff --git a/Tests/Recurly/Account_Test.php b/Tests/Recurly/Account_Test.php index d8da3a00..a5e75924 100644 --- a/Tests/Recurly/Account_Test.php +++ b/Tests/Recurly/Account_Test.php @@ -3,7 +3,7 @@ class Recurly_AccountTest extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/accounts/abcdef1234567890', 'accounts/show-200.xml') ); diff --git a/Tests/Recurly/Addon_Test.php b/Tests/Recurly/Addon_Test.php index 8bd990fd..23379529 100644 --- a/Tests/Recurly/Addon_Test.php +++ b/Tests/Recurly/Addon_Test.php @@ -3,7 +3,7 @@ class Recurly_AddonTest extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/plans/gold/add_ons/ipaddresses', 'addons/show-200.xml') ); @@ -60,8 +60,8 @@ public function testCreateXmlTieredAddOn() { $tier1->ending_quantity = 800; $tier2 = new Recurly_Tier(); $tier2->unit_amount_in_cents->addCurrency('USD', 200); - - $addon->tiers = array($tier1, $tier2); + + $addon->tiers = array($tier1, $tier2); $this->assertXmlStringEqualsXmlString(" diff --git a/Tests/Recurly/Adjustment_Test.php b/Tests/Recurly/Adjustment_Test.php index 654c27b8..2e280753 100644 --- a/Tests/Recurly/Adjustment_Test.php +++ b/Tests/Recurly/Adjustment_Test.php @@ -3,7 +3,7 @@ class Recurly_AdjustmentTest extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/adjustments/abcdef1234567890', 'adjustments/show-200.xml') ); diff --git a/Tests/Recurly/Base_Test.php b/Tests/Recurly/Base_Test.php index 4f21e450..ef1402de 100644 --- a/Tests/Recurly/Base_Test.php +++ b/Tests/Recurly/Base_Test.php @@ -51,26 +51,26 @@ public function testCheckIfResponseContainGetHeadersFunction() { $this->client->addResponse('GET', 'accounts', 'accounts/index-200.xml'); $accounts = Recurly_Base::_get('accounts', $this->client); $this->assertTrue(method_exists($accounts, 'getHeaders'),"Accounts Class does not have method getHeaders"); - $this->assertInternalType('array', $accounts->getHeaders()); + $this->assertIsArray($accounts->getHeaders()); $this->client->addResponse('GET', 'subscriptions', 'subscriptions/index-200.xml'); $subscriptions = Recurly_Base::_get('subscriptions', $this->client); $this->assertTrue(method_exists($subscriptions, 'getHeaders'),'Subscriptions Class does not have method getHeaders'); - $this->assertInternalType('array', $subscriptions->getHeaders()); + $this->assertIsArray($subscriptions->getHeaders()); $this->client->addResponse('GET', 'abcdef1234567890', 'adjustments/show-200.xml'); $adjustment = Recurly_Base::_get('abcdef1234567890', $this->client); $this->assertTrue(method_exists($adjustment, 'getHeaders'),'Adjustments Class does not have method getHeaders'); - $this->assertInternalType('array', $adjustment->getHeaders()); + $this->assertIsArray($adjustment->getHeaders()); } public function testPassingEmptyResourceCode() { $this->expectException(Recurly_Error::class); $uri = Recurly_Base::_safeUri( - Recurly_Client::PATH_SUBSCRIPTIONS, "", + Recurly_Client::PATH_SUBSCRIPTIONS, "", Recurly_Client::PATH_ADDONS, "marketing_emails", Recurly_Client::PATH_USAGE, 123456 - ); + ); } public function testUrlEncodingReplacement() { diff --git a/Tests/Recurly/Billing_Info_Test.php b/Tests/Recurly/Billing_Info_Test.php index b053fbbe..e7e9374d 100644 --- a/Tests/Recurly/Billing_Info_Test.php +++ b/Tests/Recurly/Billing_Info_Test.php @@ -3,7 +3,7 @@ class Recurly_BillingInfoTest extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/accounts/venmo1234567890/billing_info', 'billing_info/show-venmo-200.xml'), array('GET', '/accounts/abcdef1234567890/billing_info', 'billing_info/show-200.xml'), @@ -117,7 +117,7 @@ public function testGetBecsBillingInfo() { public function testVerifyBillingInfoCreditCard() { $billing_info = Recurly_BillingInfo::get('abcdef1234567890', $this->client); $this->client->addResponse('POST', 'https://api.recurly.com/v2/accounts/abcdef1234567890/billing_info/verify', 'billing_info/verify-200.xml'); - + $verified = $billing_info->verify(); $this->assertEquals($verified->origin, 'api_verify_card'); @@ -128,7 +128,7 @@ public function testVerifyBillingInfoCreditCard() { public function testVerifyCvvBillingInfoCreditCard() { $billing_info = Recurly_BillingInfo::get('abcdef1234567890', $this->client); $this->client->addResponse('POST', 'https://api.recurly.com/v2/accounts/abcdef1234567890/billing_info/verify_cvv', 'billing_info/verify-cvv-200.xml'); - + $verified = $billing_info->verifyCvv('988'); $this->assertInstanceOf('Recurly_BillingInfo', $billing_info); $this->assertEquals($verified->year, 2015); diff --git a/Tests/Recurly/Coupon_Redemption_Test.php b/Tests/Recurly/Coupon_Redemption_Test.php index 550a0e3b..e62ee0ff 100644 --- a/Tests/Recurly/Coupon_Redemption_Test.php +++ b/Tests/Recurly/Coupon_Redemption_Test.php @@ -3,7 +3,7 @@ class Recurly_CouponRedemptionTest extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/accounts/abcdef1234567890/redemption', 'accounts/redemption/show-200.xml') ); diff --git a/Tests/Recurly/Coupon_Test.php b/Tests/Recurly/Coupon_Test.php index 0628439c..3f679a5b 100644 --- a/Tests/Recurly/Coupon_Test.php +++ b/Tests/Recurly/Coupon_Test.php @@ -2,7 +2,7 @@ class Recurly_CouponTest extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/coupons/special', 'coupons/show-200.xml') ); diff --git a/Tests/Recurly/CreditPaymentList_Test.php b/Tests/Recurly/CreditPaymentList_Test.php index 3c09f297..11c02d3c 100644 --- a/Tests/Recurly/CreditPaymentList_Test.php +++ b/Tests/Recurly/CreditPaymentList_Test.php @@ -2,7 +2,7 @@ class Recurly_CreditPaymentListTest extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/credit_payments', 'credit_payments/index-200.xml') ); diff --git a/Tests/Recurly/DunningCampaign_List_Test.php b/Tests/Recurly/DunningCampaign_List_Test.php index 14eac02d..21b80dc9 100644 --- a/Tests/Recurly/DunningCampaign_List_Test.php +++ b/Tests/Recurly/DunningCampaign_List_Test.php @@ -2,7 +2,7 @@ class RecurlyDunningCampaignListTest extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/dunning_campaigns', 'dunning_campaigns/index-200.xml') ); diff --git a/Tests/Recurly/DunningCampaign_Test.php b/Tests/Recurly/DunningCampaign_Test.php index 9b1bfb01..1f5b1d09 100644 --- a/Tests/Recurly/DunningCampaign_Test.php +++ b/Tests/Recurly/DunningCampaign_Test.php @@ -2,7 +2,7 @@ class Recurly_DunningCampaignTest extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/dunning_campaigns/1234abcd', 'dunning_campaigns/show-200.xml'), ); diff --git a/Tests/Recurly/Entitlement_List_Test.php b/Tests/Recurly/Entitlement_List_Test.php index a378f985..ff8dff46 100644 --- a/Tests/Recurly/Entitlement_List_Test.php +++ b/Tests/Recurly/Entitlement_List_Test.php @@ -2,7 +2,7 @@ class RecurlyEntitlementListTest extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/accounts/abcdef1234567890/entitlements', 'accounts/entitlements/index-200.xml') ); diff --git a/Tests/Recurly/ExportDate_List_Test.php b/Tests/Recurly/ExportDate_List_Test.php index 484354e1..90c56f19 100644 --- a/Tests/Recurly/ExportDate_List_Test.php +++ b/Tests/Recurly/ExportDate_List_Test.php @@ -2,7 +2,7 @@ class Recurly_ExportDateList_Test extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/export_dates', 'export_dates/index-200.xml'), ); diff --git a/Tests/Recurly/ExportFile_List_Test.php b/Tests/Recurly/ExportFile_List_Test.php index 43d35d6f..2701fe26 100644 --- a/Tests/Recurly/ExportFile_List_Test.php +++ b/Tests/Recurly/ExportFile_List_Test.php @@ -2,7 +2,7 @@ class Recurly_ExportFileList_Test extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/export_dates/2016-08-01/export_files', 'export_files/index-200.xml'), ); diff --git a/Tests/Recurly/ExportFile_Test.php b/Tests/Recurly/ExportFile_Test.php index 20d30fbd..a5b2deeb 100644 --- a/Tests/Recurly/ExportFile_Test.php +++ b/Tests/Recurly/ExportFile_Test.php @@ -2,7 +2,7 @@ class Recurly_ExportFile_Test extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/export_dates/2016-08-01/export_files/revenue_schedules_full.csv', 'export_files/show-200.xml'), ); diff --git a/Tests/Recurly/GiftCard_List_Test.php b/Tests/Recurly/GiftCard_List_Test.php index 839a4490..fba07728 100644 --- a/Tests/Recurly/GiftCard_List_Test.php +++ b/Tests/Recurly/GiftCard_List_Test.php @@ -2,7 +2,7 @@ class RecurlyGiftCardListTest extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/gift_cards', 'gift_cards/index-200.xml') ); diff --git a/Tests/Recurly/GiftCard_Test.php b/Tests/Recurly/GiftCard_Test.php index 6042e0f8..cebf85ff 100644 --- a/Tests/Recurly/GiftCard_Test.php +++ b/Tests/Recurly/GiftCard_Test.php @@ -2,7 +2,7 @@ class Recurly_GiftCardTest extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/gift_cards/1988596967980562362', 'gift_cards/show-200.xml') ); diff --git a/Tests/Recurly/InvoiceTemplate_List_Test.php b/Tests/Recurly/InvoiceTemplate_List_Test.php index 226f1fdf..a7c707ba 100644 --- a/Tests/Recurly/InvoiceTemplate_List_Test.php +++ b/Tests/Recurly/InvoiceTemplate_List_Test.php @@ -2,7 +2,7 @@ class RecurlyInvoiceTemplateListTest extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/invoice_templates', 'invoice_templates/index-200.xml') ); diff --git a/Tests/Recurly/InvoiceTemplate_Test.php b/Tests/Recurly/InvoiceTemplate_Test.php index e0e6a70f..bba2972e 100644 --- a/Tests/Recurly/InvoiceTemplate_Test.php +++ b/Tests/Recurly/InvoiceTemplate_Test.php @@ -2,7 +2,7 @@ class Recurly_InvoiceTemplateTest extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/invoice_templates/q0tzf7o7fpbl', 'invoice_templates/show-200.xml'), ); diff --git a/Tests/Recurly/Invoice_Test.php b/Tests/Recurly/Invoice_Test.php index 20f82f45..37159f65 100644 --- a/Tests/Recurly/Invoice_Test.php +++ b/Tests/Recurly/Invoice_Test.php @@ -4,7 +4,7 @@ class Recurly_InvoiceTest extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/invoices/1001', 'invoices/show-200.xml'), array('GET', '/invoices/1002', 'invoices/show-with-prefix-200.xml'), diff --git a/Tests/Recurly/Item_Test.php b/Tests/Recurly/Item_Test.php index b0931ffa..ce6b3352 100644 --- a/Tests/Recurly/Item_Test.php +++ b/Tests/Recurly/Item_Test.php @@ -2,7 +2,7 @@ class Recurly_ItemTest extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/items/plastic_gloves', 'items/show-200.xml'), ); @@ -17,7 +17,7 @@ public function testConstructor() { $this->assertSame($client, $prop->getValue($item)); } - + public function testGetItem() { $item = Recurly_Item::get('plastic_gloves', $this->client); diff --git a/Tests/Recurly/Plan_Test.php b/Tests/Recurly/Plan_Test.php index 01b8e323..c5e48719 100644 --- a/Tests/Recurly/Plan_Test.php +++ b/Tests/Recurly/Plan_Test.php @@ -3,7 +3,7 @@ class Recurly_PlanTest extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/plans/silver', 'plans/show-200.xml'), array('GET', '/plans/ramp-priced-plan', 'plans/show-ramps-200.xml'), diff --git a/Tests/Recurly/Purchase_Test.php b/Tests/Recurly/Purchase_Test.php index fafb7ec4..f450c65f 100644 --- a/Tests/Recurly/Purchase_Test.php +++ b/Tests/Recurly/Purchase_Test.php @@ -2,7 +2,7 @@ class Recurly_PurchaseTest extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('POST', '/purchases', 'purchases/create-201.xml'), array('POST', '/purchases/preview', 'purchases/preview-200.xml'), diff --git a/Tests/Recurly/ShippingAddress_Test.php b/Tests/Recurly/ShippingAddress_Test.php index cd6d9e73..5df16e46 100644 --- a/Tests/Recurly/ShippingAddress_Test.php +++ b/Tests/Recurly/ShippingAddress_Test.php @@ -2,7 +2,7 @@ class Recurly_ShippingAddressTest extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/accounts/abcdef1234567890', 'accounts/show-200.xml') ); diff --git a/Tests/Recurly/Transaction_Test.php b/Tests/Recurly/Transaction_Test.php index 322620d6..cefd77e1 100644 --- a/Tests/Recurly/Transaction_Test.php +++ b/Tests/Recurly/Transaction_Test.php @@ -3,7 +3,7 @@ class Recurly_TransactionTest extends Recurly_TestCase { - function defaultResponses() { + function defaultResponses(): array { return array( array('GET', '/transactions/012345678901234567890123456789ab', 'transactions/show-200.xml'), array('GET', '/invoices/1001', 'invoices/show-200.xml'), diff --git a/Tests/bootstrap.php b/Tests/bootstrap.php index e31eb9ce..a9a578df 100644 --- a/Tests/bootstrap.php +++ b/Tests/bootstrap.php @@ -13,11 +13,10 @@ /** * Base class for our tests that sets up a mock client. - * - * @property Recurly_MockClient $client */ abstract class Recurly_TestCase extends TestCase { - function setUp() { + protected Recurly_MockClient $client; + function setUp(): void { $this->client = new Recurly_MockClient(); foreach ($this->defaultResponses() as $request) { call_user_func_array(array($this->client, 'addResponse'), $request); @@ -27,7 +26,8 @@ function setUp() { /** * Return an array of responses that will be added to the mock client. */ - function defaultResponses() { + function defaultResponses(): array + { return array(); } } @@ -36,18 +36,22 @@ function defaultResponses() { * Return canned client responses. */ class Recurly_MockClient { + private array $_responses; + public function __construct() { $this->_responses = array(); } - public function addResponse($method, $uri, $fixture_filename) { + public function addResponse($method, $uri, $fixture_filename): void + { if (!isset($this->_responses[$method])) { $this->_responses[$method] = array(); } $this->_responses[$method][$uri] = $fixture_filename; } - public function request($method, $uri, $data = null) { + public function request($method, $uri, $data = null): Recurly_ClientResponse + { if (isset($this->_responses[$method][$uri])) { $fixture_filename = $this->_responses[$method][$uri]; } @@ -58,11 +62,13 @@ public function request($method, $uri, $data = null) { return $this->responseFromFixture($fixture_filename); } - public function getPdf($uri, $locale = null) { + public function getPdf($uri, $locale = null): array + { return array($uri, $locale); } - protected function responseFromFixture($filename) { + protected function responseFromFixture($filename): Recurly_ClientResponse + { $statusCode = 200; $headers = array(); $body = null; diff --git a/composer.json b/composer.json index e1140b12..f9bf0cbd 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "ext-curl": "*" }, "require-dev": { - "phpunit/phpunit": ">=5.7,<8" + "phpunit/phpunit": "9.*" }, "autoload": { "classmap": ["lib"] diff --git a/lib/recurly/client.php b/lib/recurly/client.php index 92d9d7cf..921fdedc 100644 --- a/lib/recurly/client.php +++ b/lib/recurly/client.php @@ -136,7 +136,9 @@ public static function disableXmlEntityLoading() $disable = (bool)$disable; } - libxml_disable_entity_loader($disable); + if (\PHP_VERSION_ID < 80000) { + libxml_disable_entity_loader($disable); + } } /** diff --git a/lib/recurly/coupon.php b/lib/recurly/coupon.php index 843755f9..24adb89b 100644 --- a/lib/recurly/coupon.php +++ b/lib/recurly/coupon.php @@ -122,7 +122,7 @@ public function createUpdateXML() { $val = $val->format('c'); } - $root->appendChild($doc->createElement($attr, $val)); + $root->appendChild($doc->createElement($attr, $val ?? '')); } return XmlTools::renderXML($doc); diff --git a/lib/recurly/currency_list.php b/lib/recurly/currency_list.php index 246af95d..5985ae89 100644 --- a/lib/recurly/currency_list.php +++ b/lib/recurly/currency_list.php @@ -10,7 +10,7 @@ function __construct($nodeName) { $this->currencies = array(); } - public function addCurrency($currencyCode, $amountInCents) { + public function addCurrency($currencyCode, $amountInCents): void { if (is_string($currencyCode) && strlen($currencyCode) == 3) { $this->currencies[$currencyCode] = new Recurly_Currency($currencyCode, $amountInCents); } @@ -20,18 +20,19 @@ 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]); } + #[ReturnTypeWillChange] public function offsetGet($offset) { return $this->getCurrency($offset); } @@ -44,11 +45,11 @@ 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..2e1c3991 100644 --- a/lib/recurly/error_list.php +++ b/lib/recurly/error_list.php @@ -25,29 +25,30 @@ 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]); } + #[ReturnTypeWillChange] public function offsetGet($offset) { 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..3aa33bfc 100644 --- a/lib/recurly/pager.php +++ b/lib/recurly/pager.php @@ -18,6 +18,7 @@ abstract class Recurly_Pager extends Recurly_Base implements Iterator, Countable * @return integer number of records in list * @throws Recurly_Error */ + #[ReturnTypeWillChange] public function count() { if (isset($this->_href)) { $headers = Recurly_Base::_head($this->_href, $this->_client); @@ -47,7 +48,7 @@ protected function get_first_page() { * * @throws Recurly_Error */ - public function rewind() { + public function rewind(): void { $this->_loadFrom($this->_href); $this->_position = 0; } @@ -58,6 +59,7 @@ public function rewind() { * @return Recurly_Resource the current object * @throws Recurly_Error */ + #[ReturnTypeWillChange] public function current() { // Work around pre-PHP 5.5 issue that prevents `empty($this->count())`: @@ -84,6 +86,7 @@ public function current() /** * @return integer current position within the current page */ + #[ReturnTypeWillChange] public function key() { return $this->_position; } @@ -91,14 +94,14 @@ public function key() { /** * 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'])); }