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

Added more ReturnTypeWillChange attributes #117

Conversation

thirsch
Copy link
Collaborator

@thirsch thirsch commented Feb 3, 2024

During my work on making the coverage working again, I stumbled upon these. Will try to clean the codebase in small steps to make it compatible before activating the coverage within our ci builds.

@thirsch thirsch force-pushed the feature/and-even-more-returntypewillchange-stuff branch 4 times, most recently from 1da6015 to fbb8488 Compare February 6, 2024 10:35
@thirsch thirsch force-pushed the feature/and-even-more-returntypewillchange-stuff branch from fbb8488 to 253f880 Compare February 9, 2024 18:15
@thePanz
Copy link
Member

thePanz commented Feb 11, 2024

LGTM, but the Iterator interface (from PHP) should be respected/enforced here... what about adding the right return type to those methds?
It could be seen as a BC break, but it would be a PHP break if we return something different from the interface.

WDYT?

@thirsch
Copy link
Collaborator Author

thirsch commented Feb 11, 2024

LGTM, but the Iterator interface (from PHP) should be respected/enforced here... what about adding the right return type to those methds? It could be seen as a BC break, but it would be a PHP break if we return something different from the interface.

As long as we are supporting php 7.4, this might not be possible, as the php interfaces use mixed as a return type, which is only supported >= 8.0.

@thePanz
Copy link
Member

thePanz commented Feb 11, 2024

As long as we are supporting php 7.4, this might not be possible, as the php interfaces use mixed as a return type

That would be only as a docblock of the interface, right? As PHP 7.4 does not support mixed as a native typehint IIRC.
I would be in for adding the right typehint here... do you think it will be too much a BC break? How could we add them when well support v8.x only?

@thirsch
Copy link
Collaborator Author

thirsch commented Feb 11, 2024

I would be in for adding the right typehint here... do you think it will be too much a BC break? How could we add them when well support v8.x only?

You mean changing e. g. @return Doctrine_Record to @return mixed? IMO this would only remove more precise information, as the interface allows mixed and we are just more specific with Doctrine_Record here, it is not wrong. With >= 8.0 we could add the correct return type function current(): mixed, keep the docblock comment @return Doctrine_Record and avoid the #[\ReturnTypeWillChange] attributes.

@thirsch
Copy link
Collaborator Author

thirsch commented Feb 16, 2024

At the moment, I wouldn't change these occurrences as we have introduced the attribute on other places as well. If dropping 7.4 one time, maybe we will come up with a true change of the return types? But we would complete the >= 8.1 support on one hand and we are able to go forward towards reactivating the existing coverage mechanism with this pr.

@connorhu
Copy link
Collaborator

Btw anyone know of a tool that updates the entire codebase with static analysis along a given sign/attribute (method will change notice, return type will change etc)? This is what I miss in php that we have in swift, that there is an automatic migration process in the code base when the programming language updates.

@thirsch
Copy link
Collaborator Author

thirsch commented Feb 16, 2024

Btw anyone know of a tool that updates the entire codebase with static analysis along a given sign/attribute (method will change notice, return type will change etc)? This is what I miss in php that we have in swift, that there is an automatic migration process in the code base when the programming language updates.

Does not really belong to this pr, but I'll answer here: Have you tried Rector?

@thirsch thirsch force-pushed the feature/and-even-more-returntypewillchange-stuff branch from 253f880 to 7c5a588 Compare February 18, 2024 20:12
@thirsch thirsch force-pushed the feature/and-even-more-returntypewillchange-stuff branch from 7c5a588 to 7a94f7e Compare February 20, 2024 14:47
@thePanz thePanz merged commit f7a6e29 into FriendsOfSymfony1:master Feb 21, 2024
5 checks passed
@thirsch thirsch deleted the feature/and-even-more-returntypewillchange-stuff branch February 22, 2024 06:50
@thirsch
Copy link
Collaborator Author

thirsch commented Feb 22, 2024

Thanks for merging it :)

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

Successfully merging this pull request may close these issues.

4 participants