protected function compare_single_and_plural_arguments( $stack_ptr, $single_context, $plural_context ) {
		$single_content = $single_context['tokens'][0]['content'];
		$plural_content = $plural_context['tokens'][0]['content'];

		preg_match_all( self::SPRINTF_PLACEHOLDER_REGEX, $single_content, $single_placeholders );
		$single_placeholders = $single_placeholders[0];

		preg_match_all( self::SPRINTF_PLACEHOLDER_REGEX, $plural_content, $plural_placeholders );
		$plural_placeholders = $plural_placeholders[0];

		// English conflates "singular" with "only one", described in the codex:
		// https://codex.wordpress.org/I18n_for_WordPress_Developers#Plurals .
		if ( \count( $single_placeholders ) < \count( $plural_placeholders ) ) {
			$error_string = 'Missing singular placeholder, needed for some languages. See https://codex.wordpress.org/I18n_for_WordPress_Developers#Plurals';
			$single_index = $single_context['tokens'][0]['token_index'];

			$this->phpcsFile->addError( $error_string, $single_index, 'MissingSingularPlaceholder' );
		}

		// Reordering is fine, but mismatched placeholders is probably wrong.
		sort( $single_placeholders );
		sort( $plural_placeholders );

		if ( $single_placeholders !== $plural_placeholders ) {
			$this->phpcsFile->addWarning( 'Mismatched placeholders is probably an error', $stack_ptr, 'MismatchedPlaceholders' );
		}
	}
protected function compare_single_and_plural_arguments( $stack_ptr, $single_context, $plural_context ) {
		$single_content = $single_context['tokens'][0]['content'];
		$plural_content = $plural_context['tokens'][0]['content'];

		preg_match_all( self::SPRINTF_PLACEHOLDER_REGEX, $single_content, $single_placeholders );
		$single_placeholders = $single_placeholders[0];

		preg_match_all( self::SPRINTF_PLACEHOLDER_REGEX, $plural_content, $plural_placeholders );
		$plural_placeholders = $plural_placeholders[0];

		// English conflates "singular" with "only one", described in the codex:
		// https://codex.wordpress.org/I18n_for_WordPress_Developers#Plurals .
		if ( \count( $single_placeholders ) < \count( $plural_placeholders ) ) {
			$error_string = 'Missing singular placeholder, needed for some languages. See https://codex.wordpress.org/I18n_for_WordPress_Developers#Plurals';
			$single_index = $single_context['tokens'][0]['token_index'];

			$this->phpcsFile->addError( $error_string, $single_index, 'MissingSingularPlaceholder' );
		}

		// Reordering is fine, but mismatched placeholders is probably wrong.
		sort( $single_placeholders );
		sort( $plural_placeholders );

		if ( $single_placeholders !== $plural_placeholders ) {
			$this->phpcsFile->addWarning( 'Mismatched placeholders is probably an error', $stack_ptr, 'MismatchedPlaceholders' );
		}
	}
protected function compare_single_and_plural_arguments ( $ stack_ptr , $ single_context , $ plural_context ) { $ single_content = $ single_context [ 'tokens' ] [ 0 ] [ 'content' ] ; $ plural_content = $ plural_context [ 'tokens' ] [ 0 ] [ 'content' ] ; preg_match_all ( self :: SPRINTF_PLACEHOLDER_REGEX , $ single_content , $ single_placeholders ) ; $ single_placeholders = $ single_placeholders [ 0 ] ; preg_match_all ( self :: SPRINTF_PLACEHOLDER_REGEX , $ plural_content , $ plural_placeholders ) ; $ plural_placeholders = $ plural_placeholders [ 0 ] ; // English conflates "singular" with "only one", described in the codex: // https://codex.wordpress.org/I18n_for_WordPress_Developers#Plurals . if ( \ count ( $ single_placeholders ) < \ count ( $ plural_placeholders ) ) { $ error_string = 'Missing singular placeholder, needed for some languages. See https://codex.wordpress.org/I18n_for_WordPress_Developers#Plurals' ; $ single_index = $ single_context [ 'tokens' ] [ 0 ] [ 'token_index' ] ; $ this -> phpcsFile -> addError ( $ error_string , $ single_index , 'MissingSingularPlaceholder' ) ; } // Reordering is fine, but mismatched placeholders is probably wrong. sort ( $ single_placeholders ) ; sort ( $ plural_placeholders ) ; if ( $ single_placeholders !== $ plural_placeholders ) { $ this -> phpcsFile -> addWarning ( 'Mismatched placeholders is probably an error' , $ stack_ptr , 'MismatchedPlaceholders' ) ; } }
Check for inconsistencies between single and plural arguments.

@param int   $stack_ptr      The position of the current token in the stack.
@param array $single_context Single context (@todo needs better description).
@param array $plural_context Plural context (@todo needs better description).
@return void
Check for inconsistencies between single and plural arguments .