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

Fix sniff error name in PHPCS error message #860

Closed
mk-mxp opened this issue Nov 15, 2024 · 3 comments
Closed

Fix sniff error name in PHPCS error message #860

mk-mxp opened this issue Nov 15, 2024 · 3 comments

Comments

@mk-mxp
Copy link
Contributor

mk-mxp commented Nov 15, 2024

In src/Sniffs/ExplainStrictTypesSniff.php we produce a addFixableError() with self::class. This shouldn't be the fully qualified class name, but an identifier unique for the error message like Missing.

This is not a functional problem, only an oddity in case of an error:

FILE: /home/runner/work/php/php/exercises/practice/meetup/.meta/example.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 2 | ERROR | [x] Missing explanation of declaration of strict types.
   |       |     (Exercism.StrictTypes.ExplainStrictTypes.Exercism\Sniffs\StrictTypes\ExplainStrictTypesSniff)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 4.12 secs; Memory: 8MB

The message identifier may be used to configure severity etc. The class name is converted to the dot notation correctly, and our custom message identifier is appended after the last dot. The FQCN here makes the message look broken and does not help.

@tomasnorre
Copy link
Contributor

I think this is already include in the #857 with the commit from @jrfnl

@jrfnl
Copy link
Contributor

jrfnl commented Nov 15, 2024

It is.

@tomasnorre
Copy link
Contributor

I have closed this as it solved in #857

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

No branches or pull requests

3 participants