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

Class Constants Types PHP 8.3 support

Open Digitalone1 opened this issue 1 year ago • 8 comments

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 '='

Digitalone1 avatar Dec 24 '23 14:12 Digitalone1

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

bastoune avatar Mar 31 '24 08:03 bastoune

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

cseufert avatar Apr 04 '24 04:04 cseufert

Bump

lossendae avatar Apr 23 '24 14:04 lossendae

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.

cay89 avatar May 31 '24 12:05 cay89

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

cseufert avatar Jun 11 '24 00:06 cseufert

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

Kenneth-Sills avatar Jun 24 '24 01:06 Kenneth-Sills