Skip to content

Commit

Permalink
Merge pull request #298 from mogic-le/php8-fixes
Browse files Browse the repository at this point in the history
Deprecation fixes for PHP 8
  • Loading branch information
vgrem authored Oct 6, 2022
2 parents dcad97b + a1d7ae3 commit d70a396
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
],
"license": "MIT",
"require": {
"php": ">=5.5",
"php": ">=7.1",
"ext-curl": "*",
"ext-json": "*",
"ext-simplexml": "*",
Expand Down
2 changes: 1 addition & 1 deletion src/Runtime/Auth/AuthenticationContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ protected function ensureAuthorizationHeader(RequestOptions $options)
*/
protected function ensureAuthenticationCookie(RequestOptions $options)
{
$headerVal = http_build_query($this->authCookies,null, "; ");
$headerVal = http_build_query($this->authCookies, '', "; ");
$options->ensureHeader('Cookie', urldecode($headerVal));
}

Expand Down
11 changes: 6 additions & 5 deletions src/Runtime/ClientObjectCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,10 @@ function setProperty($index, $value, $persistChanges = true)


/**
* @return Generator|Traversable
* @return Traversable
* @throws Exception
*/
public function getIterator()
public function getIterator(): Traversable
{
/** @var ClientObject $item */
foreach ($this->data as $index => $item) {
Expand Down Expand Up @@ -321,11 +321,12 @@ private function getNextItems(){
* @return boolean
* @abstracting ArrayAccess
*/
public function offsetExists($offset)
public function offsetExists($offset): bool
{
return isset($this->data[$offset]);
}

#[\ReturnTypeWillChange]
/**
* Returns the value at specified offset
*
Expand All @@ -348,7 +349,7 @@ public function offsetGet($offset)
* @access public
* @abstracting ArrayAccess
*/
public function offsetSet($offset, $value)
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->data[] = $value;
Expand All @@ -364,7 +365,7 @@ public function offsetSet($offset, $value)
* @access public
* @abstracting ArrayAccess
*/
public function offsetUnset($offset)
public function offsetUnset($offset): void
{
if ($this->offsetExists($offset)) {
unset($this->data[$offset]);
Expand Down
2 changes: 1 addition & 1 deletion src/Runtime/Http/Requests.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private static function init(RequestOptions $options)
$opt = $options->Method === HttpMethod::Get ? CURLOPT_FILE : CURLOPT_INFILE;
curl_setopt($ch, $opt, $options->StreamHandle);
}
$options->ensureHeader("Content-Length",strlen($options->Data));
$options->ensureHeader("Content-Length",strlen((string) $options->Data));
//custom HTTP headers
if($options->Headers)
curl_setopt($ch, CURLOPT_HTTPHEADER, $options->getRawHeaders());
Expand Down

0 comments on commit d70a396

Please sign in to comment.