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 support? #1599

Closed
zachary opened this issue Nov 27, 2020 · 16 comments · Fixed by #1656
Closed

PHP 8 support? #1599

zachary opened this issue Nov 27, 2020 · 16 comments · Fixed by #1656

Comments

@zachary
Copy link

zachary commented Nov 27, 2020

Does it support PHP 8?

thanks

@alexander-akait
Copy link
Member

alexander-akait commented Nov 28, 2020

No it is not supported, we need improve parser

@czosel
Copy link
Collaborator

czosel commented Nov 28, 2020

Upstream issue: glayzzle/php-parser#486

@timur265
Copy link

timur265 commented Jan 26, 2021

Sorry, is php 8 support ready?

@alexander-akait
Copy link
Member

No, we need update our parser, you can help

@eldair
Copy link
Contributor

eldair commented Feb 5, 2021

No, we need update our parser, you can help

@alexander-akait This repo https://github.com/glayzzle/php-parser ?

@alexander-akait
Copy link
Member

Yes

@Wulfheart
Copy link

@eldair would you like to collaborate?

@eldair
Copy link
Contributor

eldair commented Feb 5, 2021

@Wulfheart it will take me some time to see how it all works, but I would like to help.

@Selion05
Copy link

I opened a PR (wip) for php-parser, but it seems not actively maintained anymore.

@czosel
Copy link
Collaborator

czosel commented Feb 21, 2021

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

@Selion05
Copy link

ok nice! Yeah I don't know it either. We will figure it out :D

I Will work on it tomorrow

@czosel
Copy link
Collaborator

czosel commented Feb 22, 2021

Awesome! I'll do my best to help. I'm a little short on time so it might be just reviews, we'll see 🙂

@mklein994
Copy link

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 | 

Environment

Name Version
nvm 0.37.2
node v15.11.0
npm 7.6.0
prettier 2.2.1
@prettier/plugin-php* ed00e2a

* installed with npm i -D 'prettier/plugin-php#pull/1656/head'

@czosel
Copy link
Collaborator

czosel commented Mar 6, 2021

@mklein994 no, only named arguments and nullsafe property lookup are supported at this point (see PR description).
your testing code looks right.

@cseufert
Copy link
Collaborator

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.

See: glayzzle/php-parser#486

@czosel
Copy link
Collaborator

czosel commented Apr 3, 2021

I'll go ahead and close this issue in favor of the tracking issue for PHP 8 support: #1691

@czosel czosel closed this as completed Apr 3, 2021
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 a pull request may close this issue.

9 participants