WordPress/Sniffs/WP/I18nSniff.php
protected function check_argument_tokens( $context ) {
		$stack_ptr = $context['stack_ptr'];
		$tokens    = $context['tokens'];
		$arg_name  = $context['arg_name'];
		$is_error  = empty( $context['warning'] );
		$content   = isset( $tokens[0] ) ? $tokens[0]['content'] : '';

		if ( empty( $tokens ) || 0 === \count( $tokens ) ) {
			$code = $this->string_to_errorcode( 'MissingArg' . ucfirst( $arg_name ) );
			if ( 'domain' !== $arg_name ) {
				$this->addMessage( 'Missing $%s arg.', $stack_ptr, $is_error, $code, array( $arg_name ) );
				return false;
			}

			// Ok, we're examining a text domain, now deal correctly with the 'default' text domain.
			if ( true === $this->text_domain_is_default ) {
				return true;
			}

			if ( true === $this->text_domain_contains_default ) {
				$this->phpcsFile->addWarning(
					'Missing $%s arg. If this text string is supposed to use a WP Core translation, use the "default" text domain.',
					$stack_ptr,
					$code . 'Default',
					array( $arg_name )
				);
			} elseif ( ! empty( $this->text_domain ) ) {
				$this->addMessage( 'Missing $%s arg.', $stack_ptr, $is_error, $code, array( $arg_name ) );
			}

			return false;
		}

		if ( \count( $tokens ) > 1 ) {
			$contents = '';
			foreach ( $tokens as $token ) {
				$contents .= $token['content'];
			}
			$code = $this->string_to_errorcode( 'NonSingularStringLiteral' . ucfirst( $arg_name ) );
			$this->addMessage( 'The $%s arg must be a single string literal, not "%s".', $stack_ptr, $is_error, $code, array( $arg_name, $contents ) );
			return false;
		}

		if ( \in_array( $arg_name, array( 'text', 'single', 'plural' ), true ) ) {
			$this->check_text( $context );
		}

		if ( \T_DOUBLE_QUOTED_STRING === $tokens[0]['code'] || \T_HEREDOC === $tokens[0]['code'] ) {
			$interpolated_variables = $this->get_interpolated_variables( $content );
			foreach ( $interpolated_variables as $interpolated_variable ) {
				$code = $this->string_to_errorcode( 'InterpolatedVariable' . ucfirst( $arg_name ) );
				$this->addMessage( 'The $%s arg must not contain interpolated variables. Found "$%s".', $stack_ptr, $is_error, $code, array( $arg_name, $interpolated_variable ) );
			}
			if ( ! empty( $interpolated_variables ) ) {
				return false;
			}
		}

		if ( isset( Tokens::$textStringTokens[ $tokens[0]['code'] ] ) ) {
			if ( 'domain' === $arg_name && ! empty( $this->text_domain ) ) {
				$stripped_content = $this->strip_quotes( $content );

				if ( ! \in_array( $stripped_content, $this->text_domain, true ) ) {
					$this->addMessage(
						'Mismatched text domain. Expected \'%s\' but got %s.',
						$stack_ptr,
						$is_error,
						'TextDomainMismatch',
						array( implode( "' or '", $this->text_domain ), $content )
					);
					return false;
				}

				if ( true === $this->text_domain_is_default && 'default' === $stripped_content ) {
					$fixable    = false;
					$error      = 'No need to supply the text domain when the only accepted text domain is "default".';
					$error_code = 'SuperfluousDefaultTextDomain';

					if ( $tokens[0]['token_index'] === $stack_ptr ) {
						$prev = $this->phpcsFile->findPrevious( \T_WHITESPACE, ( $stack_ptr - 1 ), null, true );
						if ( false !== $prev && \T_COMMA === $this->tokens[ $prev ]['code'] ) {
							$fixable = true;
						}
					}

					if ( false === $fixable ) {
						$this->phpcsFile->addWarning( $error, $stack_ptr, $error_code );
						return false;
					}

					$fix = $this->phpcsFile->addFixableWarning( $error, $stack_ptr, $error_code );
					if ( true === $fix ) {
						// Remove preceeding comma, whitespace and the text domain token.
						$this->phpcsFile->fixer->beginChangeset();
						for ( $i = $prev; $i <= $stack_ptr; $i++ ) {
							$this->phpcsFile->fixer->replaceToken( $i, '' );
						}
						$this->phpcsFile->fixer->endChangeset();
					}

					return false;
				}
			}

			return true;
		}

		$code = $this->string_to_errorcode( 'NonSingularStringLiteral' . ucfirst( $arg_name ) );
		$this->addMessage( 'The $%s arg must be a single string literal, not "%s".', $stack_ptr, $is_error, $code, array( $arg_name, $content ) );
		return false;
	}
