Skip to content

Conversation

@TomasVotruba
Copy link
Contributor

@TomasVotruba TomasVotruba commented Jun 7, 2020

@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

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 👍

@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