prettier / plugin-php

Prettier PHP Plugin
https://loilo.github.io/prettier-php-playground/
MIT License
1.74k stars 126 forks source link

Class Constants Types PHP 8.3 support #2299

Open Digitalone1 opened 8 months ago

Digitalone1 commented 8 months ago

Is there a plan to support new 8.3 version? The following code is correct, but prettier says not.

class Foo
{
    public const string PHP_VERSION = "8.3";
}

SyntaxError: Parse Error : syntax error, unexpected 'PHP_VERSION' (T_STRING), expecting '='

bastoune commented 5 months ago

Hi, is there any plan to release something soon about this ?

cseufert commented 5 months ago

Some fo the 8.3 syntax changes are not yet supported by php-prettier.

lossendae commented 4 months ago

Bump

cay89 commented 3 months ago

If I set phpVersion to 8.3 in the config like this:

"plugins": ["@prettier/plugin-php"],
"phpVersion": "8.3",
"overrides": [
  {
    "files": "*.php",
    "options": {
      "singleQuote": true
    }
  }
]

then the whole "run on save" feature does not work in PhpStorm.

cseufert commented 3 months ago

Along with static typed constants, we prettier does not read 8.3 as a valid version: https://github.com/prettier/plugin-php/blob/46b7ba998afac4affa8b39c0c0054618ee049ab6/src/options.mjs#L10-L26

Kenneth-Sills commented 2 months ago

The upstream parser library doesn't have support for PHP 8(.3) yet. See related ticket. This specific issue is tracked here.