php-parser icon indicating copy to clipboard operation
php-parser copied to clipboard

Support PHP 8.0

Open ruudk opened this issue 3 years ago • 13 comments

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

ruudk avatar Apr 23 '21 06:04 ruudk

@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?

ruudk avatar Apr 23 '21 17:04 ruudk

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

Wulfheart avatar May 01 '21 10:05 Wulfheart

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

brainexe avatar Jul 02 '21 18:07 brainexe

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 avatar Jul 23 '21 19:07 i582

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 avatar Jul 23 '21 19:07 i582

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

i582 avatar Jul 27 '21 15:07 i582

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

brainexe avatar Jul 28 '21 18:07 brainexe

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.

i582 avatar Jul 28 '21 18:07 i582

@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?

ruudk avatar Jul 29 '21 12:07 ruudk

@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 😄

i582 avatar Jul 29 '21 13:07 i582

@i582 Great! 🎉

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

ruudk avatar Jul 29 '21 13:07 ruudk

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 avatar Jul 30 '21 18:07 i582

Parser now fully supports 8.0-8.2 syntax 🎉

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

i582 avatar Jun 26 '22 00:06 i582