public function process_no_parameters( $stackPtr, $group_name, $matched_content ) {

		$target_param = $this->target_functions[ $matched_content ];

		if ( 1 !== $target_param ) {
			// Only process the no param case as fixable if the text domain is expected to be the first parameter.
			$this->phpcsFile->addWarning( 'Missing $domain arg and preceding argument(s)', $stackPtr, 'MissingArgs' );
			return;
		}

		$opener = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true );
		if ( \T_OPEN_PARENTHESIS !== $this->tokens[ $opener ]['code']
			|| isset( $this->tokens[ $opener ]['parenthesis_closer'] ) === false
		) {
			// Parse error or live coding.
			return;
		}

		$fix = $this->phpcsFile->addFixableError( 'Missing $domain arg', $stackPtr, 'MissingArgDomain' );
		if ( true === $fix ) {
			$closer      = $this->tokens[ $opener ]['parenthesis_closer'];
			$replacement = " '{$this->new_text_domain}' ";

			if ( $this->tokens[ $opener ]['line'] !== $this->tokens[ $closer ]['line'] ) {
				$replacement = trim( $replacement );
				$addBefore   = ( $closer - 1 );
				if ( \T_WHITESPACE === $this->tokens[ ( $closer - 1 ) ]['code']
					&& $this->tokens[ $closer - 1 ]['line'] === $this->tokens[ $closer ]['line']
				) {
					if ( isset( $this->tokens[ ( $closer - 1 ) ]['orig_content'] ) ) {
						$replacement = $this->tokens[ ( $closer - 1 ) ]['orig_content']
							. "\t"
							. $replacement;
					} else {
						$replacement = $this->tokens[ ( $closer - 1 ) ]['content']
							. str_repeat( ' ', $this->tab_width )
							. $replacement;
					}

					--$addBefore;
				} else {
					// We don't know whether the code uses tabs or spaces, so presume WPCS, i.e. tabs.
					$replacement = "\t" . $replacement;
				}

				$replacement = $this->phpcsFile->eolChar . $replacement;

				$this->phpcsFile->fixer->addContentBefore( $addBefore, $replacement );

			} elseif ( \T_WHITESPACE === $this->tokens[ ( $closer - 1 ) ]['code'] ) {
				$this->phpcsFile->fixer->replaceToken( ( $closer - 1 ), $replacement );
			} else {
				$this->phpcsFile->fixer->addContentBefore( $closer, $replacement );
			}
		}
	}
public function process_no_parameters( $stackPtr, $group_name, $matched_content ) {

		$target_param = $this->target_functions[ $matched_content ];

		if ( 1 !== $target_param ) {
			// Only process the no param case as fixable if the text domain is expected to be the first parameter.
			$this->phpcsFile->addWarning( 'Missing $domain arg and preceding argument(s)', $stackPtr, 'MissingArgs' );
			return;
		}

		$opener = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true );
		if ( \T_OPEN_PARENTHESIS !== $this->tokens[ $opener ]['code']
			|| isset( $this->tokens[ $opener ]['parenthesis_closer'] ) === false
		) {
			// Parse error or live coding.
			return;
		}

		$fix = $this->phpcsFile->addFixableError( 'Missing $domain arg', $stackPtr, 'MissingArgDomain' );
		if ( true === $fix ) {
			$closer      = $this->tokens[ $opener ]['parenthesis_closer'];
			$replacement = " '{$this->new_text_domain}' ";

			if ( $this->tokens[ $opener ]['line'] !== $this->tokens[ $closer ]['line'] ) {
				$replacement = trim( $replacement );
				$addBefore   = ( $closer - 1 );
				if ( \T_WHITESPACE === $this->tokens[ ( $closer - 1 ) ]['code']
					&& $this->tokens[ $closer - 1 ]['line'] === $this->tokens[ $closer ]['line']
				) {
					if ( isset( $this->tokens[ ( $closer - 1 ) ]['orig_content'] ) ) {
						$replacement = $this->tokens[ ( $closer - 1 ) ]['orig_content']
							. "\t"
							. $replacement;
					} else {
						$replacement = $this->tokens[ ( $closer - 1 ) ]['content']
							. str_repeat( ' ', $this->tab_width )
							. $replacement;
					}

					--$addBefore;
				} else {
					// We don't know whether the code uses tabs or spaces, so presume WPCS, i.e. tabs.
					$replacement = "\t" . $replacement;
				}

				$replacement = $this->phpcsFile->eolChar . $replacement;

				$this->phpcsFile->fixer->addContentBefore( $addBefore, $replacement );

			} elseif ( \T_WHITESPACE === $this->tokens[ ( $closer - 1 ) ]['code'] ) {
				$this->phpcsFile->fixer->replaceToken( ( $closer - 1 ), $replacement );
			} else {
				$this->phpcsFile->fixer->addContentBefore( $closer, $replacement );
			}
		}
	}
public function process_no_parameters ( $ stackPtr , $ group_name , $ matched_content ) { $ target_param = $ this -> target_functions [ $ matched_content ] ; if ( 1 !== $ target_param ) { // Only process the no param case as fixable if the text domain is expected to be the first parameter. $ this -> phpcsFile -> addWarning ( 'Missing $domain arg and preceding argument(s)' , $ stackPtr , 'MissingArgs' ) ; return ; } $ opener = $ this -> phpcsFile -> findNext ( Tokens :: $ emptyTokens , ( $ stackPtr + 1 ) , null , true ) ; if ( \ T_OPEN_PARENTHESIS !== $ this -> tokens [ $ opener ] [ 'code' ] || isset ( $ this -> tokens [ $ opener ] [ 'parenthesis_closer' ] ) === false ) { // Parse error or live coding. return ; } $ fix = $ this -> phpcsFile -> addFixableError ( 'Missing $domain arg' , $ stackPtr , 'MissingArgDomain' ) ; if ( true === $ fix ) { $ closer = $ this -> tokens [ $ opener ] [ 'parenthesis_closer' ] ; $ replacement = " '{$this->new_text_domain}' " ; if ( $ this -> tokens [ $ opener ] [ 'line' ] !== $ this -> tokens [ $ closer ] [ 'line' ] ) { $ replacement = trim ( $ replacement ) ; $ addBefore = ( $ closer - 1 ) ; if ( \ T_WHITESPACE === $ this -> tokens [ ( $ closer - 1 ) ] [ 'code' ] && $ this -> tokens [ $ closer - 1 ] [ 'line' ] === $ this -> tokens [ $ closer ] [ 'line' ] ) { if ( isset ( $ this -> tokens [ ( $ closer - 1 ) ] [ 'orig_content' ] ) ) { $ replacement = $ this -> tokens [ ( $ closer - 1 ) ] [ 'orig_content' ] . "\t" . $ replacement ; } else { $ replacement = $ this -> tokens [ ( $ closer - 1 ) ] [ 'content' ] . str_repeat ( ' ' , $ this -> tab_width ) . $ replacement ; } -- $ addBefore ; } else { // We don't know whether the code uses tabs or spaces, so presume WPCS, i.e. tabs. $ replacement = "\t" . $ replacement ; } $ replacement = $ this -> phpcsFile -> eolChar . $ replacement ; $ this -> phpcsFile -> fixer -> addContentBefore ( $ addBefore , $ replacement ) ; } elseif ( \ T_WHITESPACE === $ this -> tokens [ ( $ closer - 1 ) ] [ 'code' ] ) { $ this -> phpcsFile -> fixer -> replaceToken ( ( $ closer - 1 ) , $ replacement ) ; } else { $ this -> phpcsFile -> fixer -> addContentBefore ( $ closer , $ replacement ) ; } } }
Process the function if no parameters were found.

@since 1.2.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.

@return void
Process the function if no parameters were found .