protected function check_argument_tokens( $context ) {
		$stack_ptr = $context['stack_ptr'];
		$tokens    = $context['tokens'];
		$arg_name  = $context['arg_name'];
		$is_error  = empty( $context['warning'] );
		$content   = isset( $tokens[0] ) ? $tokens[0]['content'] : '';

		if ( empty( $tokens ) || 0 === \count( $tokens ) ) {
			$code = $this->string_to_errorcode( 'MissingArg' . ucfirst( $arg_name ) );
			if ( 'domain' !== $arg_name ) {
				$this->addMessage( 'Missing $%s arg.', $stack_ptr, $is_error, $code, array( $arg_name ) );
				return false;
			}

			// Ok, we're examining a text domain, now deal correctly with the 'default' text domain.
			if ( true === $this->text_domain_is_default ) {
				return true;
			}

			if ( true === $this->text_domain_contains_default ) {
				$this->phpcsFile->addWarning(
					'Missing $%s arg. If this text string is supposed to use a WP Core translation, use the "default" text domain.',
					$stack_ptr,
					$code . 'Default',
					array( $arg_name )
				);
			} elseif ( ! empty( $this->text_domain ) ) {
				$this->addMessage( 'Missing $%s arg.', $stack_ptr, $is_error, $code, array( $arg_name ) );
			}

			return false;
		}

		if ( \count( $tokens ) > 1 ) {
			$contents = '';
			foreach ( $tokens as $token ) {
				$contents .= $token['content'];
			}
			$code = $this->string_to_errorcode( 'NonSingularStringLiteral' . ucfirst( $arg_name ) );
			$this->addMessage( 'The $%s arg must be a single string literal, not "%s".', $stack_ptr, $is_error, $code, array( $arg_name, $contents ) );
			return false;
		}

		if ( \in_array( $arg_name, array( 'text', 'single', 'plural' ), true ) ) {
			$this->check_text( $context );
		}

		if ( \T_DOUBLE_QUOTED_STRING === $tokens[0]['code'] || \T_HEREDOC === $tokens[0]['code'] ) {
			$interpolated_variables = $this->get_interpolated_variables( $content );
			foreach ( $interpolated_variables as $interpolated_variable ) {
				$code = $this->string_to_errorcode( 'InterpolatedVariable' . ucfirst( $arg_name ) );
				$this->addMessage( 'The $%s arg must not contain interpolated variables. Found "$%s".', $stack_ptr, $is_error, $code, array( $arg_name, $interpolated_variable ) );
			}
			if ( ! empty( $interpolated_variables ) ) {
				return false;
			}
		}

		if ( isset( Tokens::$textStringTokens[ $tokens[0]['code'] ] ) ) {
			if ( 'domain' === $arg_name && ! empty( $this->text_domain ) ) {
				$stripped_content = $this->strip_quotes( $content );

				if ( ! \in_array( $stripped_content, $this->text_domain, true ) ) {
					$this->addMessage(
						'Mismatched text domain. Expected \'%s\' but got %s.',
						$stack_ptr,
						$is_error,
						'TextDomainMismatch',
						array( implode( "' or '", $this->text_domain ), $content )
					);
					return false;
				}

				if ( true === $this->text_domain_is_default && 'default' === $stripped_content ) {
					$fixable    = false;
					$error      = 'No need to supply the text domain when the only accepted text domain is "default".';
					$error_code = 'SuperfluousDefaultTextDomain';

					if ( $tokens[0]['token_index'] === $stack_ptr ) {
						$prev = $this->phpcsFile->findPrevious( \T_WHITESPACE, ( $stack_ptr - 1 ), null, true );
						if ( false !== $prev && \T_COMMA === $this->tokens[ $prev ]['code'] ) {
							$fixable = true;
						}
					}

					if ( false === $fixable ) {
						$this->phpcsFile->addWarning( $error, $stack_ptr, $error_code );
						return false;
					}

					$fix = $this->phpcsFile->addFixableWarning( $error, $stack_ptr, $error_code );
					if ( true === $fix ) {
						// Remove preceeding comma, whitespace and the text domain token.
						$this->phpcsFile->fixer->beginChangeset();
						for ( $i = $prev; $i <= $stack_ptr; $i++ ) {
							$this->phpcsFile->fixer->replaceToken( $i, '' );
						}
						$this->phpcsFile->fixer->endChangeset();
					}

					return false;
				}
			}

			return true;
		}

		$code = $this->string_to_errorcode( 'NonSingularStringLiteral' . ucfirst( $arg_name ) );
		$this->addMessage( 'The $%s arg must be a single string literal, not "%s".', $stack_ptr, $is_error, $code, array( $arg_name, $content ) );
		return false;
	}
Check if supplied tokens represent a translation text string literal.

@param array $context Context (@todo needs better description).
@return bool