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

Show Expr::countDistinct() and Expr::concat() use variable-length argument lists #9909

Closed
wants to merge 7 commits into from

Conversation

craigfrancis
Copy link
Contributor

The functions Expr::countDistinct() and Expr::concat() both use func_get_args() to accept a variable number of arguments.

They should explicitly show this via the "..." operator, which has been supported since PHP 5.6.

@greg0ire
Copy link
Member

Not sure why this wasn't addressed in #8319

@greg0ire
Copy link
Member

There is a (small) BC-break for extending classes: https://3v4l.org/qQUlA

craigfrancis and others added 2 commits July 18, 2022 19:14
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
@craigfrancis
Copy link
Contributor Author

Thanks Grégoire.

I wonder if a few other instances of the func_get_args() functions could be removed as well, but I should probably keep this PR simple.

@craigfrancis
Copy link
Contributor Author

As to the BC-break for extending Expr... that's a good point... is this something that happens with Expr?

@greg0ire
Copy link
Member

greg0ire commented Jul 18, 2022

is this something that happens with Expr?

I'm really not sure how to find out 😅 … all I know is that it is not final nor internal.

@craigfrancis
Copy link
Contributor Author

is this something that happens with Expr?

I'm really not sure how to find out 😅 … all I know is that it is not final nor internal.

Good point, I suppose anyone could want a better version of these methods... where they could prefer a lower-case count() :-)

@greg0ire
Copy link
Member

Maybe retarget to 3.0.x then, and make sure that there are no other occurrences of func_get_args() in the codebase?

@craigfrancis craigfrancis changed the base branch from 2.12.x to 3.0.x July 18, 2022 19:02
@craigfrancis
Copy link
Contributor Author

I've changed the target for this PR.

And a quick search of 3.0.x suggests the only other instance of func_get_args() is in ReflectionReadonlyProperty, and I'm not sure I should be touching that (I'm not too familiar with what it's doing).

@greg0ire
Copy link
Member

I think even if you tried it wouldn't work, as this class extends another one defined by PHP itself. You would probably end up with an incompatible signature.

greg0ire
greg0ire previously approved these changes Jul 18, 2022
@derrabus derrabus added this to the 3.0.0 milestone Jul 18, 2022
Copy link
Member

@derrabus derrabus left a comment

Choose a reason for hiding this comment

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

Good catch, just some nit-picking.

lib/Doctrine/ORM/Query/Expr.php Outdated Show resolved Hide resolved
lib/Doctrine/ORM/Query/Expr.php Outdated Show resolved Hide resolved
Co-authored-by: Alexander M. Turek <me@derrabus.de>
Co-authored-by: Alexander M. Turek <me@derrabus.de>
@craigfrancis
Copy link
Contributor Author

Thanks Alexander

@greg0ire greg0ire enabled auto-merge (squash) July 18, 2022 19:51
greg0ire
greg0ire previously approved these changes Jul 18, 2022
greg0ire and others added 2 commits July 18, 2022 20:57
It is not covered yet, and that makes contributions to these commands
hard.
auto-merge was automatically disabled July 18, 2022 19:58

Head branch was pushed to by a user without write access

@greg0ire
Copy link
Member

Please rebase interactively, get rid of 58df2e1 and squash all other commits into one.

@craigfrancis
Copy link
Contributor Author

Sorry, made even more of a mess of the commit history (I'm putting it down to the heat)... I've opened a new one, which uses 3.0.x as the base, and has a single commit.

@greg0ire
Copy link
Member

Sorry, made even more of a mess of the commit history (I'm putting it down to the heat)... I've opened a new one, which uses 3.0.x as the base, and has a single commit.

Why don't you reopen and force push instead?

@craigfrancis
Copy link
Contributor Author

Why don't you reopen and force push instead?

While I created a branch for this change, I wasn’t paying attention, and committed to the numbered branch… and when it came to the rebase, I was rushing, as I’m cooking food atm and nearly burnt the rice :-)

@greg0ire
Copy link
Member

Slow down lol

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.

None yet

3 participants