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

[gen_stub] fix nested namespaced typed property in gen_stub.php #7418

Merged
merged 5 commits into from
Aug 31, 2021

Conversation

zeriyoshi
Copy link
Contributor

gen_stub.php fails to auto-generate typed properties with nested namespaces.

There is nothing broken in php-src with this at the moment, but we will try to fix it as it is difficult to create an extension.

@nikic
Copy link
Member

nikic commented Aug 28, 2021

Can you please add a test to the zend_test extension?

@@ -1351,7 +1351,9 @@ public function getDeclaration(): string {
if (count($arginfoType->classTypes) >= 2) {
foreach ($arginfoType->classTypes as $classType) {
$className = $classType->name;
$code .= "\tzend_string *property_{$propertyName}_class_{$className} = zend_string_init(\"$className\", sizeof(\"$className\") - 1, 1);\n";
$escapedClassName = str_replace('\\', '\\\\', $className);
Copy link
Member

Choose a reason for hiding this comment

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

I believe this is $classType->toEscapedName().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks.
It seems to me that there is no ClassType type and everything is SimpleType, is this intended?
If it is intended, keep it is.

Copy link
Member

Choose a reason for hiding this comment

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

I noticed this as well, and fixed the type hint in c1c1822.

@nikic nikic merged commit eaac77f into php:master Aug 31, 2021
@zeriyoshi zeriyoshi deleted the gen_stub_fix branch August 31, 2021 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants