Skip to content

Commit d70a396

Browse files
authored
Merge pull request #298 from mogic-le/php8-fixes
Deprecation fixes for PHP 8
2 parents dcad97b + a1d7ae3 commit d70a396

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
],
1818
"license": "MIT",
1919
"require": {
20-
"php": ">=5.5",
20+
"php": ">=7.1",
2121
"ext-curl": "*",
2222
"ext-json": "*",
2323
"ext-simplexml": "*",

src/Runtime/Auth/AuthenticationContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ protected function ensureAuthorizationHeader(RequestOptions $options)
151151
*/
152152
protected function ensureAuthenticationCookie(RequestOptions $options)
153153
{
154-
$headerVal = http_build_query($this->authCookies,null, "; ");
154+
$headerVal = http_build_query($this->authCookies, '', "; ");
155155
$options->ensureHeader('Cookie', urldecode($headerVal));
156156
}
157157

src/Runtime/ClientObjectCollection.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,10 @@ function setProperty($index, $value, $persistChanges = true)
281281

282282

283283
/**
284-
* @return Generator|Traversable
284+
* @return Traversable
285285
* @throws Exception
286286
*/
287-
public function getIterator()
287+
public function getIterator(): Traversable
288288
{
289289
/** @var ClientObject $item */
290290
foreach ($this->data as $index => $item) {
@@ -321,11 +321,12 @@ private function getNextItems(){
321321
* @return boolean
322322
* @abstracting ArrayAccess
323323
*/
324-
public function offsetExists($offset)
324+
public function offsetExists($offset): bool
325325
{
326326
return isset($this->data[$offset]);
327327
}
328328

329+
#[\ReturnTypeWillChange]
329330
/**
330331
* Returns the value at specified offset
331332
*
@@ -348,7 +349,7 @@ public function offsetGet($offset)
348349
* @access public
349350
* @abstracting ArrayAccess
350351
*/
351-
public function offsetSet($offset, $value)
352+
public function offsetSet($offset, $value): void
352353
{
353354
if (is_null($offset)) {
354355
$this->data[] = $value;
@@ -364,7 +365,7 @@ public function offsetSet($offset, $value)
364365
* @access public
365366
* @abstracting ArrayAccess
366367
*/
367-
public function offsetUnset($offset)
368+
public function offsetUnset($offset): void
368369
{
369370
if ($this->offsetExists($offset)) {
370371
unset($this->data[$offset]);

src/Runtime/Http/Requests.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ private static function init(RequestOptions $options)
134134
$opt = $options->Method === HttpMethod::Get ? CURLOPT_FILE : CURLOPT_INFILE;
135135
curl_setopt($ch, $opt, $options->StreamHandle);
136136
}
137-
$options->ensureHeader("Content-Length",strlen($options->Data));
137+
$options->ensureHeader("Content-Length",strlen((string) $options->Data));
138138
//custom HTTP headers
139139
if($options->Headers)
140140
curl_setopt($ch, CURLOPT_HTTPHEADER, $options->getRawHeaders());

0 commit comments

Comments
 (0)