gen_stub.php clean up and small refactoring - #23230
Conversation
kocsismate
left a comment
There was a problem hiding this comment.
Thank you very much!
There is one remaining bug with getFieldSynopsisValueString which is protected and not visible from EnumCaseInfo, but I am not sure how that was supposed to work so I didn't touch it.
Tis feature is currently not used by Enums. TLDR: this would make it possible to define the value of an enum case based on a C value. E.g.
enum ZendTestStringEnum: string {
/**
* @var string
* @cvalue PHP_VERSION
*/
case Version = UNKNOWN;
}
Something along the lines of this. When generating the methodsynopsis for the manual, the value of PHP_VERSION would be display. Also, when generating the enum declaration in the arginfo.h file, the same should happen, but that code path doesn't handle C constants properly ($value = EvaluatedValue::createFromExpression($this->value, null, null, $allConstInfos);), not to mention the fact that not even the necessary PHPDoc is parsed (@var and cvalue).
So all in all, either get rid of this feature for enums, or just make the method public.
When I opened the file, my IDE reported multiple errors and warnings. I fixed the easy-to-fix ones.
There is one remaining bug with
getFieldSynopsisValueStringwhich is protected and not visible from EnumCaseInfo, but I am not sure how that was supposed to work so I didn't touch it.@kocsismate I have split up the changes into separate commits so that you can reject commits you don't like or that break something.