Does it support PHP 8?
thanks
No it is not supported, we need improve parser
Upstream issue: https://github.com/glayzzle/php-parser/issues/486
Sorry, is php 8 support ready?
No, we need update our parser, you can help
No, we need update our parser, you can help
@alexander-akait This repo https://github.com/glayzzle/php-parser ?
Yes
@Eldair would you like to collaborate?
@Wulfheart it will take me some time to see how it all works, but I would like to help.
I opened a PR (wip) for php-parser, but it seems not actively maintained anymore.
@Selion05 I also have merge permissions at the parser, but I don't know the codebase too well. Let's try to collect PHP8 related changes in a separate branch for now.
ok nice! Yeah I don't know it either. We will figure it out :D
I Will work on it tomorrow
Awesome! I'll do my best to help. I'm a little short on time so it might be just reviews, we'll see :slightly_smiling_face:
Does this PR support match statements yet? I tried this locally, but I'm not sure if I'm testing it right.
https://www.php.net/manual/en/control-structures.match.php
Here's the output I get when I try formatting the following snippet:
<?php
// /tmp/test.php
// here's some trivial code:
$x = 2;
echo match ($x ) {
1, 2 => 'Same for 1 and 2',
3, 4 => 'Same for 3 and 4' ,
} . PHP_EOL;
$ npx prettier --php-version 8.0 /tmp/test.php
[error] test.php: SyntaxError: Parse Error : syntax error, unexpected ',', expecting '}' on line 6
[error] 4 |
[error] 5 | echo match ($x ) {
[error] > 6 | 1, 2 => 'Same for 1 and 2',
[error] | ^
[error] 7 | 3, 4 => 'Same for 3 and 4' ,
[error] 8 | } . PHP_EOL;
[error] 9 |
|Name | Version
| ---: | :--- |
| nvm | 0.37.2 |
| node | v15.11.0 |
| npm | 7.6.0 |
| prettier | 2.2.1 |
| @prettier/plugin-php* | ed00e2a07851cfacba0f8648dc7b209be6b9e6b9 |
* installed with npm i -D 'prettier/plugin-php#pull/1656/head'
@mklein994 no, only named arguments and nullsafe property lookup are supported at this point (see PR description).
your testing code looks right.
I have been working on php-parser, and have added PR's for match, promoted properties, and union types, however no one seems to be reviewing any code in the last week or two.
I am totally stuck how to parse PHP Attributes, I havent had time to figure out how to improve the lexer to parse attributes, rather than being seen as comments.
I'll go ahead and close this issue in favor of the tracking issue for PHP 8 support: #1691
Most helpful comment
Awesome! I'll do my best to help. I'm a little short on time so it might be just reviews, we'll see :slightly_smiling_face: