z7zmey / php-parser

PHP parser written in Go
https://php-parser.com
MIT License
941 stars 63 forks source link

Support PHP 8.0 #127

Closed ruudk closed 1 year ago

ruudk commented 3 years ago

https://www.php.net/releases/8.0/en.php https://stitcher.io/blog/new-in-php-8

ruudk commented 3 years ago

@z7zmey where is the https://github.com/z7zmey/php-parser/blob/master/internal/php7/php7.y file coming from? Did you make this yourself or is this provided by PHP?

Wulfheart commented 3 years ago

Or otherwse: @z7zmey I saw a php8 branch. Do you work oon it? Do you need help?

brainexe commented 3 years ago

+1 from my side. I can also provide help if needed.

i582 commented 3 years ago

Hey For NoVerify and NoColor, we need PHP 8 support right now, but since development is frozen, we decided to start developing on a fork.

If anyone would like to help with the implementation of PHP 8's new features, we would be very happy.

I'll provide a link to the fork we will be doing development a bit later, probably on Monday. In the meantime, if you want to participate in the development, write to me on the telegram @petr_makhnev to cooperate.

i582 commented 3 years ago

Using the grammar from PHP-Parser, it seems that adding all new features will be quite simple since all that remains is to write specific logic for each new grammar rule.

i582 commented 3 years ago

Link to my fork: https://github.com/i582/php-parser

brainexe commented 3 years ago

wow, looks nice already! I'll try to check it out with our php8 codebase tomorrow

i582 commented 3 years ago

wow, looks nice already! I'll try to check it out with our php8 codebase tomorrow

It will be great, full-scale testing on projects is yet to come.

I have tested so far only on PHPUnit, and to my delight, the parser does not give errors, and if the parsed files are turned back into code, then it is fully equal with the original code.

ruudk commented 3 years ago

@i582 Great that you are doing this!! 💪

Would it be an idea to move your fork to a GitHub organization so that it can live forever, is not bound to your name, allow you to pass it on to someone else if you ever get bored with it?

i582 commented 3 years ago

@i582 Great that you are doing this!! 💪

Would it be an idea to move your fork to a GitHub organization so that it can live forever, is not bound to your name, allow you to pass it on to someone else if you ever get bored with it?

After I finish we move it to VKCOM organization. See https://github.com/VKCOM/php-parser/pull/1 I plan to continue in VKCOM fork and develop in it PHP 8.1. My fork was created because the organization could not fork for several days 😄

ruudk commented 3 years ago

@i582 Great! 🎉

I'll subscribe to https://github.com/VKCOM/php-parser/pull/1 then.

i582 commented 3 years ago

I am glad to announce that I have completed 99% of the PHP 8.0 features and the new release is already available. 🎉🎉🎉 Link: https://github.com/VKCOM/php-parser/releases/tag/v0.8.0-rc.2

Why 99%? Heh, maybe I missed something or made mistakes that I didn't catch, so by the time PHP 8.1 support comes out, I will test the changes in our NoVerify and maybe find them 😄.

I tested the parser on several PHP 8 and PHP 7 projects, as well as our huge codebase (several million lines of code) and everything seems to be fine. Also, NoVerify with the new parser found exactly the same number of errors in our codebase as with the old one, which adds confidence that nothing was broken.

i582 commented 2 years ago

Parser now fully supports 8.0-8.2 syntax 🎉

See https://github.com/VKCOM/php-parser/releases/tag/v0.8.2.