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 return types for PHP 8.1 #42260

Merged
merged 1 commit into from Aug 4, 2021

Conversation

derrabus
Copy link
Member

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #42199, Fix #42231, Part of #41552
License MIT
Doc PR N/A

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

Did you use some tool to generate this? It'd be cool to document how we did so that others can do the same I their libs.

@derrabus
Copy link
Member Author

Did you use some tool to generate this? It'd be cool to document how we did so that others can do the same I their libs.

No, this was manual work. I used PhpStorm to find all implementations of Countable, IteratorAggregate and friends. For each case I checked individually whether I can add a return type directly or need to add the attribute. I also checked for each occurrence if the @return annotation is equivalent or covariant to the return type in PHP 8.1.

@sebastianbergmann
Copy link
Contributor

No, this was manual work.

Would be nice if that did not have to be the case. CC @TomasVotruba

@TomasVotruba
Copy link
Contributor

@sebastianbergmann Depends how much time it took to do. If its < 30 minutes, than automation would take longer.

@derrabus
Copy link
Member Author

@sebastianbergmann Depends how much time it took to do. If its < 30 minutes, than automation would take longer.

I was definitely faster than 30 min. 😎

@sebastianbergmann
Copy link
Contributor

@sebastianbergmann Depends how much time it took to do. If its < 30 minutes, than automation would take longer.
I was definitely faster than 30 min. 😎

Sorry for the noise.

@TomasVotruba
Copy link
Contributor

@sebastianbergmann Thanks for the ping. If this would be something that every Symfony user has to change in their projects too, saved times is enourmous.

@wouterj

This comment has been minimized.

@derrabus
Copy link
Member Author

derrabus commented Aug 3, 2021

@wouterj This PR already includes that change. Code reviews welcome. 🙂

Copy link
Member

@wouterj wouterj left a comment

Choose a reason for hiding this comment

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

Oh, missed that. Looks good!

@derrabus derrabus force-pushed the bugfix/return-type-will-change branch from 1b6624b to 3eca446 Compare August 4, 2021 20:31
@derrabus
Copy link
Member Author

derrabus commented Aug 4, 2021

@symfony/mergers Merging this PR would remove some noise from our CI. Any objections against it?

Copy link
Member

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

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

Im happy with this PR.

I dont know if this is complete or not. But if we missed some iterator we can fix them in a follow up PR.

@derrabus derrabus merged commit 5b1fc10 into symfony:4.4 Aug 4, 2021
@derrabus derrabus deleted the bugfix/return-type-will-change branch August 4, 2021 21:31
@derrabus
Copy link
Member Author

derrabus commented Aug 4, 2021

Thanks everyone. ❤️

@derrabus
Copy link
Member Author

derrabus commented Aug 4, 2021

Follow-up for the 5.3 branch: #42379

Tobion added a commit that referenced this pull request Aug 4, 2021
This PR was merged into the 5.3 branch.

Discussion
----------

Fix return types for PHP 8.1

| Q             | A
| ------------- | ---
| Branch?       | 5.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | #41552
| License       | MIT
| Doc PR        | N/A

Follow-up of #42260.

Commits
-------

ab3c43f Fix return types for PHP 8.1
This was referenced Aug 30, 2021
SpacePossum added a commit to PHP-CS-Fixer/PHP-CS-Fixer that referenced this pull request Dec 1, 2021
This PR was merged into the master branch.

Discussion
----------

DX: test on PHP 8.1

Changes in `composer.json` must be reverted, this require:

- [x] [justinrainbow/json-schema](https://github.com/justinrainbow/json-schema) to be released with the fix: justinrainbow/json-schema#666
- [x] [mikey179/vfsstream](https://github.com/bovigo/vfsStream) new v1 version to be released
- [x] [mikey179/vfsstream](https://github.com/bovigo/vfsStream) another version (with bovigo/vfsStream#261) to be released
- [x] [symfony/symfony](https://github.com/symfony/symfony) new version (with symfony/symfony#42260) to be released

Commits
-------

a4358ec Test on PHP 8.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Finder] PHP 8.1 deprecation notices [Console] PHP 8.1 deprecation notice for HelperSet::getIterator()
9 participants