Closed 6562680 closed 4 years ago
This is true, because variadic is not a parameter, but a function.
Try to use Printer::printParameters($function) instead of implode(). I changed it to public method in 3.3.4
Will do
I'd tested. printParameters() prints method declaration parameters with types.
it is useless if i need print method body like sprintf('%s->method(%s), $class, $printer->printParameters($method));
Is there a way to do it somehow?
So, i can send to you the generator command class, maybe you promote me with some recomendations, how to do things better... yes, i know time is money, so we can talk about, telegram @gzhegow or somewhere
I don't understand well what you want to achieve?
$method->setBody(sprintf('static::getInstance()->%s%s', $method->getName(), $printer->printParameters($method));
We'll get static::getInstance()->myMethod(string $string, ...$params);
, but there's unexpected "string" literal because of non-signature case. Not sure about default values:
The static::getInstance()->myMethod(string $string = 'foo', ...$params);
still unexpected result
expected one is:
The static::getInstance()->myMethod($string, ...$params);
I understand.
What parameters you pass on the functions are not much related to their reflection, it is purely up to you. implode() is here a good way.
Would be great to see "isVariadic()" on $parameter too, to avoid manual Reflection (because you doing it already)
Version: 3.3.3
Bug Description
I tried to copy class using reflection then make some changes with method parameters, calling it through different method. So i join params using php native implode() function and failed, because i had some params variadic with ...$param definition in method signature.
I tried to check, but there's no method, will use php reflection method for that at now