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

Migrate part of the tools namespace to PHP8 syntax #9900

Merged
merged 4 commits into from Jul 19, 2022

Conversation

greg0ire
Copy link
Member

No description provided.

* {@inheritdoc}
*
* @return int
*/
#[ReturnTypeWillChange]
Copy link
Member

Choose a reason for hiding this comment

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

The attribute can be removed now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh right, same below.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have to look at the files one by one because for instance here, the constructor was not affected by Rector.

@greg0ire greg0ire added this to In progress in PHP 8 Migration via automation Jul 15, 2022
@greg0ire greg0ire force-pushed the php8-migration branch 2 times, most recently from c0b915c to 1f46cda Compare July 15, 2022 14:22
@greg0ire
Copy link
Member Author

I think it will be better to touch the walkers after #9551 is finished. I will remove change to them from this PR

@greg0ire greg0ire changed the title Migrate tools namespace to PHP8 syntax Migrate part of the tools namespace to PHP8 syntax Jul 15, 2022
@greg0ire greg0ire marked this pull request as ready for review July 15, 2022 15:52
SenseException
SenseException previously approved these changes Jul 18, 2022
* @psalm-return ArrayIterator<array-key, T>
*/
#[ReturnTypeWillChange]
public function getIterator()
public function getIterator(): ArrayIterator
Copy link
Member

Choose a reason for hiding this comment

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

It was already an ArrayIterator before, but should this method rely on an Iterator implementation in the return type instead of the interface itself? Even the name of the method doesn't refer to a specific Iterator implementation.

It's not really a blocker for a merge, but food for thoughts for 3.0.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, no, I totally see what you mean: if the consumer don't leverage it, why should we provide that level of detail. Here, they shouldn't be calling getIterator() directly but use a foreach, so that's one more reason to do this. Let me change that.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, IteratorAggregate allows to access getIterator() directly. Technically it should be Traversable as the docs suggests, but I wasn't sure if this step was a too large for this PR.

That way we have some level of error handling, and don't muddy the
return type.
@derrabus derrabus added this to the 3.0.0 milestone Jul 19, 2022
@greg0ire greg0ire merged commit 2550417 into doctrine:3.0.x Jul 19, 2022
PHP 8 Migration automation moved this from In progress to Done Jul 19, 2022
@greg0ire greg0ire deleted the php8-migration branch July 19, 2022 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants