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

Introduce a ArrayParameterType enum #5838

Merged
merged 1 commit into from
Dec 29, 2022

Conversation

derrabus
Copy link
Member

@derrabus derrabus commented Dec 29, 2022

Q A
Type improvement
Fixed issues #5837 (partly)

Summary

This PR deprecates the Connection::PARAM_*_ARRAY constants in favor of a new ArrayParameterType class that I'd like to turn into an enum in 4.0.x. My motivation is that those constants are still arbitrary integers and cannot be typed properly on PHP 8. Array parameters are also the only remaining scenario in which a parameter type is expressed as an integer. Transitioning to an enum would allow us to eliminate integers.

Since we already have a ParameterType enum, it makes sense to create an enum for those group of types as well.

The PR also adds a test that is going to fail on 4.0.x and thus reproduces #5837.

@derrabus derrabus force-pushed the improvement/array-parameter-type branch from 45d7a61 to c6bdad1 Compare December 29, 2022 17:30
*/
public const ARRAY_PARAM_OFFSET = 100;
Copy link
Member

Choose a reason for hiding this comment

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

I'm fine with this removal because it's internal. How do others see this?

Copy link
Member

Choose a reason for hiding this comment

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

Favorably

Choose a reason for hiding this comment

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

ORM seems use it #5837 (comment) and if doctrine/dbal and doctrine/orm is not a match it will fail. So for bc reasons when I think it need to be kept if somebody is only updating doctrine/dbal and not doctrine/orm. Else doctrine/dbal 3.6.0 would require to set a conflict to all doctrine/orm versions lower than a supported version that version to avoid that older none compatible orm versino is used, setting requirement on doctrine/orm side would not work as current orm version already supports ^3.6.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. I'll restore the constant.

Copy link
Member Author

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

@derrabus Thank you!

@derrabus derrabus merged commit 7e0d352 into doctrine:3.6.x Dec 29, 2022
@derrabus derrabus deleted the improvement/array-parameter-type branch December 29, 2022 22:58
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants