exercism / php

Exercism exercises in PHP.
https://exercism.org/tracks/php
MIT License
144 stars 139 forks source link

Fix sniff error name in PHPCS error message #860

Open mk-mxp opened 4 days ago

mk-mxp commented 4 days ago

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 commented 3 days ago

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

jrfnl commented 3 days ago

It is.