PHPCSStandards / PHP_CodeSniffer

PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.
BSD 3-Clause "New" or "Revised" License
805 stars 47 forks source link

Support new PHP 8.3 syntaxes #106

Open jrfnl opened 7 months ago

jrfnl commented 7 months ago

PHP 8.3 includes the following new syntaxes for which it should be verified if the Tokenizer needs updates and/or whether any sniffs need updates:

To Do

Done

leitommi commented 6 months ago

Is there any news on this? Dependencies seem to be released.

jrfnl commented 6 months ago

@leitommi What dependencies are you talking about ?

leitommi commented 6 months ago

I mean these PR-s are merged that were marked as "Blocked until": https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/49 https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/78

I am mostly interested in typed class constants that were introduced in php 8.3.

Currently following code:

class A
{
  const int $MY_VAL;
}

produces following error, with phpcs 3.8.0:

phpcs: Generic.NamingConventions.UpperCaseConstantName.ClassConstantNotUpperCase: Class constants must be uppercase; expected INT but found int

jrfnl commented 5 months ago

For whoever cares - PR #309 is open adding tokenizer support for readonly anonymous classes and PR #321 adding tokenizer support for typed class constants.

Once those two are merged, support can be added to individual sniffs (and yes, the commits for this are ready and waiting).

jrfnl commented 5 months ago

The following three PRs have been opened to add support for PHP 8.3 typed class constants to various sniffs:

Testing of these PRs would be appreciated.

FabianKoestring commented 5 months ago

The following three PRs have been opened to add support for PHP 8.3 typed class constants to various sniffs:

Testing of these PRs would be appreciated.

Everything works as expected for me.✌️👍 When can we expect a release?

KeldorDE commented 5 months ago

The following three PRs have been opened to add support for PHP 8.3 typed class constants to various sniffs:

Testing of these PRs would be appreciated.

I can also confirm that everything is working correctly. 👍

jrfnl commented 5 months ago

@FabianKoestring @KeldorDE Thank you both for testing. Unless something unexpected happens, I'm hoping to release the 3.9.0 version towards the end of next week.

jrfnl commented 5 months ago

Version 3.9.0 has been tagged & released.

I'm leaving this issue open for now as the last bullet still needs to be investigated, though I don't really expect any issues with that syntax, but I'd rather be sure.