tighten / duster

Automatic configuration for Laravel apps to apply Tighten's standard linting & code standards.
MIT License
461 stars 13 forks source link

Lack of support for PHP 8.3 typed class constants #141

Closed ppmathis closed 5 months ago

ppmathis commented 5 months ago

I've recently tried introducing Duster into a new Laravel project and noticed that I am unable to use any typed class constants as introduced with PHP 8.3. As an example, the following code currently fails linting:

class Test {
  protected const string ABC = 'Hello World';
}

The reported error is caused by the Generic.NamingConventions.UpperCaseConstantName sniff, which reports Class constants must be uppercase; expected STRING but found string, therefor indicating that the type is checked instead of the actual name of the constant.

Some quick research on my side about PHP_CodeSniffer has shown that their latest release 3.9.0 added support for typed class constants, including an update for the affected sniff. Linting the same code snippet with PHPCS 3.9.0 directly outside of Duster also no longer reports any issues.

Would it be possible to bump this dependency and ship a new Duster release, so that PHP 8.3 is better supported? Thanks a lot in advance, Duster ships some really nice and sane defaults!

driftingly commented 5 months ago

Hi @ppmathis Thanks for reporting and researching a fix 🙌 I've updated dependencies in 2.7.4.