Skip to content

Commit 595965b

Browse files
author
Aman Aalam
authored
Merge pull request #60 from GigSalad/main
Add PHP 8.1 compatibility
2 parents 106b843 + ed9da78 commit 595965b

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ The Trolley PHP SDK provides integration access to the Trolley API.
77

88
## Requirements
99

10-
PHP version >= 5.4.0 is required.
10+
PHP version >= 7.0.0 is required.
1111

1212
The following PHP extensions are required:
1313

14-
curl
15-
json
16-
mbstring
17-
openssl
14+
`curl`
15+
`json`
16+
`mbstring`
17+
`openssl`
1818

1919
## Installation & Usage
2020

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
}
1616
],
1717
"require": {
18-
"php": ">=5.4",
18+
"php": ">=7.0",
1919
"ext-curl": "*",
2020
"ext-json": "*",
2121
"ext-mbstring": "*",

lib/Trolley/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ public function sslOn()
468468
$ssl = true;
469469
break;
470470
}
471-
if (substr($this->_environment, 0, strlen('localhost')) === 'localhost') {
471+
if (substr($this->_environment ?? '', 0, strlen('localhost')) === 'localhost') {
472472
$ssl = false;
473473
}
474474

lib/Trolley/ResourceCollection.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public function __construct($response, $items, $pager)
5656
/**
5757
* returns the current item when iterating with foreach
5858
*/
59+
#[\ReturnTypeWillChange]
5960
public function current()
6061
{
6162
return $this->_items[$this->_index];
@@ -71,6 +72,7 @@ public function firstItem()
7172
return $this->_items[0];
7273
}
7374

75+
#[\ReturnTypeWillChange]
7476
public function key()
7577
{
7678
return null;
@@ -79,6 +81,7 @@ public function key()
7981
/**
8082
* advances to the next item in the collection when iterating with foreach
8183
*/
84+
#[\ReturnTypeWillChange]
8285
public function next()
8386
{
8487
++$this->_index;
@@ -87,6 +90,7 @@ public function next()
8790
/**
8891
* rewinds the testIterateOverResults collection to the first item when iterating with foreach
8992
*/
93+
#[\ReturnTypeWillChange]
9094
public function rewind()
9195
{
9296
$this->_index = 0;
@@ -95,6 +99,7 @@ public function rewind()
9599
/**
96100
* returns whether the current item is valid when iterating with foreach
97101
*/
102+
#[\ReturnTypeWillChange]
98103
public function valid()
99104
{
100105
if ($this->_index >= count($this->_items)) {

0 commit comments

Comments
 (0)