Skip to content

Commit

Permalink
Use PHPCSUtils MessageHelper::addMessage
Browse files Browse the repository at this point in the history
This is more tested than the WPCS Sniff::addMessage().
  • Loading branch information
GaryJones committed Jun 22, 2023
1 parent b977416 commit 7ce4c18
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace WordPressVIPMinimum\Sniffs;

use WordPressVIPMinimum\Sniffs\Sniff;
use PHPCSUtils\Utils\MessageHelper;

/**
* Restricts usage of some variables.
Expand Down Expand Up @@ -200,11 +200,13 @@ public function process_token( $stackPtr ) {
continue;
}

$this->addMessage(
$code = MessageHelper::stringToErrorcode( $groupName . '_' . $match[1] );
MessageHelper::addMessage(
$this->phpcsFile,
$group['message'],
$stackPtr,
$group['type'] === 'error',
$this->string_to_errorcode( $groupName . '_' . $match[1] ),
$code,
[ $var ]
);

Expand Down

0 comments on commit 7ce4c18

Please sign in to comment.