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

Fix ObjectIterator for PHP8 #682

Closed
wants to merge 1 commit into from
Closed
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
11 changes: 6 additions & 5 deletions src/JsonSchema/Iterator/ObjectIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function __construct($object)
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function current()
{
$this->initialize();
Expand All @@ -49,7 +50,7 @@ public function current()
/**
* {@inheritdoc}
*/
public function next()
public function next(): void
Copy link
Collaborator

Choose a reason for hiding this comment

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

In it's current state the library supports >=5.3.3 as percomposer.json requirements. The void keyword was introduced only in PHP 7.1. I know there are plans to drop support for PHP <7.2 (Even approved by @Seldaek) but in an attempt to revive the library and doing some initial triage I did want to point this out for ourselves.

It also applies to the int and bool return types which where added in PHP 7.0.

In order to make this PR considered for merging into the repo changing all to #[\ReturnTypeWillChange] would be needed I guess.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@R4c00n in an attempt to cleanup this repo we are trying to filter the pull request and see which ones might be closed and which ones we can help resolve. Do you still feel like pursuing this PR or did time catch up on us and are you working on other priorities? Feel free to close it yourself or comments if helpful.

{
$this->initialize();
$this->position++;
Expand All @@ -58,7 +59,7 @@ public function next()
/**
* {@inheritdoc}
*/
public function key()
public function key(): int
{
$this->initialize();

Expand All @@ -68,7 +69,7 @@ public function key()
/**
* {@inheritdoc}
*/
public function valid()
public function valid(): bool
{
$this->initialize();

Expand All @@ -78,7 +79,7 @@ public function valid()
/**
* {@inheritdoc}
*/
public function rewind()
public function rewind(): void
{
$this->initialize();
$this->position = 0;
Expand All @@ -87,7 +88,7 @@ public function rewind()
/**
* {@inheritdoc}
*/
public function count()
public function count(): int
{
$this->initialize();

Expand Down