WordPress/Sniffs/NamingConventions/ValidHookNameSniff.php
public function process_parameters( $stackPtr, $group_name, $matched_content, $parameters ) {
		// Ignore deprecated hook names.
		if ( strpos( $matched_content, '_deprecated' ) > 0 ) {
			return;
		}

		if ( ! isset( $parameters[1] ) ) {
			return;
		}

		$regex = $this->prepare_regex();

		$case_errors = 0;
		$underscores = 0;
		$content     = array();
		$expected    = array();

		for ( $i = $parameters[1]['start']; $i <= $parameters[1]['end']; $i++ ) {
			$content[ $i ]  = $this->tokens[ $i ]['content'];
			$expected[ $i ] = $this->tokens[ $i ]['content'];

			if ( \in_array( $this->tokens[ $i ]['code'], array( \T_CONSTANT_ENCAPSED_STRING, \T_DOUBLE_QUOTED_STRING ), true ) ) {
				$string = $this->strip_quotes( $this->tokens[ $i ]['content'] );

				/*
				 * Here be dragons - a double quoted string can contain extrapolated variables
				 * which don't have to comply with these rules.
				 */
				if ( \T_DOUBLE_QUOTED_STRING === $this->tokens[ $i ]['code'] ) {
					$transform       = $this->transform_complex_string( $string, $regex );
					$case_transform  = $this->transform_complex_string( $string, $regex, 'case' );
					$punct_transform = $this->transform_complex_string( $string, $regex, 'punctuation' );
				} else {
					$transform       = $this->transform( $string, $regex );
					$case_transform  = $this->transform( $string, $regex, 'case' );
					$punct_transform = $this->transform( $string, $regex, 'punctuation' );
				}

				if ( $string === $transform ) {
					continue;
				}

				if ( \T_DOUBLE_QUOTED_STRING === $this->tokens[ $i ]['code'] ) {
					$expected[ $i ] = '"' . $transform . '"';
				} else {
					$expected[ $i ] = '\'' . $transform . '\'';
				}

				if ( $string !== $case_transform ) {
					$case_errors++;
				}
				if ( $string !== $punct_transform ) {
					$underscores++;
				}
			}
		}

		$data = array(
			implode( '', $expected ),
			implode( '', $content ),
		);

		if ( $case_errors > 0 ) {
			$error = 'Hook names should be lowercase. Expected: %s, but found: %s.';
			$this->phpcsFile->addError( $error, $stackPtr, 'NotLowercase', $data );
		}
		if ( $underscores > 0 ) {
			$error = 'Words in hook names should be separated using underscores. Expected: %s, but found: %s.';
			$this->phpcsFile->addWarning( $error, $stackPtr, 'UseUnderscores', $data );
		}
	}
public function process_parameters( $stackPtr, $group_name, $matched_content, $parameters ) {
		// Ignore deprecated hook names.
		if ( strpos( $matched_content, '_deprecated' ) > 0 ) {
			return;
		}

		if ( ! isset( $parameters[1] ) ) {
			return;
		}

		$regex = $this->prepare_regex();

		$case_errors = 0;
		$underscores = 0;
		$content     = array();
		$expected    = array();

		for ( $i = $parameters[1]['start']; $i <= $parameters[1]['end']; $i++ ) {
			$content[ $i ]  = $this->tokens[ $i ]['content'];
			$expected[ $i ] = $this->tokens[ $i ]['content'];

			if ( \in_array( $this->tokens[ $i ]['code'], array( \T_CONSTANT_ENCAPSED_STRING, \T_DOUBLE_QUOTED_STRING ), true ) ) {
				$string = $this->strip_quotes( $this->tokens[ $i ]['content'] );

				/*
				 * Here be dragons - a double quoted string can contain extrapolated variables
				 * which don't have to comply with these rules.
				 */
				if ( \T_DOUBLE_QUOTED_STRING === $this->tokens[ $i ]['code'] ) {
					$transform       = $this->transform_complex_string( $string, $regex );
					$case_transform  = $this->transform_complex_string( $string, $regex, 'case' );
					$punct_transform = $this->transform_complex_string( $string, $regex, 'punctuation' );
				} else {
					$transform       = $this->transform( $string, $regex );
					$case_transform  = $this->transform( $string, $regex, 'case' );
					$punct_transform = $this->transform( $string, $regex, 'punctuation' );
				}

				if ( $string === $transform ) {
					continue;
				}

				if ( \T_DOUBLE_QUOTED_STRING === $this->tokens[ $i ]['code'] ) {
					$expected[ $i ] = '"' . $transform . '"';
				} else {
					$expected[ $i ] = '\'' . $transform . '\'';
				}

				if ( $string !== $case_transform ) {
					$case_errors++;
				}
				if ( $string !== $punct_transform ) {
					$underscores++;
				}
			}
		}

		$data = array(
			implode( '', $expected ),
			implode( '', $content ),
		);

		if ( $case_errors > 0 ) {
			$error = 'Hook names should be lowercase. Expected: %s, but found: %s.';
			$this->phpcsFile->addError( $error, $stackPtr, 'NotLowercase', $data );
		}
		if ( $underscores > 0 ) {
			$error = 'Words in hook names should be separated using underscores. Expected: %s, but found: %s.';
			$this->phpcsFile->addWarning( $error, $stackPtr, 'UseUnderscores', $data );
		}
	}
Process the parameters of a matched function.

@since 0.11.0

@param int    $stackPtr        The position of the current token in the stack.
@param array  $group_name      The name of the group which was matched.
@param string $matched_content The token content (function name) which was matched.
@param array  $parameters      Array with information about the parameters.

@return void