Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make code PHP8.1 compatible #205

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Jira/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/Jira/Api/Client/ClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ interface ClientInterface
public function sendRequest(
$method,
$url,
$data = array(),
$data,
$endpoint,
AuthenticationInterface $credential,
$is_file = false,
Expand Down
2 changes: 1 addition & 1 deletion src/Jira/Api/Client/CurlClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function __construct()
public function sendRequest(
$method,
$url,
$data = array(),
$data,
$endpoint,
AuthenticationInterface $credential,
$is_file = false,
Expand Down
12 changes: 6 additions & 6 deletions src/Jira/Issues/Walker.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that in PHP 8.1 (or even in PHP 8.0) the Iterator interface method signatures were changed. Due to that change, I see no way to have the same iterator class declaration, that will satisfy every supported PHP version (5.x, 7.x, 8.x).

Do you see any way to make this work?

P.S.
This code changes causes lot of builds to fail.

{
if ( is_callable($this->callback) ) {
$tmp = $this->issues[$this->offset];
Expand All @@ -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++;
}
Expand All @@ -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);
Expand All @@ -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');
Expand Down Expand Up @@ -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;
Expand All @@ -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();
Expand Down
Loading