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 arginfos of required arguments for some Reflection methods #3443
Conversation
This is also a BC break, but I'd be fine with giving it a try in 7.3, as inheritors are likely to already use the signature with an optional argument. Definitely can't go into 7.1 though. |
@nikic Sorry, but why? Arginfo is dedicated to the Reflection API, right? Also, we've already made these changes in the past. Do methods and functions have diferent behaviours?
I'll change the base branch after review my comment below. |
@carusogabriel Please consider the following script: <?php
class MyReflectionMethod extends ReflectionMethod
{
public function invoke($object, $args) {}
} It compiles fine before this PR, but throws a warning after merging:
|
@cmb69 Thank you for the explanation, things are now clear for me why changing arginfo of methods, especially those ones that users can extend are considered BC break. I'll close this one and add to our list of small things we should fix in PHP.NEXT. Thanks. |
This is unacceptable BC break. Breaks Doctrine:
Breaks BetterReflection:
Please don't touch Reflection for once. :X cc @Ocramius |
Yeah, sadly it impacts existing libraries in a hard way, and likely not fixable in a minor release |
As reported in #74035 and #71416,
ReflectionClass::newInstance
andReflectionMethod::invoke
have wrong number or required arguments in arginfo.Looks like there was previous PRs fixing these bugs, but there were reject due they also change the arginfo of variadics arguments. This time, I'm only changing the number of required arguments, been a bug fix, not a BC break.
If this PR gets merge, we also need to fix the documentation for
ReflectionClass::newInstance
.