From 2295b5037081e2f5f774cdec151df49fc7a54a86 Mon Sep 17 00:00:00 2001 From: Roy Arisse Date: Thu, 10 Oct 2024 16:37:06 +0200 Subject: [PATCH] Make code PHP8.1 compatible Fix: Remove optional arguments before required arguments. Fix: Return types for Walker. --- src/Jira/Api.php | 2 +- src/Jira/Api/Client/ClientInterface.php | 2 +- src/Jira/Api/Client/CurlClient.php | 2 +- src/Jira/Issues/Walker.php | 12 ++++++------ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Jira/Api.php b/src/Jira/Api.php index 33f2a4e..e5e6d45 100644 --- a/src/Jira/Api.php +++ b/src/Jira/Api.php @@ -709,7 +709,7 @@ public function createRemoteLink( * @return array|Result|false */ public function api( - $method = self::REQUEST_GET, + $method, $url, $data = array(), $return_as_array = false, diff --git a/src/Jira/Api/Client/ClientInterface.php b/src/Jira/Api/Client/ClientInterface.php index f056e07..afba2b1 100644 --- a/src/Jira/Api/Client/ClientInterface.php +++ b/src/Jira/Api/Client/ClientInterface.php @@ -53,7 +53,7 @@ interface ClientInterface public function sendRequest( $method, $url, - $data = array(), + $data, $endpoint, AuthenticationInterface $credential, $is_file = false, diff --git a/src/Jira/Api/Client/CurlClient.php b/src/Jira/Api/Client/CurlClient.php index 9e3acb8..3d93e7b 100644 --- a/src/Jira/Api/Client/CurlClient.php +++ b/src/Jira/Api/Client/CurlClient.php @@ -62,7 +62,7 @@ public function __construct() public function sendRequest( $method, $url, - $data = array(), + $data, $endpoint, AuthenticationInterface $credential, $is_file = false, diff --git a/src/Jira/Issues/Walker.php b/src/Jira/Issues/Walker.php index f8e5509..815b906 100644 --- a/src/Jira/Issues/Walker.php +++ b/src/Jira/Issues/Walker.php @@ -149,7 +149,7 @@ public function push($jql, $fields = null) * @return mixed Can return any type. * @link http://php.net/manual/en/iterator.current.php */ - public function current() + public function current(): mixed { if ( is_callable($this->callback) ) { $tmp = $this->issues[$this->offset]; @@ -168,7 +168,7 @@ public function current() * @return void Any returned value is ignored. * @link http://php.net/manual/en/iterator.next.php */ - public function next() + public function next(): void { $this->offset++; } @@ -179,7 +179,7 @@ public function next() * @return mixed scalar on success, or null on failure. * @link http://php.net/manual/en/iterator.key.php */ - public function key() + public function key(): mixed { if ( $this->startAt > 0 ) { return $this->offset + (($this->startAt - 1) * $this->perPage); @@ -198,7 +198,7 @@ public function key() * @throws Api\UnauthorizedException When it happens. * @link http://php.net/manual/en/iterator.valid.php */ - public function valid() + public function valid(): bool { if ( is_null($this->jql) ) { throw new \Exception('you have to call Jira_Walker::push($jql, $fields) at first'); @@ -260,7 +260,7 @@ public function valid() * @return void Any returned value is ignored. * @link http://php.net/manual/en/iterator.rewind.php */ - public function rewind() + public function rewind(): void { $this->offset = 0; $this->startAt = 0; @@ -277,7 +277,7 @@ public function rewind() * @return integer The custom count as an integer. * @link http://php.net/manual/en/countable.count.php */ - public function count() + public function count(): int { if ( $this->total === null ) { $this->valid();