phpcs does NOT display the relevant name of the sniff when a sniff fails.
By adding the
-s argument, the sniff names will be displayed. See the following from
-s Show sniff codes in all reports
You can add this to your PHP CodeSniffer XML Ruleset with the following:
<!-- Append arg -s to phpcs to display the name of failed sniffs --> <arg value="s"/>
Editor Specific Configurations
In Visual Studio Code using the PHPCS extensions, this can be configured with the phpcs.showSources configuration option.
Or if you are using PHP Sniffer & Beautifier, this can be configured with the phpsab.snifferShowSources configuration option.
Vim with ALE Plugin
In Vim (or Neovim) using the ALE Plugin the sniff name is displayed by default. However, sometimes longer sniffs get truncated. In this case, you can run the command
which will display a list of messages that have been displayed (including the full version of the sniff name).
Leave a Reply