WordPress/Sniffs/PHP/NoSilencedErrorsSniff.php
public function process_token( $stackPtr ) {
		// Handle the user-defined custom function whitelist.
		$this->custom_whitelist = $this->merge_custom_array( $this->custom_whitelist, array(), false );
		$this->custom_whitelist = array_map( 'strtolower', $this->custom_whitelist );

		if ( true === $this->use_default_whitelist || ! empty( $this->custom_whitelist ) ) {
			/*
			 * Check if the error silencing is done for one of the whitelisted functions.
			 */
			$next_non_empty = $this->phpcsFile->findNext( $this->empty_tokens, ( $stackPtr + 1 ), null, true, null, true );
			if ( false !== $next_non_empty && \T_STRING === $this->tokens[ $next_non_empty ]['code'] ) {
				$has_parenthesis = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $next_non_empty + 1 ), null, true, null, true );
				if ( false !== $has_parenthesis && \T_OPEN_PARENTHESIS === $this->tokens[ $has_parenthesis ]['code'] ) {
					$function_name = strtolower( $this->tokens[ $next_non_empty ]['content'] );
					if ( ( true === $this->use_default_whitelist
						&& isset( $this->function_whitelist[ $function_name ] ) === true )
						|| in_array( $function_name, $this->custom_whitelist, true ) === true
					) {
						$this->phpcsFile->recordMetric( $stackPtr, 'Error silencing', 'whitelisted function call: ' . $function_name );
						return;
					}
				}
			}
		}

		$this->context_length = (int) $this->context_length;
		$context_length       = $this->context_length;
		if ( $this->context_length <= 0 ) {
			$context_length = 2;
		}

		// Prepare the "Found" string to display.
		$end_of_statement = $this->phpcsFile->findEndOfStatement( $stackPtr, \T_COMMA );
		if ( ( $end_of_statement - $stackPtr ) < $context_length ) {
			$context_length = ( $end_of_statement - $stackPtr );
		}
		$found = $this->phpcsFile->getTokensAsString( $stackPtr, $context_length );
		$found = str_replace( array( "\t", "\n", "\r" ), ' ', $found ) . '...';

		$error_msg = 'Silencing errors is strongly discouraged. Use proper error checking instead.';
		$data      = array();
		if ( $this->context_length > 0 ) {
			$error_msg .= ' Found: %s';
			$data[]     = $found;
		}

		$this->phpcsFile->addWarning(
			$error_msg,
			$stackPtr,
			'Discouraged',
			$data
		);

		if ( isset( $function_name ) ) {
			$this->phpcsFile->recordMetric( $stackPtr, 'Error silencing', $function_name );
		} else {
			$this->phpcsFile->recordMetric( $stackPtr, 'Error silencing', $found );
		}
	}
public function process_token( $stackPtr ) {
		// Handle the user-defined custom function whitelist.
		$this->custom_whitelist = $this->merge_custom_array( $this->custom_whitelist, array(), false );
		$this->custom_whitelist = array_map( 'strtolower', $this->custom_whitelist );

		if ( true === $this->use_default_whitelist || ! empty( $this->custom_whitelist ) ) {
			/*
			 * Check if the error silencing is done for one of the whitelisted functions.
			 */
			$next_non_empty = $this->phpcsFile->findNext( $this->empty_tokens, ( $stackPtr + 1 ), null, true, null, true );
			if ( false !== $next_non_empty && \T_STRING === $this->tokens[ $next_non_empty ]['code'] ) {
				$has_parenthesis = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $next_non_empty + 1 ), null, true, null, true );
				if ( false !== $has_parenthesis && \T_OPEN_PARENTHESIS === $this->tokens[ $has_parenthesis ]['code'] ) {
					$function_name = strtolower( $this->tokens[ $next_non_empty ]['content'] );
					if ( ( true === $this->use_default_whitelist
						&& isset( $this->function_whitelist[ $function_name ] ) === true )
						|| in_array( $function_name, $this->custom_whitelist, true ) === true
					) {
						$this->phpcsFile->recordMetric( $stackPtr, 'Error silencing', 'whitelisted function call: ' . $function_name );
						return;
					}
				}
			}
		}

		$this->context_length = (int) $this->context_length;
		$context_length       = $this->context_length;
		if ( $this->context_length <= 0 ) {
			$context_length = 2;
		}

		// Prepare the "Found" string to display.
		$end_of_statement = $this->phpcsFile->findEndOfStatement( $stackPtr, \T_COMMA );
		if ( ( $end_of_statement - $stackPtr ) < $context_length ) {
			$context_length = ( $end_of_statement - $stackPtr );
		}
		$found = $this->phpcsFile->getTokensAsString( $stackPtr, $context_length );
		$found = str_replace( array( "\t", "\n", "\r" ), ' ', $found ) . '...';

		$error_msg = 'Silencing errors is strongly discouraged. Use proper error checking instead.';
		$data      = array();
		if ( $this->context_length > 0 ) {
			$error_msg .= ' Found: %s';
			$data[]     = $found;
		}

		$this->phpcsFile->addWarning(
			$error_msg,
			$stackPtr,
			'Discouraged',
			$data
		);

		if ( isset( $function_name ) ) {
			$this->phpcsFile->recordMetric( $stackPtr, 'Error silencing', $function_name );
		} else {
			$this->phpcsFile->recordMetric( $stackPtr, 'Error silencing', $found );
		}
	}
Processes this test, when one of its tokens is encountered.

@since 1.1.0

@param int $stackPtr The position of the current token in the stack.