diff --git a/phpcs-sniffs/PluginCheck/Sniffs/CodeAnalysis/RequiredFunctionParametersSniff.php b/phpcs-sniffs/PluginCheck/Sniffs/CodeAnalysis/RequiredFunctionParametersSniff.php index 61200990a..f81addfa9 100644 --- a/phpcs-sniffs/PluginCheck/Sniffs/CodeAnalysis/RequiredFunctionParametersSniff.php +++ b/phpcs-sniffs/PluginCheck/Sniffs/CodeAnalysis/RequiredFunctionParametersSniff.php @@ -10,6 +10,7 @@ namespace PluginCheckCS\PluginCheck\Sniffs\CodeAnalysis; +use PHPCSUtils\Utils\MessageHelper; use PHPCSUtils\Utils\PassedParameters; use WordPressCS\WordPress\AbstractFunctionParameterSniff; @@ -70,10 +71,12 @@ public function process_parameters( $stackPtr, $group_name, $matched_content, $p $found_param = PassedParameters::getParameterFromStack( $parameters, $target_param['position'], $target_param['name'] ); if ( false === $found_param ) { + $error_code = MessageHelper::stringToErrorCode( $matched_content . '_' . $target_param['name'], true ); + $this->phpcsFile->addError( 'The "%s" parameter for function %s() is missing.', $stackPtr, - 'Missing', + $error_code . 'Missing', array( $target_param['name'], $matched_content ) ); }