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

Updated order of mapping attribute parameters #10964

Merged

Conversation

soltmar
Copy link
Contributor

@soltmar soltmar commented Oct 6, 2023

Currently, when defining entities, PhpStorm complains about order of Doctrine Mapping PHP Attribute parameter order being wrong:

image

This PR changes parameter order for \Doctrine\ORM\Mapping\Index.php and \Doctrine\ORM\Mapping\OneToMany.php to match what is shown in documentation:
image
image

Copy link
Member

@greg0ire greg0ire left a comment

Choose a reason for hiding this comment

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

This is a breaking change for people not using named arguments. I don't think there is a way for us to deprecate not using named arguments, which means I don't see a way to do this on 3.0.x AND provide an upgrade path. Hopefully somebody will.

@soltmar
Copy link
Contributor Author

soltmar commented Oct 6, 2023

You're right. I haven't thought about this as been using named arguments since the beginning. Just wondering how big is usage without named arguments. Maybe we can start some wider discussion about it ? I know this is a minor thing but I'm surprised it wasn't picked before.

Also technically an upgrade would be to swap order of arguments for Index and OneToMany on entities which shouldn't be too much work (although boring one). I could see this going to 3.0 since 3.0 already have breaking changes comparing to 2.x

@greg0ire
Copy link
Member

greg0ire commented Oct 6, 2023

By upgrade path, I mean some change you could do while on 2.x that would allow you to be forward-compatible with 3.0.x (meaning you wouldn't need to perform any change after updating to 3.0.0)

@greg0ire
Copy link
Member

greg0ire commented Oct 8, 2023

But since I don't think a lot of people omit argument names, I agree that this can go to 3.0.x. Please retarget, and add something about this in UPGRADE.md

@greg0ire greg0ire changed the base branch from 2.16.x to 3.0.x October 8, 2023 13:59
@soltmar soltmar force-pushed the 2.16.x-update-order-of-mapping-attributes branch 2 times, most recently from 49e69ed to 5fd4d46 Compare October 9, 2023 08:25
@soltmar
Copy link
Contributor Author

soltmar commented Oct 9, 2023

Done. Let me know if you need Different / better explanation in UPGRADE.md

Thanks

greg0ire
greg0ire previously approved these changes Oct 9, 2023
UPGRADE.md Outdated Show resolved Hide resolved
@derrabus derrabus added this to the 3.0.0 milestone Oct 9, 2023
@soltmar soltmar force-pushed the 2.16.x-update-order-of-mapping-attributes branch from 5fd4d46 to a7b9e8f Compare October 9, 2023 16:08
@SenseException
Copy link
Member

Am I understanding it correctly that this change is introduced to satisfy one IDE or IDE plugin?

@soltmar soltmar force-pushed the 2.16.x-update-order-of-mapping-attributes branch 2 times, most recently from 2b77579 to 1c50149 Compare October 10, 2023 09:11
@soltmar
Copy link
Contributor Author

soltmar commented Oct 10, 2023

Hi @SenseException , not just to satisfy IDE but also to keep arguments of mapping classes in order and according to what you have in doctrine docs which I personally think will be more intuitive.

@soltmar soltmar force-pushed the 2.16.x-update-order-of-mapping-attributes branch from 1c50149 to 7e51a09 Compare October 10, 2023 10:16
@soltmar soltmar requested review from derrabus and greg0ire October 10, 2023 10:44
greg0ire
greg0ire previously approved these changes Oct 10, 2023
@derrabus
Copy link
Member

derrabus commented Oct 11, 2023

Am I understanding it correctly that this change is introduced to satisfy one IDE or IDE plugin?

The PhpStorm inspection is bogus. I agree that the inspection complaining is not enough to motivate this change. However, the parameters are currently ordered inconsistently which is something we can fix in 3.0.

@greg0ire greg0ire merged commit 03148b1 into doctrine:3.0.x Oct 11, 2023
54 checks passed
@greg0ire
Copy link
Member

Thanks @soltmar !

@soltmar soltmar deleted the 2.16.x-update-order-of-mapping-attributes branch October 12, 2023 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants