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

[PHP 8.0] Add constructor promotion #667

Closed
wants to merge 6 commits into from
Closed

[PHP 8.0] Add constructor promotion #667

wants to merge 6 commits into from

Conversation

@TomasVotruba TomasVotruba changed the title [WIP] [PHP 8.0] Add constructor promotion [PHP 8.0] Add constructor promotion Jun 7, 2020
@TomasVotruba
Copy link
Contributor Author

Ready for review

@TomasVotruba
Copy link
Contributor Author

I have no idea how to port this part of grammar.

At least, I've added test case that is failing to keep /** docblock */ above one param:

https://github.com/php/php-src/pull/5291/files#diff-7eff82c2c5b45db512a9dc49fb990bb8R1092

@@ -725,7 +726,7 @@ protected function pStmt_PropertyProperty(Stmt\PropertyProperty $node) {
protected function pStmt_ClassMethod(Stmt\ClassMethod $node) {
return $this->pModifiers($node->flags)
. 'function ' . ($node->byRef ? '&' : '') . $node->name
. '(' . $this->pCommaSeparated($node->params) . ')'
. '(' . $this->pMaybeMultiline($node->params) . ')'
Copy link
Contributor Author

@TomasVotruba TomasVotruba Jun 18, 2020

Choose a reason for hiding this comment

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

This seems needed to keep param-per-line formatting, to persist the doc block annotation above the param

@TomasVotruba
Copy link
Contributor Author

TomasVotruba commented Jun 18, 2020

This is now ready to review & merge 👍

lib/PhpParser/Node/Param.php Outdated Show resolved Hide resolved
@nikic
Copy link
Owner

nikic commented Jun 27, 2020

Thanks! Merged as b58b19e with a change to support formatting-preservation.

@nikic nikic closed this Jun 27, 2020
@TomasVotruba TomasVotruba deleted the php80-constructor-promotoin branch July 2, 2020 11:27
@TomasVotruba
Copy link
Contributor Author

Any ETA on releasing this?
I have a Rector features waiting for this rectorphp/rector#3493

And also PHPStan needs to upgrade to this version before Rector can, as it uses static reflection that prefer it's own classes.

@nikic
Copy link
Owner

nikic commented Jul 2, 2020

@TomasVotruba Done!

@TomasVotruba
Copy link
Contributor Author

Thank you

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.

2 participants