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

[PHP8.3] "final public const string JOURNEY" leads to "Class constants must be uppercase" #3936

Closed
ralusnom opened this issue Dec 6, 2023 · 4 comments · Fixed by PHPCSStandards/PHP_CodeSniffer#332

Comments

@ralusnom
Copy link

ralusnom commented Dec 6, 2023

Description

In IntelliJ IDEA phpcs, incorrectly flags valid PHP code as an warning. Specifically, it misinterprets the type of class constants. For example, declaring a constant like final public const string JOURNEY; results in an error message from PHP CS Fixer stating

"phpcs: Class constants must be uppercase; expected STRING but found string".

It seems that PHP CS Fixer is incorrectly checking the type declaration (string) instead of the constant name (JOURNEY).

Runtime version

PHP CS Fixer v3.40.2, when used with PHP 8.3

Code snippet that reproduces the problem

<?php
// Erroneous code snippet
final public const string JOURNEY;
@jrfnl
Copy link
Contributor

jrfnl commented Dec 6, 2023

Closing as reported to the wrong project. CS-Fixer !== PHP_CodeSniffer.

@jrfnl jrfnl closed this as not planned Won't fix, can't repro, duplicate, stale Dec 6, 2023
@kubawerlos
Copy link

@jrfnl actually reported in the correct project, only reported wrongly, see the error message.

@jrfnl
Copy link
Contributor

jrfnl commented Dec 6, 2023

@kubawerlos In that case, still closed correctly as the issues sounds like a duplicate of #3927. Please search before opening a new issue (and don't open issues in this repo anymore - see #3932)

@jrfnl
Copy link
Contributor

jrfnl commented Feb 16, 2024

FYI: a fix for this issue is included in today's PHP_CodeSniffer 3.9.0 release.

As per #3932, development on PHP_CodeSniffer will continue in the PHPCSStandards/PHP_CodeSniffer repository. If you want to stay informed, you may want to start "watching" that repo (or watching releases from that repo).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants