WPThemeReview/Sniffs/CoreFunctionality/NoDeregisterCoreScriptSniff.php
public function process_parameters( $stackPtr, $group_name, $matched_content, $parameters ) {

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

		$matched_parameter = $this->strip_quotes( $parameters[1]['raw'] );
		$first_param_token = $this->phpcsFile->findNext(
			Tokens::$emptyTokens,
			$parameters[1]['start'],
			( $parameters[1]['end'] + 1 ),
			true
		);

		if ( isset( $this->target_functions[ $matched_content ][ $matched_parameter ] ) ) {
			$this->throw_prohibited_error( $first_param_token, array( $matched_parameter ) );
			return;
		}

		// More extensive check to prevent people circumventing the sniff.
		$text                 = '';
		$found_variable_token = false;

		for ( $i = $parameters[1]['start']; $i <= $parameters[1]['end']; $i++ ) {
			if ( isset( Tokens::$stringTokens[ $this->tokens[ $i ]['code'] ] ) === false ) {
				if ( T_VARIABLE === $this->tokens[ $i ]['code']
					|| T_STRING === $this->tokens[ $i ]['code']
				) {
					$found_variable_token = true;
				}

				continue;
			}

			$text .= $this->strip_quotes( $this->tokens[ $i ]['content'] );
		}

		if ( isset( $this->target_functions[ $matched_content ][ $text ] ) ) {
			$this->throw_prohibited_error( $first_param_token, array( $text ) );
			return;
		}

		if ( true === $found_variable_token ) {
			$this->throw_variable_handle_warning( $first_param_token, array( $matched_content, $matched_parameter ) );
		}
	}
public function process_parameters( $stackPtr, $group_name, $matched_content, $parameters ) {

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

		$matched_parameter = $this->strip_quotes( $parameters[1]['raw'] );
		$first_param_token = $this->phpcsFile->findNext(
			Tokens::$emptyTokens,
			$parameters[1]['start'],
			( $parameters[1]['end'] + 1 ),
			true
		);

		if ( isset( $this->target_functions[ $matched_content ][ $matched_parameter ] ) ) {
			$this->throw_prohibited_error( $first_param_token, array( $matched_parameter ) );
			return;
		}

		// More extensive check to prevent people circumventing the sniff.
		$text                 = '';
		$found_variable_token = false;

		for ( $i = $parameters[1]['start']; $i <= $parameters[1]['end']; $i++ ) {
			if ( isset( Tokens::$stringTokens[ $this->tokens[ $i ]['code'] ] ) === false ) {
				if ( T_VARIABLE === $this->tokens[ $i ]['code']
					|| T_STRING === $this->tokens[ $i ]['code']
				) {
					$found_variable_token = true;
				}

				continue;
			}

			$text .= $this->strip_quotes( $this->tokens[ $i ]['content'] );
		}

		if ( isset( $this->target_functions[ $matched_content ][ $text ] ) ) {
			$this->throw_prohibited_error( $first_param_token, array( $text ) );
			return;
		}

		if ( true === $found_variable_token ) {
			$this->throw_variable_handle_warning( $first_param_token, array( $matched_content, $matched_parameter ) );
		}
	}
public function process_parameters ( $ stackPtr , $ group_name , $ matched_content , $ parameters ) { if ( ! isset ( $ parameters [ 1 ] ) ) { return ; } $ matched_parameter = $ this -> strip_quotes ( $ parameters [ 1 ] [ 'raw' ] ) ; $ first_param_token = $ this -> phpcsFile -> findNext ( Tokens :: $ emptyTokens , $ parameters [ 1 ] [ 'start' ] , ( $ parameters [ 1 ] [ 'end' ] + 1 ) , true ) ; if ( isset ( $ this -> target_functions [ $ matched_content ] [ $ matched_parameter ] ) ) { $ this -> throw_prohibited_error ( $ first_param_token , array ( $ matched_parameter ) ) ; return ; } // More extensive check to prevent people circumventing the sniff. $ text = '' ; $ found_variable_token = false ; for ( $ i = $ parameters [ 1 ] [ 'start' ] ; $ i <= $ parameters [ 1 ] [ 'end' ] ; $ i ++ ) { if ( isset ( Tokens :: $ stringTokens [ $ this -> tokens [ $ i ] [ 'code' ] ] ) === false ) { if ( T_VARIABLE === $ this -> tokens [ $ i ] [ 'code' ] || T_STRING === $ this -> tokens [ $ i ] [ 'code' ] ) { $ found_variable_token = true ; } continue ; } $ text .= $ this -> strip_quotes ( $ this -> tokens [ $ i ] [ 'content' ] ) ; } if ( isset ( $ this -> target_functions [ $ matched_content ] [ $ text ] ) ) { $ this -> throw_prohibited_error ( $ first_param_token , array ( $ text ) ) ; return ; } if ( true === $ found_variable_token ) { $ this -> throw_variable_handle_warning ( $ first_param_token , array ( $ matched_content , $ matched_parameter ) ) ; } }
Process the parameters of a matched function.

@since 0.1.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
Process the parameters of a matched function .