Skip to content

WIP: Enhance gen_stub.php - #7700

Draft
m6w6 wants to merge 7 commits into
php:masterfrom
m6w6:enhance-gen_stub
Draft

m6w6 wants to merge 7 commits into
php:masterfrom
m6w6:enhance-gen_stub

Conversation

@m6w6

@m6w6 m6w6 commented Nov 28, 2021 •

Copy link
Copy Markdown
Contributor
  • prop decls for ctor promoted props
  • fix collision of namespaced functions
  • fix generating multiple declaration prefixes

@kocsismate kocsismate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

And please add a test case in zend_test

Comment thread build/gen_stub.php
@@ -2369,7 +2369,7 @@ function parseFunctionLike(
function parseProperty(
Name $class,
int $flags,
Stmt\PropertyProperty $property,
Stmt\PropertyProperty|Node\Param $property,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We aim for PHP 7.1 compatibility, so union types shouldn't be used.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I do not understand. PHP-7 is in security-fix-only mode, so this PR is not going to land in PHP-7.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah, but one can run gen_stubs.php via an earlier PHP version: e.g. I always use the version which is available on my the system (it's 8.0 in my case though).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry, but ... 🤷

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No, it's not a negligible issue: gen_stub.php is automatically run by the build system during compilation via the php executable which is on path.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So, what do you suggest? A runtime check for instanceof Stmt\PropertyProperty or Node\Param?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IMO a phpdoc would be enough, just like we did elsewhere, but I'm OK with a runtime check as well.

Comment thread build/gen_stub.php
@m6w6
m6w6 force-pushed the enhance-gen_stub branch from 0fcb229 to 930889a Compare January 7, 2022 18:07
@Girgias

Girgias commented Jun 8, 2022

Copy link
Copy Markdown
Member

What's the status here?

@m6w6

m6w6 commented Jun 8, 2022

Copy link
Copy Markdown
Contributor Author

What's the status here?

Kinda stuck. I'll have to find my most current stash and update it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants